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
1 file changed
tree: fb4272bd2795e8eb6a59a688c8bb420066565cc1
  1. build/
  2. jdwpspy/
  3. src/
  4. test/
  5. tools/
  6. .gitignore
  7. Android.mk