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

8264895: [lworld] assert(!InstanceKlass::cast(receiver_klass)->is_not_initialized()) failed: receiver_klass must be initialized #382

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/hotspot/share/c1/c1_GraphBuilder.cpp
Original file line number Diff line number Diff line change
@@ -2488,7 +2488,8 @@ void GraphBuilder::new_instance(int klass_index) {
void GraphBuilder::default_value(int klass_index) {
bool will_link;
ciKlass* klass = stream()->get_klass(will_link);
if (!stream()->is_unresolved_klass() && klass->is_inlinetype()) {
if (!stream()->is_unresolved_klass() && klass->is_inlinetype() &&
klass->as_inline_klass()->is_initialized()) {
ciInlineKlass* vk = klass->as_inline_klass();
apush(append(new Constant(new InstanceConstant(vk->default_instance()))));
} else {
50 changes: 49 additions & 1 deletion test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestLWorld.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -57,6 +57,12 @@ public String[] getExtraVMParameters(int scenario) {
}

public static void main(String[] args) throws Throwable {
// Make sure Test140Value is loaded but not linked
Class<?> class1 = Test140Value.class;
// Make sure Test141Value is linked but not initialized
Class<?> class2 = Test141Value.class;
class2.getDeclaredFields();

TestLWorld test = new TestLWorld();
test.run(args, MyValue1.class, MyValue2.class, MyValue2Inline.class, MyValue3.class,
MyValue3Inline.class, Test51Value.class);
@@ -3732,4 +3738,46 @@ public void test139_verifier(boolean warmup) {
MyValueEmpty empty = test139();
Asserts.assertEquals(empty, MyValueEmpty.default);
}

// Test calling a method on a loaded but not linked inline type
final primitive class Test140Value {
final int x = 42;
public int get() {
return x;
}
}

@Test
@Warmup(0)
public int test140() {
Test140Value vt = Test140Value.default;
return vt.get();
}

@DontCompile
public void test140_verifier(boolean warmup) {
int result = test140();
Asserts.assertEquals(result, 0);
}

// Test calling a method on a linked but not initialized inline type
final primitive class Test141Value {
final int x = 42;
public int get() {
return x;
}
}

@Test
@Warmup(0)
public int test141() {
Test141Value vt = Test141Value.default;
return vt.get();
}

@DontCompile
public void test141_verifier(boolean warmup) {
int result = test141();
Asserts.assertEquals(result, 0);
}
}