3 ms·
Could you elaborate on the original smalltalk paper and its relation to js jit?
by andi999 5y ago
Could you elaborate on the original smalltalk paper and its relation to js jit?
- KMag 5y agoMcCarthy is generally credited with the first JIT for his early LISP work, but SmallTalk and SmallTalk-inspired languages were involved in a lot of the pioneering work related to modern JITs. My understanding is that McCarthy's JIT generated machine code as source code was first loaded, not when it was first invoked. As far as I know, the earliest VMs to wait until a function's first invocation to JIT the function were SmallTalk VMs. The Self language by David Ungar and others was an expansion of some of the SmallTalk ideas. If I remember correctly, Self is where polymorphic inline caching originated. Sun acqui-hired Urs Holzle (who did his PhD under Ungar), David Griswald, Gilad Bracha, and Lars Bak for their StrongTalk (statically typed dialect of SmallTalk) hybrid bytecode interpreter/JIT, which was the basis for the HotSpot JVM. Lars Bak later created the original V8 JavaScript JIT for Chrome. When I was on the Google web search indexing team, I did a bit of work running a pre-release V8 in the indexing pipeline (to analyze text and formatting changes made to pages by JavaScript). If I remember correctly, at that time V8 wasn't a hybrid interpreter/JIT, but did quick-and-dirty generation of x86 machine code when a function was first invoked, and leaned heavily on polymorphic inline caching. My understanding is that early V8 was rather similar to the Self VM. I believe ideas like tracing JITs originated a bit further from the SmallTalk ecosystem, but a lot of modern JIT ideas and techniques came from early SmallTalk and related research.
- pjmlp 5y agoSince you mention McCarthy and JITs, there is another set of poor folks that seem forgoten on JIT research. Only recently did I learn that Dartmouth BASIC did use a JIT approach as well. It was only when dialects started to crop up on 8-bit computers that the trend for BASIC to be an interpreted language came to be.
- rjsw 5y agoI don't remember any Lisp work being considered an example of a JIT, the Deutsch/Schiffman paper was felt to be a big breakthrough when it was published.
- KMag 5y agoJohn Aycock credits McCarthy's Lisp work in "A brief history of just-in-time"[0] Though, as I mentioned, I believe the native code was generated when the module was loaded. These days, we generally consider JIT compilation to be compilation that happens at first invocation (or after, in the case of hybrid interpretation/JIT), so it doesn't precisely fit the modern notion of JIT compilation. [0] https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.97.3985 https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.97....
- pjmlp 5y agoNot the OP, but these papers are well known anyway. Smalltalk was one of the first JIT implementations, "Efficient implementation of the smalltalk-80 system" https://dl.acm.org/doi/10.1145/800017.800542 https://dl.acm.org/doi/10.1145/800017.800542 Then they followed up with StrongTalk, https://strongtalk.org/ https://strongtalk.org/ And SELF, which JavaScript OOP is modeled on, https://selflanguage.org https://selflanguage.org You will recognize some of the V8 names on those papers. Additionally, SELF JIT was repurposed as Hotspot by Java 1.2. Although Java looks like C++ from syntax point of view, it actually is closer to Smalltalk and Objective-C in runtime semantics, thus it could profit a lot from that JIT research as well, even though it was originally targeted to dynamic languages.
- tekknolagi 5y agoThanks for chiming in!