25 #include "precompiled.hpp"
26 #include "classfile/altHashing.hpp"
27 #include "classfile/javaClasses.hpp"
28 #include "classfile/symbolTable.hpp"
29 #include "classfile/vmSymbols.hpp"
30 #include "code/debugInfo.hpp"
31 #include "code/pcDesc.hpp"
32 #include "compiler/compilerOracle.hpp"
33 #include "interpreter/interpreter.hpp"
34 #include "memory/oopFactory.hpp"
35 #include "memory/resourceArea.hpp"
36 #include "memory/universe.inline.hpp"
37 #include "oops/fieldStreams.hpp"
38 #include "oops/instanceKlass.hpp"
39 #include "oops/instanceMirrorKlass.hpp"
40 #include "oops/klass.hpp"
41 #include "oops/klassOop.hpp"
42 #include "oops/methodOop.hpp"
43 #include "oops/symbol.hpp"
44 #include "oops/typeArrayOop.hpp"
45 #include "runtime/fieldDescriptor.hpp"
46 #include "runtime/handles.inline.hpp"
47 #include "runtime/interfaceSupport.hpp"
48 #include "runtime/java.hpp"
49 #include "runtime/javaCalls.hpp"
50 #include "runtime/safepoint.hpp"
51 #include "runtime/vframe.hpp"
52 #include "utilities/preserveException.hpp"
53 #ifdef TARGET_OS_FAMILY_linux
54 # include "thread_linux.inline.hpp"
55 #endif
56 #ifdef TARGET_OS_FAMILY_solaris
57 # include "thread_solaris.inline.hpp"
58 #endif
59 #ifdef TARGET_OS_FAMILY_windows
60 # include "thread_windows.inline.hpp"
61 #endif
62 #ifdef TARGET_OS_FAMILY_bsd
63 # include "thread_bsd.inline.hpp"
64 #endif
2521 void java_lang_invoke_MemberName::set_type(oop mname, oop type) {
2522 assert(is_instance(mname), "wrong type");
2523 mname->obj_field_put(_type_offset, type);
2524 }
2525
2526 int java_lang_invoke_MemberName::flags(oop mname) {
2527 assert(is_instance(mname), "wrong type");
2528 return mname->int_field(_flags_offset);
2529 }
2530
2531 void java_lang_invoke_MemberName::set_flags(oop mname, int flags) {
2532 assert(is_instance(mname), "wrong type");
2533 mname->int_field_put(_flags_offset, flags);
2534 }
2535
2536 oop java_lang_invoke_MemberName::vmtarget(oop mname) {
2537 assert(is_instance(mname), "wrong type");
2538 return mname->obj_field(_vmtarget_offset);
2539 }
2540
2541 // Can be executed on VM thread only
2542 void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, oop ref) {
2543 assert((is_instance(mname) && (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0), "wrong type");
2544 assert(Thread::current()->is_VM_thread(), "not VM thread");
2545 mname->address_field_put(_vmtarget_offset, (address)ref);
2546 }
2547
2548 void java_lang_invoke_MemberName::set_vmtarget(oop mname, oop ref) {
2549 assert(is_instance(mname), "wrong type");
2550 #ifdef ASSERT
2551 // check the type of the vmtarget
2552 if (ref != NULL) {
2553 switch (flags(mname) & (MN_IS_METHOD |
2554 MN_IS_CONSTRUCTOR |
2555 MN_IS_FIELD)) {
2556 case MN_IS_METHOD:
2557 case MN_IS_CONSTRUCTOR:
2558 assert(ref->is_method(), "should be a method");
2559 break;
2560 case MN_IS_FIELD:
2561 assert(ref->is_klass(), "should be a class");
2562 break;
2563 default:
2564 ShouldNotReachHere();
2565 }
|
25 #include "precompiled.hpp"
26 #include "classfile/altHashing.hpp"
27 #include "classfile/javaClasses.hpp"
28 #include "classfile/symbolTable.hpp"
29 #include "classfile/vmSymbols.hpp"
30 #include "code/debugInfo.hpp"
31 #include "code/pcDesc.hpp"
32 #include "compiler/compilerOracle.hpp"
33 #include "interpreter/interpreter.hpp"
34 #include "memory/oopFactory.hpp"
35 #include "memory/resourceArea.hpp"
36 #include "memory/universe.inline.hpp"
37 #include "oops/fieldStreams.hpp"
38 #include "oops/instanceKlass.hpp"
39 #include "oops/instanceMirrorKlass.hpp"
40 #include "oops/klass.hpp"
41 #include "oops/klassOop.hpp"
42 #include "oops/methodOop.hpp"
43 #include "oops/symbol.hpp"
44 #include "oops/typeArrayOop.hpp"
45 #include "prims/jvmtiRedefineClassesTrace.hpp"
46 #include "runtime/fieldDescriptor.hpp"
47 #include "runtime/handles.inline.hpp"
48 #include "runtime/interfaceSupport.hpp"
49 #include "runtime/java.hpp"
50 #include "runtime/javaCalls.hpp"
51 #include "runtime/safepoint.hpp"
52 #include "runtime/vframe.hpp"
53 #include "utilities/preserveException.hpp"
54 #ifdef TARGET_OS_FAMILY_linux
55 # include "thread_linux.inline.hpp"
56 #endif
57 #ifdef TARGET_OS_FAMILY_solaris
58 # include "thread_solaris.inline.hpp"
59 #endif
60 #ifdef TARGET_OS_FAMILY_windows
61 # include "thread_windows.inline.hpp"
62 #endif
63 #ifdef TARGET_OS_FAMILY_bsd
64 # include "thread_bsd.inline.hpp"
65 #endif
2522 void java_lang_invoke_MemberName::set_type(oop mname, oop type) {
2523 assert(is_instance(mname), "wrong type");
2524 mname->obj_field_put(_type_offset, type);
2525 }
2526
2527 int java_lang_invoke_MemberName::flags(oop mname) {
2528 assert(is_instance(mname), "wrong type");
2529 return mname->int_field(_flags_offset);
2530 }
2531
2532 void java_lang_invoke_MemberName::set_flags(oop mname, int flags) {
2533 assert(is_instance(mname), "wrong type");
2534 mname->int_field_put(_flags_offset, flags);
2535 }
2536
2537 oop java_lang_invoke_MemberName::vmtarget(oop mname) {
2538 assert(is_instance(mname), "wrong type");
2539 return mname->obj_field(_vmtarget_offset);
2540 }
2541
2542 bool java_lang_invoke_MemberName::is_method(oop mname) {
2543 assert(is_instance(mname), "must be MemberName");
2544 return (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0;
2545 }
2546
2547 // Can be executed on VM thread only
2548 void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, methodOop old_method,
2549 methodOop new_method, bool* trace_name_printed) {
2550 assert(is_method(mname), "wrong type");
2551 assert(Thread::current()->is_VM_thread(), "not VM thread");
2552
2553 methodOop target = (methodOop) mname->obj_field(_vmtarget_offset);
2554
2555 if (target == old_method) {
2556 mname->obj_field_put(_vmtarget_offset, new_method);
2557
2558 if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
2559 if (!(*trace_name_printed)) {
2560 // RC_TRACE_MESG macro has an embedded ResourceMark
2561 RC_TRACE_MESG(("adjust: name=%s",
2562 instanceKlass::cast(old_method->method_holder())->external_name()));
2563 *trace_name_printed = true;
2564 }
2565 // RC_TRACE macro has an embedded ResourceMark
2566 RC_TRACE(0x00400000, ("MemberName method update: %s(%s)",
2567 new_method->name()->as_C_string(),
2568 new_method->signature()->as_C_string()));
2569 }
2570 }
2571 }
2572
2573 void java_lang_invoke_MemberName::set_vmtarget(oop mname, oop ref) {
2574 assert(is_instance(mname), "wrong type");
2575 #ifdef ASSERT
2576 // check the type of the vmtarget
2577 if (ref != NULL) {
2578 switch (flags(mname) & (MN_IS_METHOD |
2579 MN_IS_CONSTRUCTOR |
2580 MN_IS_FIELD)) {
2581 case MN_IS_METHOD:
2582 case MN_IS_CONSTRUCTOR:
2583 assert(ref->is_method(), "should be a method");
2584 break;
2585 case MN_IS_FIELD:
2586 assert(ref->is_klass(), "should be a class");
2587 break;
2588 default:
2589 ShouldNotReachHere();
2590 }
|