4 ms·
JSC 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 po
by pizlonator 6y ago
JSC 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.
- chrisseaton 6y agoI don't think it's reasonable to describe those as five independent tiers. Two of them just add (slower) code to collect profiling information.
- pizlonator 6y agoAccording to that, it skips level 1 and goes all the way to 3 in some cases. Again, not the same as what JSC does, and not nearly as aggressive. Most notably, there is no baseline jit. Also, C1 in any config compiles slower than DFG.