Mercurial > hg > truffle
comparison src/share/vm/classfile/javaClasses.cpp @ 20677:fe34c5ab0b35
8042235: redefining method used by multiple MethodHandles crashes VM
Summary: note all MemberNames created on internal list for adjusting method entries.
Reviewed-by: sspitsyn, dcubed, lfoltan
author | coleenp |
---|---|
date | Wed, 19 Nov 2014 13:02:11 -0500 |
parents | 7d68a5b1069d |
children | 7848fc12602b |
comparison
equal
deleted
inserted
replaced
20666:bee8095780db | 20677:fe34c5ab0b35 |
---|---|
39 #include "oops/instanceMirrorKlass.hpp" | 39 #include "oops/instanceMirrorKlass.hpp" |
40 #include "oops/klass.hpp" | 40 #include "oops/klass.hpp" |
41 #include "oops/method.hpp" | 41 #include "oops/method.hpp" |
42 #include "oops/symbol.hpp" | 42 #include "oops/symbol.hpp" |
43 #include "oops/typeArrayOop.hpp" | 43 #include "oops/typeArrayOop.hpp" |
44 #include "prims/jvmtiRedefineClassesTrace.hpp" | |
44 #include "runtime/fieldDescriptor.hpp" | 45 #include "runtime/fieldDescriptor.hpp" |
45 #include "runtime/handles.inline.hpp" | 46 #include "runtime/handles.inline.hpp" |
46 #include "runtime/interfaceSupport.hpp" | 47 #include "runtime/interfaceSupport.hpp" |
47 #include "runtime/java.hpp" | 48 #include "runtime/java.hpp" |
48 #include "runtime/javaCalls.hpp" | 49 #include "runtime/javaCalls.hpp" |
2773 Metadata* java_lang_invoke_MemberName::vmtarget(oop mname) { | 2774 Metadata* java_lang_invoke_MemberName::vmtarget(oop mname) { |
2774 assert(is_instance(mname), "wrong type"); | 2775 assert(is_instance(mname), "wrong type"); |
2775 return (Metadata*)mname->address_field(_vmtarget_offset); | 2776 return (Metadata*)mname->address_field(_vmtarget_offset); |
2776 } | 2777 } |
2777 | 2778 |
2779 bool java_lang_invoke_MemberName::is_method(oop mname) { | |
2780 assert(is_instance(mname), "must be MemberName"); | |
2781 return (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0; | |
2782 } | |
2783 | |
2778 #if INCLUDE_JVMTI | 2784 #if INCLUDE_JVMTI |
2779 // Can be executed on VM thread only | 2785 // Can be executed on VM thread only |
2780 void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, Metadata* ref) { | 2786 void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, Method* old_method, |
2781 assert((is_instance(mname) && (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0), "wrong type"); | 2787 Method* new_method, bool* trace_name_printed) { |
2788 assert(is_method(mname), "wrong type"); | |
2782 assert(Thread::current()->is_VM_thread(), "not VM thread"); | 2789 assert(Thread::current()->is_VM_thread(), "not VM thread"); |
2783 mname->address_field_put(_vmtarget_offset, (address)ref); | 2790 |
2791 Method* target = (Method*)mname->address_field(_vmtarget_offset); | |
2792 if (target == old_method) { | |
2793 mname->address_field_put(_vmtarget_offset, (address)new_method); | |
2794 | |
2795 if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { | |
2796 if (!(*trace_name_printed)) { | |
2797 // RC_TRACE_MESG macro has an embedded ResourceMark | |
2798 RC_TRACE_MESG(("adjust: name=%s", | |
2799 old_method->method_holder()->external_name())); | |
2800 *trace_name_printed = true; | |
2801 } | |
2802 // RC_TRACE macro has an embedded ResourceMark | |
2803 RC_TRACE(0x00400000, ("MemberName method update: %s(%s)", | |
2804 new_method->name()->as_C_string(), | |
2805 new_method->signature()->as_C_string())); | |
2806 } | |
2807 } | |
2784 } | 2808 } |
2785 #endif // INCLUDE_JVMTI | 2809 #endif // INCLUDE_JVMTI |
2786 | 2810 |
2787 void java_lang_invoke_MemberName::set_vmtarget(oop mname, Metadata* ref) { | 2811 void java_lang_invoke_MemberName::set_vmtarget(oop mname, Metadata* ref) { |
2788 assert(is_instance(mname), "wrong type"); | 2812 assert(is_instance(mname), "wrong type"); |