Comments on JDK-8198408 please ?
Srikanth
srikanth.adayapalam at oracle.com
Mon Feb 26 17:04:38 UTC 2018
Frederic and I have been discussing the code sequence that javac should
produce for certain
more involved attempts to update value fields using withfield.
Basically for the test case in JDK-8198408, what should be the bytecode
generated for
d.c.b.a.x = 11;
where x is an int field and a, b, c and d are value classes. I imagine
this would call for a.x to be updated via withfield to obtain a', b.a to
be updated with a' using withfield to obtain b',
c.b to be updated with b' using withfield to obtain c' and d.c to be
updated with c' using withfield
to obtain d' and for d' to be finally stored back into d - Is that
correct ??
This calls for non-trivial changes to be made to javac - I don't think
it is a blocker issue, a solution can be
found quickly, but it is a radical departure from how code generation in
Javac works today.
(at the time of withfield emission for updating a.x with 11, the
expression stack has been mostly drained and
has no trace of the complex sequence of operations that led up to that
point. When a' is computed
by updating a.x with 11 using withfield, we reach a dead end - there is
nothing in the expression stack to write
back to. When the updated field is an instance of field of a value
instance that is a local variable, the problem
is lot simpler - all it calls for an astore which does not expect much
from the expression stack as far as the destination
is concerned, the astore opcode fully specifies the destination)
Could the experts weigh in on the required sequence please - before we
go down too far deep in implementing anyone presumed sequence ?
Thanks in advance,
Srikanth
More information about the valhalla-dev
mailing list