f8349af093
This commit consists of three components: 1. A new generated x86-parser that analyses instructions. For now, it only detects the control flow of an instruction: Whether it is a (conditional) jump, a normal instruction or a basic block boundary 2. A new function, jit_find_basic_blocks, that finds and connects basic blocks using 1. It loosely finds all basic blocks making up a function, i.e. it doesn't follow call or return instructions (but it does follow all near jumps). Different from our previous analysis, it also finds basic blocks in the strict sense that no basic block contains a jump into the middle of another basic block 3. A new code-generating function, jit_generate, that takes the output of 2 as input. It generates a state machine: - Each basic block becomes a case block in a switch-table - Each basic block ends with setting a state variable for the following basic block - The switch-table is inside a while(true) loop, which is terminated by return statements in basic blocks which are leaves Additionally: - Block linking has been removed as it is (mostly) obsoleted by these changes. It may later be reactived for call instructions - The code generator API has been extended to generate the code for the state machine - The iterations of the state machine are limited in order to avoid infinite loops that can't be interrupted |
||
---|---|---|
.. | ||
c_ast.js | ||
generate_analyzer.js | ||
generate_interpreter.js | ||
generate_jit.js | ||
util.js | ||
x86_table.js |