title: JIT code generation techniques
body: <p>How does a virtual machine generate native machine code on the fly and execute it?</p>
  
  <p>Assuming you can figure out what are the native machine op-codes you want to emit, how do you go about actually running it?</p>
  
  <p>Is it something as hacky as mapping the mnemonic instructions to binary codes, stuffing it into an char* pointer and casting it as a function and executing?</p>
  
  <p>Or would you generate a temporary shared library (.dll or .so or whatever) and load it into memory using standard functions like <code>LoadLibrary</code> ?</p>