4 ms·
I'd say that the JVMs (particularly Azul's) are more advanced at this. Even with types, they sill speculate in order to inline across virtual method calls. Bu
by monocasa 6y ago
I'd say that the JVMs (particularly Azul's) are more advanced at this. Even with types, they sill speculate in order to inline across virtual method calls.
But agreed that the amount of perf JS engines can achieve is truly impressive.
- pizlonator 6y agoJSC speculates in order to inline across virtual method calls while also inferring types. Also inlining across virtual method calls is just old hat. See the post’s related work section to learn some of the history. Most of the post is about techniques that are more involved that inlining and devirtualization.
- monocasa 6y agoHotSpot is a fork of strongtalk, which did the same thing and in fact invented the techniques you're talking about (ie. creating fake backing types for untyped code and optimistically inlining those with bounces out to the interpreter on failures, perhaps keeeping several copies around and swapping out the entry in the inline cache). Additionally that functionality has been added to over time with the invokedynamic byte code and it's optimizations.
- pizlonator 6y agoInvented some of the techniques in the post. Most of the post is about what’s new. I cite the work that led up to strongtalk throughout the post.
- monocasa 6y agoI read the article and don't see any examples of what hotspot doesn't do? What am I missing?
- pizlonator 6y agoHotSpot has four tiers huh? That’s just one snarky example. There are lots of others. I’m sure you could identify them easily, if you are familiar with HotSpot and you read the post.
- monocasa 6y agoLast time I checked it had five tiers. Like, really one non snarky example is all I'm looking for. As someone who does know the internals of hotspot fairly well and read the post.
- pizlonator 6y agoJSC has four in the sense that hot enough functions go through LLInt, then Baseline, then DFG, and then FTL. They go through three lower optimization levels before the max one. HotSpot has three in the sense that you get interpreter, client, then server. Both VMs have additional execution engines available behind flags. JSC has a different interpreter (CLoop, based on LLInt but different) for some systems, so it’s like a “fifth tier” if you think of “tier” as just an available execution engine. I think of tier as a stage of optimization that you get adaptively, without having to specifically configure for it. I get that HotSpot can alternatively AOT or Graal, but those aren’t tiered with the rest to my knowledge (like there is no interpreter->client->server->graal config but if there was then that would be four tiers).
- monocasa 6y agoHotSpot definitely uses five tiers (including the interpreter, so same as JSC). https://github.com/openjdk/jdk/blob/0aefe6f20ae719c9793c790dbf5993a6edd9a746/src/hotspot/share/compiler/tieredThresholdPolicy.hpp#L37 https://github.com/openjdk/jdk/blob/0aefe6f20ae719c9793c790d... I'll give you that levels 1-3 use the same IR, but that says more about the generality of the C1 IR than JSC being more advanced for using different IRs IMO.
- 6y ago
- titzer 6y agoMany, if not most, of the people working on advanced JavaScript VMs come from a Java background. I would say JS VMs are orders of magnitude more sophisticated in the type of behavioral profiling they do in order to recover types, understand object shapes, and shortcut prototype lookups. While HotSpot and Azul (a progeny of HotSpot) are highly tuned, a lot more investment has gone into bread-and-butter JIT and GC work, whereas JS runtimes have to have a very advanced object model and type profiling infrastructure.