Commit c8a3ff8b authored by Sebastien Hertz's avatar Sebastien Hertz
Browse files

Optimize field access in interpreter by improving inlining.

The DoFieldGet and DoFieldPut functions are forced to be inlined into the
interpreter. Nevertheless, this seems to expose a limitation in GCC's
inlining process where two parts of the code are not inlined while they
depend on constant function parameters:
- the call to Primitive::FieldSize is not completely inlined since there's
still a call to Primitive::ComponentSize,
- the switch (which reads from/writes to the field) is not inlined but
copied into the interpreter.

To improve inlining, we could transform these functions into macros. Then GCC
would correctly inline the code. However, in order to keep the code simple and
readable, I chose to transform them into template functions. This only requires
to move constant parameters of the function into template arguments.

Note that while it creates multiple versions of DoFieldGet and DoFieldPut, they
are not part of the final object file since they're all inlined.

Change-Id: I424a56d4c442a56cb6d7a09cdaa30dcd25deeedb
parent 7b15b1b6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment