--- a/hotspot/src/share/vm/oops/method.cpp Tue Oct 14 20:35:45 2014 +0000
+++ b/hotspot/src/share/vm/oops/method.cpp Thu Oct 02 10:55:36 2014 +0200
@@ -1862,9 +1862,12 @@
void Method::set_on_stack(const bool value) {
// Set both the method itself and its constant pool. The constant pool
// on stack means some method referring to it is also on the stack.
- _access_flags.set_on_stack(value);
constants()->set_on_stack(value);
- if (value) MetadataOnStackMark::record(this);
+
+ bool succeeded = _access_flags.set_on_stack(value);
+ if (value && succeeded) {
+ MetadataOnStackMark::record(this, Thread::current());
+ }
}
// Called when the class loader is unloaded to make all methods weak.