10.07.2015 Views

An ARM Backend for PyPyls Tracing JIT - STUPS Group

An ARM Backend for PyPyls Tracing JIT - STUPS Group

An ARM Backend for PyPyls Tracing JIT - STUPS Group

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

30 6 A BACKEND FOR PYPY’S <strong>JIT</strong>structions the entry point is set up and we can proceed to load the input arguments andcompile the operations in the trace.After generating the function interface we generate instructions to load the input argumentsof the loop to locations controlled by the register allocator to setup the state <strong>for</strong>the loop. Input values <strong>for</strong> a loop are passed to the backend through pre-allocated arrays.There is one such array <strong>for</strong> each different argument type. These types can be floats, integers,long longs and pointers, although at the current time the backend only supportsintegers and pointers. At runtime we allocate a register <strong>for</strong> each box passed to the loopusing these lists of input arguments. For each box we then generate the instructions toload the value stored in the corresponding list in memory to an allocated register.6.4 Compiling Trace OperationsOnce the frame is set up and the instructions to load the input arguments into registershave been generated, the next step is to generate instructions <strong>for</strong> each of the operationsin the trace. The code generation <strong>for</strong> operations is rather straight <strong>for</strong>ward and is dividedinto two steps. For each operation the first step is allocating the registers <strong>for</strong> theoperation’s arguments and, if present, <strong>for</strong> the result. The second step is the instruction selectionand generation step. This step actually emits the instructions that implement theoperations using the allocated registers. A goal we try to achieve during the instructionselection is to emit the operations that provide the best execution speed in relation to thekind of arguments <strong>for</strong> an operation, i.e selection the correct operation to add a registerand small constant.We are going to look at how these operations are implemented by taking a look at thedifferent groups of trace operations that are handled by the backend. The operations canbe categorized as follows:• arithmetic operations• comparison operations• memory allocation• memory access• calls• <strong>for</strong>cing of frames• guards• jumps6.4.1 Arithmetic OperationsThe <strong>JIT</strong> implements operations <strong>for</strong> unary and binary arithmetic operations <strong>for</strong> signed andunsigned integers and long longs as well as <strong>for</strong> floating point numbers.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!