Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8252112: [lworld] Deoptimization fails when trying to re-assign empty inline type elements of a flattened array #158

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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);
}
}