Skip to content
Permalink
Browse files
8252112: [lworld] Deoptimization fails when trying to re-assign empty…
… inline type elements of a flattened array
  • Loading branch information
TobiHartmann committed Aug 21, 2020
1 parent 6f7ee4f commit 2d8688f5a0a79c96c2adf05f209d8020750ec9e0
Showing with 19 additions and 0 deletions.
  1. +3 −0 src/hotspot/share/runtime/deoptimization.cpp
  2. +16 −0 test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestLWorld.java
@@ -1388,6 +1388,9 @@ static int reassign_fields_by_klass(InstanceKlass* klass, frame* fr, RegisterMap
void Deoptimization::reassign_flat_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, flatArrayOop obj, FlatArrayKlass* vak, TRAPS) {
InlineKlass* vk = vak->element_klass();
assert(vk->flatten_array(), "should only be used for flattened inline type arrays");
if (vk->is_empty_inline_type()) {
return; // No fields to re-assign
}
// Adjust offset to omit oop header
int base_offset = arrayOopDesc::base_offset_in_bytes(T_INLINE_TYPE) - InlineKlass::cast(vk)->first_field_offset();
// Initialize all elements of the flattened inline type array
@@ -3289,4 +3289,20 @@ public void test118_verifier(boolean warmup) {
boolean res = test118(MyValueEmpty.default, MyValueEmpty.default, new MyValueEmpty());
Asserts.assertTrue(res);
}

// Test re-allocation of empty inline type array during deoptimization
@Test
public void test119(boolean deopt) {
MyValueEmpty[] arr = new MyValueEmpty[]{MyValueEmpty.default};
if (deopt) {
// uncommon trap
WHITE_BOX.deoptimizeMethod(tests.get(getClass().getSimpleName() + "::test119"));
}
Asserts.assertEquals(arr[0], MyValueEmpty.default);
}

@DontCompile
public void test119_verifier(boolean warmup) {
test119(!warmup);
}
}

0 comments on commit 2d8688f

Please sign in to comment.