Going Deep

Inside SPUR - A Trace-Based JIT Compiler for CIL

Download this episode

Download Video

Description

Computer Scientists and MSR Researchers Wolfram Schulte, Herman VenterNikolai Tillmann, and Manuel Fahndrich join Erik Meijer for an Expert to Expert deep dive into the theory and implementation strategies inside of SPUR, a research Tracing Just-In-Time (TJIT) compiler for Microsoft’s Common Intermediate Language CIL (the target language of C#, VB.NET, F#, and many other .NET languages).  

Tracing just-in-time compilers (TJITs) determine frequently executed traces (hot paths and loops) in running programs and focus their optimization effort by emitting optimized machine code specialized to these traces. Prior work has established this strategy to be especially beneficial for dynamic languages such as JavaScript, where the TJIT interfaces with the interpreter and produces machine code from the JavaScript trace. 

In order to validate that the performance gains of a TJIT for interpreted languages like JavaScript do not depend on specific idioms of the language, the SPUR team produces a performance evaluation of a JavaScript runtime that translates JavaScript to CIL and then runs on top of SPUR.

Read the SPUR research paper.

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • staceyw

      Thanks.  Interesting stuff.  Is java script going to be it forever on the browser?  Erik does work using java script as an IL.  In my simple mind, that seems like a good workaround, but not a complete solution.  Will something like this allow any language to run on browser?  Like a compiler as a service in the browser deal?

       

      In terms of singularity.  Is there an exit summary?  What are the learnings?  Was there a dead-end?  Was there a discovery that lead to new direction and/or project?  tia   

    • Charles

      In terms of  Singularity, that was simply a side conversation, unrelated in context... Singularity is and has always been a research project, a test bed for OS proof-of-concept development. The Singularity researchers are the ones who should speak about Singularity's current and future states... I have no idea if/when this will happen.

       

      Again, Singularity is a "platform" for scientific experimentation related to operating system research.

       

      C

    • head.in.the.​box

      Compiling MSIL to JavaScript is the opposite of SPUR, which compiles JavaScript to MSIL. The interesting hypothesis of using a tracing JIT is that it does not matter at which side of the equation you start since all hot abstractions will be "traced away" at runtime. The potential of no-pay abstraction is quite enticing. It is like being able to feast on an all-you-can-eat buffet without gaining any weight Smiley

    • Charles

      Awesome analogy, Erik! Smiley

       

      Hmm. A buffet with a JIT that traces away calories. Yes, a BJIT.  Las Vegas should be the first place to implement this... Wink
      C

    • sylvan

      How does this relate to statically typed languages like C#? Does it improve upon the normal JIT for those too? Apologies if this is answered in the video. I'm bandwidth-limited at the moment so I'll have to watch it later.

    • GamlerHart

      Interesting video about a interesting topic. I'm wondering how much a ASP.NET server application could benefit from such a technology. Because such a process runs for a long, long time and therefore even more costly optimizations might pay off. Especially because costly optimizations could run as background task without problems.

       

      Anyway, very I hope will see more interesting research work in this area =)

    • ShinNoNoir

      Interesting video. Smiley

       

      Btw, Charles, Erik, do you know the best way I could get an answer to my question for the JSMeter team?

    • Charles

      I FW'd your question to Ben and Ben.
      C

    • felix9

      background theorem prover that tracing itself, what an idea ! sounds like a M.C. Escher artwork. Smiley

      and, automatic parallelization in the runtime, wow, truly a gold mine ......

      nicely done Charles, and thank you for asking the singularity question.

      hope tracing can get into .NET 'beep', today's research is tomorrows reality.

      since .NET 4 wave is already released c9 should do more 'future' videos like this. Tongue Out

    • head.in.the.​box

      Yes, SPUR is a tracing JIT for MSIL.

    • Richard.Hein

      16:30 is what I love about Channel9.  Where else can you find this kind of content?

       

      Treat the type as a probabilty wave, and delay the wave collapse until observation.  Exceptions can occur on observation, so you Amb them, (Amb in groups of greatest probability, and recursively) for the first one that doesn't, if all do, you have a fatal exception.  You pick the probabilities that result in the least possible exceptions, to optimize.   But an Exception is really a type conversion.  It may not be what you expect but it's a type.  Maybe it is supposed to have a string with numbers appended.  Swap code/thread that was running in parallel.

       

      I have to watch this all again now.  Now I just found this paper saying that there is no least fixed point sematics for Amb, I have a lot to learn. 

    • exoteric

      Superb video! Smiley

       

      It does indeed look like a research gold-mine.

       

      Theorem-proving at run-time, tracing, abstract interpretation. Quite a sophisticated set of ideas.

    • exoteric

      On Singularity, it's interesting that it was a very static approach whereas the tracing approach is much more dynamic in nature but as far as can extract from articles on the Web, there exists an incubation team continuing on the basis that Singularity established.

       

      Also, the idea that Erik mentions of an entire browser being written in C# or some other safe language compiled to MSIL and then traced is pretty cool. The browser and scripts both being traced together.

       

      Also interesting is the Z3 theorem prover. I forget what it's written in, probably C++. It would be interesting if that was ported to perhaps first C++/IL and later to F# (which is probably a better language for a theorem prover).

    • Richard.Hein

       "Front-ends interact with Z3 by using either a textual format or a binary 

      API. Three textual input-formats are supported: The SMT-LIB [12] format, the

      Simplify [8] format, and a low-level native format in the spirit of the DIMACS

      format for propositional SAT formulas. One can also call Z3 procedurally by

      using either an ANSI C API, an API for the .NET managed common language

      runtime, or an OCaml API.", and "Z3 is implemented in C++".

      http://research.microsoft.com/en-us/um/redmond/projects/z3/z3.pdf

       

      Smiley

       

       

    • Ravenex

      Cool, once again a managed implementation of JScript faster than the "current" version of IE's native one. When Managed JScript was still on going, it was faster than IE8's interpreter-based JScript.

      So SPUR doesn't yet support neseted trace trees. I wonder if they will consider the trace scheme used in LuaJIT 2 where it doesn't use trace trees, but still supports nested loops well. FYI http://lua-users.org/lists/lua-l/2009-11/msg00089.html

      The possibility of being able to trace all the way into SPUR itself is also very interesting. That would evolve into another metacircular VM. Hopefully it'll come true some day.

    • Richard.Hein

      Page 2 will not load for me.  This has happened before.

    • Charles

      I can't repro.

      C

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.