mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8231756: [JVMCI] need support for deoptimizing virtual byte arrays encoding non-byte primitives
Reviewed-by: kvn
This commit is contained in:
parent
430f8020fd
commit
12f8b52fb8
13 changed files with 332 additions and 72 deletions
|
@ -44,6 +44,7 @@ ConstantIntValue* CodeInstaller::_int_0_scope_value = new (ResourceObj::C_
|
|||
ConstantIntValue* CodeInstaller::_int_1_scope_value = new (ResourceObj::C_HEAP, mtJVMCI) ConstantIntValue(1);
|
||||
ConstantIntValue* CodeInstaller::_int_2_scope_value = new (ResourceObj::C_HEAP, mtJVMCI) ConstantIntValue(2);
|
||||
LocationValue* CodeInstaller::_illegal_value = new (ResourceObj::C_HEAP, mtJVMCI) LocationValue(Location());
|
||||
MarkerValue* CodeInstaller::_virtual_byte_array_marker = new (ResourceObj::C_HEAP, mtJVMCI) MarkerValue();
|
||||
|
||||
VMReg CodeInstaller::getVMRegFromLocation(JVMCIObject location, int total_frame_size, JVMCI_TRAPS) {
|
||||
if (location.is_null()) {
|
||||
|
@ -420,6 +421,7 @@ void CodeInstaller::record_object_value(ObjectValue* sv, JVMCIObject value, Grow
|
|||
int id = jvmci_env()->get_VirtualObject_id(value);
|
||||
Klass* klass = JVMCIENV->asKlass(type);
|
||||
bool isLongArray = klass == Universe::longArrayKlassObj();
|
||||
bool isByteArray = klass == Universe::byteArrayKlassObj();
|
||||
|
||||
JVMCIObjectArray values = jvmci_env()->get_VirtualObject_values(value);
|
||||
JVMCIObjectArray slotKinds = jvmci_env()->get_VirtualObject_slotKinds(value);
|
||||
|
@ -427,7 +429,24 @@ void CodeInstaller::record_object_value(ObjectValue* sv, JVMCIObject value, Grow
|
|||
ScopeValue* cur_second = NULL;
|
||||
JVMCIObject object = JVMCIENV->get_object_at(values, i);
|
||||
BasicType type = jvmci_env()->kindToBasicType(JVMCIENV->get_object_at(slotKinds, i), JVMCI_CHECK);
|
||||
ScopeValue* value = get_scope_value(object, type, objects, cur_second, JVMCI_CHECK);
|
||||
ScopeValue* value;
|
||||
if (JVMCIENV->equals(object, jvmci_env()->get_Value_ILLEGAL())) {
|
||||
if (isByteArray && type == T_ILLEGAL) {
|
||||
/*
|
||||
* The difference between a virtualized large access and a deferred write is the kind stored in the slotKinds
|
||||
* of the virtual object: in the virtualization case, the kind is illegal, in the deferred write case, the kind
|
||||
* is access stack kind (an int).
|
||||
*/
|
||||
value = _virtual_byte_array_marker;
|
||||
} else {
|
||||
value = _illegal_value;
|
||||
if (type == T_DOUBLE || type == T_LONG) {
|
||||
cur_second = _illegal_value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
value = get_scope_value(object, type, objects, cur_second, JVMCI_CHECK);
|
||||
}
|
||||
|
||||
if (isLongArray && cur_second == NULL) {
|
||||
// we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations.
|
||||
|
@ -435,6 +454,12 @@ void CodeInstaller::record_object_value(ObjectValue* sv, JVMCIObject value, Grow
|
|||
cur_second = _int_0_scope_value;
|
||||
}
|
||||
|
||||
if (isByteArray && cur_second != NULL && (type == T_DOUBLE || type == T_LONG)) {
|
||||
// we are trying to write a long in a byte Array. We will need to count the illegals to restore the type of
|
||||
// the thing we put inside.
|
||||
cur_second = NULL;
|
||||
}
|
||||
|
||||
if (cur_second != NULL) {
|
||||
sv->field_values()->append(cur_second);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue