Presentation on JIT compilers (and the unfortunate sex life of the banana)

Posting's been kind of light, so I'll link to two presentations I've done for class recently. I'm currently taking a course on compilers, which is the best course I've taken in college. Very quickly, your computer can only understand a very limited set of instructions: add 01110011 to 11001011, load eight zeroes and ones from memory (the cache, or random-access memory (RAM)), overwrite a set of zeroes and ones, etc. However, if you had to write entire programs using only this instruction set, it would be hard for programmers to keep track of variable state, to write error-free code and to find bugs when they are made (Notable exception: Roller Coaster Tycoon was written entirely in x86 assembly language, which explains (a) why there has never been a Mac version released, and (b) why RCT3 was so much worse - it was written in a higher-level language by a different company). So what programmers did was invent abstractions - control flow tools like if-then-else branching, while and for loops, as well as data structures like arrays and dictionaries. These allow programmers to write in a more natural language, but programs must be translated - "compiled" - down to machine language. Because this is done automatically, and many people use the same compiler (so everyone benefits from errors caught by one person), generated machine code is usually free of errors. I gave a talk in class on a special type of compiler, called just-in-time (JIT). Normally you write your program, compile it, and then run the machine language. But a JIT compiler is writing and compiling new machine language as the program is running. Here are the slides: There are a few reasons this can be quicker than compiling beforehand ("static" compilation). First, you have more information about the values of variables at runtime that you can use to eliminate redundancy in your code. Second, in the case of loops, where you are following the same code paths hundreds or thousands of times in a row, you can see which paths are being used the most often, and rewrite your code so that the most common code path is executed in a straight line. This is important because modern processors will try to pre-fetch and execute several instructions at a time, and if you keep jumping from place to place in your code, the processor can't execute instructions in advance. I also wrote a paper (and gave a talk) on some of the threats facing the Cavendish banana, which will probably go extinct soon. I've been fortunate to write papers this year on some fun topics; last semester I was able to cite Robin Hanson, Tyler Cowen, Eliezer Yudkowsky and Alan Turing in one philosophy paper, which was pretty fun. That paper's here. The Unfortunate Sex Life of the Banana

Liked what you read? I am available for hire.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments are heavily moderated.