Unsafe value access
frederic.parain at oracle.com
Thu Jun 22 19:28:22 UTC 2017
For the interpreter, the implementation of getfield/putfield for value fields is split
between an assembly template and some runtime methods.
The assembly template can be found in src/cpu/x86/vm/templateTable_x86.cpp,
look for this method:
void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteControl rc, bool is_vgetfield)
The runtime support can be found in src/share/vm/interpreter/interpreterRuntime.cpp,
look for methods InterpreterRuntime::qgetfield(JavaThread* thread, oopDesc* value, int offset)
and InterpreterRuntime::qputfield(JavaThread* thread, oopDesc* obj, oopDesc* value, int offset).
Mr Simms did a number of experiments at the beginning of the project to measure
the cost of the different solutions to provide atomicity, I would recommend to sync
> On Jun 22, 2017, at 15:18, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> To start working on VarHandle integration i first of all need unsafe access to values held within objects. For a most basic initial implementation we can use a global lock to preserve atomicity and memory ordering effects and defer the thinking about more sophisticated locking (seq locks etc), read-mody-write operations and other memory order effects to a another day.
> For these purposes we just require two methods:
> __Value getValue(Object base, long offset, Class<? extends Value> vt)
> void putValue(Object base, long offset, Class<? extends Value> vt, __Value v);
> I included Class parameter for the value type token.
> How feasible would it be to implement such methods?
> If people point me to the hotspot interpreter code for getfield/putfield implementations for values i might be able to make some progress. Once that is done we could then consider C1/C2 support.
More information about the valhalla-dev