IonMonkey/Code Generation

From MozillaWiki
Jump to: navigation, search

Code generation takes the annotated LIR graph and creates machine code out of it. Afterwards the code gets linked.


Generating machine code

An annotated LIR contains all information to create machine code out of it. For each LIR we call the shared or architecture specific "visitXXX" function. In those functions we create a vector containing the machine code. This happens using an abstraction layer, the MacroAssembler. The MacroAssembler contains helper functions that are named based upon corresponding assembler functions.


The linking step is the final step in generating the jit code. Here we are again on the main thread. We check if type information has changed in between and save the constraints upon which this jit code is valid. Pointers get hardcoded into the buffer and that buffer is made executable. This results in an IonScript we can now execute.