You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Valhalla LWVT: Add new bytecodes defaultvalue and withfield #1390
The defaultvalue bytecode pushes a reference to an instance of a value class onto the stack, initialized to the class' default values.
Stack:
... -->
..., valueref
The initial implementation should operate in the same way that the new bytecode does -- the instance should be allocated on the heap and a reference should be placed on the stack. A later version could consider value type buffering, where new instances are instead allocated in a valuebuffer pointed to from the Java stack, and which disappears when the stack frame is popped.
The default value for a value class is currently considered to be the same as for POJOs. That is zero for all scalars and NULL for all references.
withfield
The withfield bytecode pushes a new reference to a value class instance with an updated instance field.
Stack:
..., valueref, value -->
..., newvalueref
Note: This is NOT like putfield. An existing value type is not being updated. Rather, a new instance with an updated field is being created.
Again, the initial implementation should allocate new instances on the heap, and a later implementation should consider value type buffering.
Activity
tajila commentedon Feb 12, 2020
default value full implementation (interpreter): #3575
tests: #3682
tajila commentedon Feb 12, 2020
With field support:
#3760
#3802
#3925
tajila commentedon Feb 12, 2020
Latest SPEC is here, http://cr.openjdk.java.net/~dlsmith/lw2/lw2-20190628/specs/inline-classes-jvms.html