1.1 --- a/src/share/vm/oops/method.cpp Mon Nov 03 12:02:40 2014 -0800 1.2 +++ b/src/share/vm/oops/method.cpp Thu Oct 02 10:55:36 2014 +0200 1.3 @@ -1863,9 +1863,12 @@ 1.4 void Method::set_on_stack(const bool value) { 1.5 // Set both the method itself and its constant pool. The constant pool 1.6 // on stack means some method referring to it is also on the stack. 1.7 - _access_flags.set_on_stack(value); 1.8 constants()->set_on_stack(value); 1.9 - if (value) MetadataOnStackMark::record(this); 1.10 + 1.11 + bool succeeded = _access_flags.set_on_stack(value); 1.12 + if (value && succeeded) { 1.13 + MetadataOnStackMark::record(this, Thread::current()); 1.14 + } 1.15 } 1.16 1.17 // Called when the class loader is unloaded to make all methods weak.