3 ms·
HotSpot does not need to infer object shapes, so it doesn't need inline caches for field accesses. HotSpot doesn't need to infer whether (and where) methods lie
by titzer 6y ago
HotSpot does not need to infer object shapes, so it doesn't need inline caches for field accesses. HotSpot doesn't need to infer whether (and where) methods lie in the prototype chain of an object. HotSpot does not need to speculate that arithmetic fits in integer range. HotSpot does not need to speculate that fields are (not) deleted from objects. HotSpot does not need to speculate that a function has a .toString() called on it. HotSpot does not need to speculate that a local variable can be modified by a sloppy direct eval. HotSpot does not need to do scope analysis and closure conversion. HotSpot does not need to speculate that the arguments object does not escape.
All of these things are extremely typical for a JS VM to profile and speculate on.
I do not work on JSC, but I did work on V8 and it does all of these things.
- monocasa 6y ago> HotSpot does not need to infer object shapes, so it doesn't need inline caches for field accesses. Those are just modeled as invokedynamic getters and setters for dynamically laid out objects. It's handled great. > HotSpot doesn't need to infer whether (and where) methods lie in the prototype chain of an object. How is that different than vtable lookups? > HotSpot does not need to speculate that arithmetic fits in integer range. Here's where they added that to the JVM. https://bugs.openjdk.java.net/browse/JDK-8042946 https://bugs.openjdk.java.net/browse/JDK-8042946 > HotSpot does not need to speculate that fields are (not) deleted from objects. Once again, handled as invokedynamiced getters and setters. > HotSpot does not need to do scope analysis and closure conversion. HotSpot does not need to speculate that the arguments object does not escape. They absolutely do since lambdas have been supported.
- titzer 6y ago>> HotSpot doesn't need to infer whether (and where) methods lie in the prototype chain of an object. > How is that different than vtable lookups? sigh Maybe to you this seems fun, but from where I am sitting, you are starting to get annoying. It is really not necessary for you to try to dominate this whole post with some completely unnecessary over-the-top HotSpot-is-the-best-ever chest thumping. This wasn't an isolated comment, but you are all over the thread and in people's faces. It's odious when you want to make confident claims and yet don't know the difference between vtable lookup and JavaScript prototype access. It's exactly this kind of exchange that we need less of. I wish you would step back and appreciate more of the shared context here to recognize that you don't need to explain (and exaggerate) the inner workings of JVMs to people who have worked on them for quite some years in the past. We'd probably be friends and have fun if you'd drop the HotSpot schtick. I went through that phase too, about 10 years ago. At this point your comments here and elsewhere show a pattern of aggression that just makes people want to disengage, but I am forced to offer you some advice to try to salvage this. It's no fun for anyone to be part of a community with such an adversarial and hostile conversation ongoing. I hope I can resist the urge to be drawn into correcting the rest of your misunderstandings about JavaScript here in a way that doesn't make you feel slighted, because you're not receptive to it anyway and that's an obviously unproductive discussion. But listen, invokedynamic isn't a panacea, it's a nice addition to the JVM to accomplish some dynamism, but it's not mission accomplished by any means. Invokedynamic is a mechanism that requires the existence of dynamic optimization at a higher level, i.e. a higher-level language runtime. Your claims again overstate what it does. You didn't understand what I meant about scope analysis or the arguments object because those don't exist at the JVM level and you must have patterned matched them to something else completely different. And don't even get me started on HotSpot's startup time.