23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "interpreter/interpreter.hpp" |
26 #include "interpreter/interpreter.hpp" |
27 #include "interpreter/rewriter.hpp" |
27 #include "interpreter/rewriter.hpp" |
|
28 #include "logging/log.hpp" |
28 #include "memory/resourceArea.hpp" |
29 #include "memory/resourceArea.hpp" |
29 #include "memory/universe.inline.hpp" |
30 #include "memory/universe.inline.hpp" |
30 #include "oops/cpCache.hpp" |
31 #include "oops/cpCache.hpp" |
31 #include "oops/objArrayOop.inline.hpp" |
32 #include "oops/objArrayOop.inline.hpp" |
32 #include "oops/oop.inline.hpp" |
33 #include "oops/oop.inline.hpp" |
33 #include "prims/jvmtiRedefineClassesTrace.hpp" |
|
34 #include "prims/methodHandles.hpp" |
34 #include "prims/methodHandles.hpp" |
35 #include "runtime/atomic.inline.hpp" |
35 #include "runtime/atomic.inline.hpp" |
36 #include "runtime/handles.inline.hpp" |
36 #include "runtime/handles.inline.hpp" |
37 #include "runtime/orderAccess.inline.hpp" |
37 #include "runtime/orderAccess.inline.hpp" |
38 #include "utilities/macros.hpp" |
38 #include "utilities/macros.hpp" |
436 // virtual and final so _f2 contains method ptr instead of vtable index |
436 // virtual and final so _f2 contains method ptr instead of vtable index |
437 if (f2_as_vfinal_method() == old_method) { |
437 if (f2_as_vfinal_method() == old_method) { |
438 // match old_method so need an update |
438 // match old_method so need an update |
439 // NOTE: can't use set_f2_as_vfinal_method as it asserts on different values |
439 // NOTE: can't use set_f2_as_vfinal_method as it asserts on different values |
440 _f2 = (intptr_t)new_method; |
440 _f2 = (intptr_t)new_method; |
441 if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { |
441 if (log_is_enabled(Info, redefine, class, update)) { |
|
442 ResourceMark rm; |
442 if (!(*trace_name_printed)) { |
443 if (!(*trace_name_printed)) { |
443 // RC_TRACE_MESG macro has an embedded ResourceMark |
444 log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name()); |
444 RC_TRACE_MESG(("adjust: name=%s", |
|
445 old_method->method_holder()->external_name())); |
|
446 *trace_name_printed = true; |
445 *trace_name_printed = true; |
447 } |
446 } |
448 // RC_TRACE macro has an embedded ResourceMark |
447 log_debug(redefine, class, update, constantpool) |
449 RC_TRACE(0x00400000, ("cpc vf-entry update: %s(%s)", |
448 ("cpc vf-entry update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string()); |
450 new_method->name()->as_C_string(), |
|
451 new_method->signature()->as_C_string())); |
|
452 } |
449 } |
453 return true; |
450 return true; |
454 } |
451 } |
455 |
452 |
456 // f1() is not used with virtual entries so bail out |
453 // f1() is not used with virtual entries so bail out |
463 return false; |
460 return false; |
464 } |
461 } |
465 |
462 |
466 if (_f1 == old_method) { |
463 if (_f1 == old_method) { |
467 _f1 = new_method; |
464 _f1 = new_method; |
468 if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { |
465 if (log_is_enabled(Info, redefine, class, update)) { |
|
466 ResourceMark rm; |
469 if (!(*trace_name_printed)) { |
467 if (!(*trace_name_printed)) { |
470 // RC_TRACE_MESG macro has an embedded ResourceMark |
468 log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name()); |
471 RC_TRACE_MESG(("adjust: name=%s", |
|
472 old_method->method_holder()->external_name())); |
|
473 *trace_name_printed = true; |
469 *trace_name_printed = true; |
474 } |
470 } |
475 // RC_TRACE macro has an embedded ResourceMark |
471 log_debug(redefine, class, update, constantpool) |
476 RC_TRACE(0x00400000, ("cpc entry update: %s(%s)", |
472 ("cpc entry update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string()); |
477 new_method->name()->as_C_string(), |
|
478 new_method->signature()->as_C_string())); |
|
479 } |
473 } |
480 return true; |
474 return true; |
481 } |
475 } |
482 |
476 |
483 return false; |
477 return false; |