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

8288098: [lworld] C2 fails to scalarize value class arguments #709

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
10 changes: 0 additions & 10 deletions src/hotspot/share/oops/instanceKlass.cpp
Original file line number Diff line number Diff line change
@@ -166,16 +166,6 @@ static inline bool is_class_loader(const Symbol* class_name,

bool InstanceKlass::field_is_null_free_inline_type(int index) const { return Signature::basic_type(field(index)->signature(constants())) == T_PRIMITIVE_OBJECT; }

bool InstanceKlass::is_preload_class(Symbol* name) const {
for (int i = 0; i < _preload_classes->length(); i++) {
Symbol* class_name = _constants->klass_at_noresolve(_preload_classes->at(i));
if (class_name == name) {
return true;
}
}
return false;
}

// private: called to verify that k is a static member of this nest.
// We know that k is an instance class in the same package and hence the
// same classloader.
1 change: 0 additions & 1 deletion src/hotspot/share/oops/instanceKlass.hpp
Original file line number Diff line number Diff line change
@@ -550,7 +550,6 @@ class InstanceKlass: public Klass {

Array<u2>* preload_classes() const { return _preload_classes; }
void set_preload_classes(Array<u2>* c) { _preload_classes = c; }
bool is_preload_class(Symbol* name) const;

// inner classes
Array<u2>* inner_classes() const { return _inner_classes; }
14 changes: 9 additions & 5 deletions src/hotspot/share/runtime/sharedRuntime.cpp
Original file line number Diff line number Diff line change
@@ -2851,14 +2851,18 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_simple_adapter(const methodHandl
if (total_args_passed == 0) {
return _no_arg_handler;
} else if (total_args_passed == 1) {
if (!method->is_static() && (!InlineTypePassFieldsAsArgs || !method->method_holder()->is_inline_klass())) {
if (!method->is_static()) {
if (InlineTypePassFieldsAsArgs && method->method_holder()->is_inline_klass()) {
return NULL;
}
return _obj_arg_handler;
}
switch (method->signature()->char_at(1)) {
case JVM_SIGNATURE_CLASS: {
if (InlineTypePassFieldsAsArgs) {
SignatureStream ss(method->signature());
if (method->method_holder()->is_preload_class(ss.as_symbol())) {
InlineKlass* vk = ss.as_inline_klass(method->method_holder());
if (vk != NULL) {
return NULL;
}
}
@@ -2879,7 +2883,8 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_simple_adapter(const methodHandl
case JVM_SIGNATURE_CLASS: {
if (InlineTypePassFieldsAsArgs) {
SignatureStream ss(method->signature());
if (method->method_holder()->is_preload_class(ss.as_symbol())) {
InlineKlass* vk = ss.as_inline_klass(method->method_holder());
if (vk != NULL) {
return NULL;
}
}
@@ -2972,8 +2977,7 @@ void CompiledEntrySignature::compute_calling_conventions(bool init) {
if (bt == T_OBJECT || bt == T_PRIMITIVE_OBJECT) {
InlineKlass* vk = ss.as_inline_klass(holder);
// TODO 8284443 Mismatch handling, we need to check parent method args (look at klassVtable::needs_new_vtable_entry)
if (vk != NULL && (bt == T_PRIMITIVE_OBJECT || holder->is_preload_class(vk->name())) &&
vk->can_be_passed_as_fields() && (init || _method->is_scalarized_arg(arg_num))) {
if (vk != NULL && vk->can_be_passed_as_fields() && (init || _method->is_scalarized_arg(arg_num))) {
_num_inline_args++;
has_scalarized = true;
int last = _sig_cc->length();
Original file line number Diff line number Diff line change
@@ -172,4 +172,9 @@ static MyValueClass1 setV2(MyValueClass1 v, MyValueClass2 v2) {
static MyValueClass1 setV4(MyValueClass1 v, MyValueClass2 v4) {
return new MyValueClass1(v.x, v.y, v.z, v.o, v.oa, v.v1, v.v2, v4, v.c);
}

@DontInline
void dontInline(MyValueClass1 arg) {

}
}
Original file line number Diff line number Diff line change
@@ -2687,9 +2687,9 @@ public MyValue3.ref test97_helper3(boolean b) {
// Same as test96 but with MyValue3 return
@Test
@IR(applyIf = {"InlineTypeReturnedAsFields", "true"},
failOn = {ALLOC_G})
counts = {ALLOC_G, " = 1"}) // 1 Object allocation
@IR(applyIf = {"InlineTypeReturnedAsFields", "false"},
counts = {ALLOC_G, " = 1"})
counts = {ALLOC_G, " = 2"}) // 1 MyValue3 allocation + 1 Object allocation
public MyValue3.ref test97(int c, boolean b) {
MyValue3.ref res = null;
if (c == 1) {
Original file line number Diff line number Diff line change
@@ -536,6 +536,7 @@ public MyValueClass1 test15(MyValueClass1 vt) {
test15_helper1(vt);
test15_helper2(vt);
test15_helper3(vt);
vt.dontInline(vt);
return res;
}