Let's say I am to design a JIT interpreter that translates IL or bytecode to executable instructions at runtime. Every time a variable name is encountered in the code, the JIT interpreter has to translate that into the respective memory address, right?What technique do JIT interpreters use in order to resolve variable references in a performant enough manner? Do they use hashing, are the variables compiled to addresses ahead of time, or am I missing something altogether?
How do JIT interpreters handle variable names?
compiler;jit;bytecode
Have a look at this example from Wikipedia:for (int i = 2; i < 1000; i++) {    for (int j = 2; j < i; j++) {        if (i % j == 0)            continue outer;    }    System.out.println (i);}which roughly translates into the following byte code:0:   iconst_21:   istore_12:   iload_13:   sipush          10006:   if_icmpge       449:   iconst_210:  istore_211:  iload_212:  iload_113:  if_icmpge       3116:  iload_117:  iload_218:  irem19:  ifne            2522:  goto            3825:  iinc            2, 128:  goto            1131:  getstatic       #84;           // Field java/lang/System.out:Ljava/io/PrintStream;34:  iload_135:  invokevirtual   #85;           // Method java/io/PrintStream.println:(I)V38:  iinc            1, 141:  goto            244:  returnNote that it reads very much like assembly language, where variables are stored at local addresses, and referred to directly by their address.  There is no trace of the original variable names.To find out how Java bytecode works in excruciating detail, you can consult Oracle's documentation.Further ReadingThe Java Virtual Machine Specification.