Crash with TraceClassLoading
Jeremy Manson
jeremymanson at google.com
Thu Dec 19 12:01:02 PST 2013
Now that 9 is underway, presumably we can start feeding back fixes again.
This one's a bit obscure. TraceClassLoading expects there to be a (Java)
caller when you load a class with the bootstrap class loader. However,
there are ways of loading a class that don't involve having a Java caller.
For example, you can do so from a JVMTI hook. A reproduction is attached,
and here's a patch:
diff --git a/src/share/vm/classfile/classFileParser.cpp
b/src/share/vm/classfile/classFileParser.cpp
--- a/src/share/vm/classfile/classFileParser.cpp
+++ b/src/share/vm/classfile/classFileParser.cpp
@@ -4098,8 +4098,12 @@
tty->print("[Loaded %s from %s]\n", this_klass->external_name(),
cfs->source());
} else if (class_loader.is_null()) {
- if (THREAD->is_Java_thread()) {
- Klass* caller =
((JavaThread*)THREAD)->security_get_caller_class(1);
+ Klass* caller =
+ THREAD->is_Java_thread()
+ ? ((JavaThread*)THREAD)->security_get_caller_class(1)
+ : NULL;
+ // caller can be NULL, for example, during a JVMTI VM_Init hook
+ if (caller != NULL) {
tty->print("[Loaded %s by instance of %s]\n",
this_klass->external_name(),
InstanceKlass::cast(caller)->external_name());
Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/attachments/20131219/7f53b4a6/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 127 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/attachments/20131219/7f53b4a6/Makefile.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tcl.cc
Type: text/x-c++src
Size: 1423 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/attachments/20131219/7f53b4a6/tcl.cc
More information about the hotspot-runtime-dev
mailing list