3 ms·
It feels like I have decent intuitive hunches about what compilers can do; I mostly just ask the question, "is the problem conceptually simple?", and go from th
by Dewie 12y ago
It feels like I have decent intuitive hunches about what compilers can do; I mostly just ask the question, "is the problem conceptually simple?", and go from there. Of course, I'm missing all of the edge cases and subtleties when I'm doing that. And I don't actively try to do it when it comes to actual code; mostly for quizzes like this.
My intuition seems to fail me, though, when we get to things like escape analysis in languages like Java. It seems like a conceptually simple problem - that is, stack allocating or "unpacking" objects (like value classes/objects)that are __obviously__ going to not escape the scope of a method. I don't mean simple as in determining all objects. And the __obvious__ ones seem much more common than the non-obvious ones, in regular code. But then it seems that this is a fairly recent implementation, which might suggest that it isn't so simple to implement?
- lmm 12y agoThe JVM is ...hairy, and poorly understood. Some of its code has not changed since 1996, and much has been very heavily hand-optimized; the people who work on it today are not the people who originally wrote it. Implementing anything in the JVM is not so simple; it's not really a reflection on the complexity of the thing you're implementing. (It might have got better now - I know the OpenJDK folks were making some efforts in that direction)