hg: valhalla/valhalla: 8222711: [lworld] Initial skeletal implementation of inline class instance construction via <init>
John Rose
john.r.rose at oracle.com
Wed Apr 24 20:43:50 UTC 2019
On Apr 24, 2019, at 1:10 PM, John Rose <john.r.rose at oracle.com> wrote:
>
> Good catch! Fixed code:
I updated the webrev.
I also added a little more detail to some of the relevant error
messages about new uses of <init>. Basically, sometimes the
VM should remark that a class with an error in it is an inline
class, since some conditions that are errors in inline classes
are not errors in non-inline classes, and vice versa.
The diff for these error message tweaks is also enclosed.
These helped me understand the output of jtreg tests like
this one:
JTwork/runtime/valhalla/valuetypes/verifier/VerifierValueTypes.jtr:18:execStatus=Failed. Execution failed\: `main' threw exception\: java.lang.ClassFormatError\: Method <init> in class wthFldBadCP (an inline class) has illegal modifiers\: 0x0
— John
diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp
--- b/src/hotspot/share/classfile/classFileParser.cpp
+++ a/src/hotspot/share/classfile/classFileParser.cpp
@@ -2104,11 +2104,16 @@
assert(name != NULL, "invariant");
assert(sig != NULL, "invariant");
+ const char* class_note = "";
+ if (is_value_type() && name == vmSymbols::object_initializer_name()) {
+ class_note = " (an inline class)";
+ }
+
ResourceMark rm(THREAD);
Exceptions::fthrow(THREAD_AND_LOCATION,
vmSymbols::java_lang_ClassFormatError(),
- "%s \"%s\" in class %s has illegal signature \"%s\"", type,
- name->as_C_string(), _class_name->as_C_string(), sig->as_C_string());
+ "%s \"%s\" in class %s%s has illegal signature \"%s\"", type,
+ name->as_C_string(), _class_name->as_C_string(), class_note, sig->as_C_string());
}
AnnotationCollector::ID
@@ -5055,11 +5060,13 @@
(!is_interface && major_gte_15 && is_annotation) ||
(is_value_type && (is_interface || is_abstract || is_enum || !is_final))) {
ResourceMark rm(THREAD);
+ const char* class_note = "";
+ if (is_value_type) class_note = " (an inline class)";
Exceptions::fthrow(
THREAD_AND_LOCATION,
vmSymbols::java_lang_ClassFormatError(),
- "Illegal class modifiers in class %s: 0x%X",
- _class_name->as_C_string(), flags
+ "Illegal class modifiers in class %s%s: 0x%X",
+ _class_name->as_C_string(), class_note, flags
);
return;
}
@@ -5202,6 +5209,8 @@
bool is_illegal = false;
+ const char* class_note = "";
+
if (is_interface) {
if (major_gte_8) {
// Class file version is JAVA_8_VERSION or later Methods of
@@ -5247,10 +5256,12 @@
} else {
// but no other combinations are allowed
is_illegal = true;
+ class_note = (is_value_type ? " (an inline class)" : " (not an inline class)");
}
} else { // not initializer
if (is_value_type && is_synchronized && !is_static) {
is_illegal = true;
+ class_note = " (an inline class)";
} else {
if (is_abstract) {
if ((is_final || is_native || is_private || is_static ||
@@ -5268,8 +5279,8 @@
Exceptions::fthrow(
THREAD_AND_LOCATION,
vmSymbols::java_lang_ClassFormatError(),
- "Method %s in class %s has illegal modifiers: 0x%X",
- name->as_C_string(), _class_name->as_C_string(), flags);
+ "Method %s in class %s%s has illegal modifiers: 0x%X",
+ name->as_C_string(), _class_name->as_C_string(), class_note, flags);
return;
}
}
More information about the valhalla-dev
mailing list