Mercurial > hg > truffle
comparison src/share/vm/interpreter/interpreterRuntime.cpp @ 3852:fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
Reviewed-by: kvn, never, bdelsart
author | twisti |
---|---|
date | Tue, 16 Aug 2011 04:14:05 -0700 |
parents | 2c359f27615c |
children | aa67216400d3 2fecca53a2c6 |
comparison
equal
deleted
inserted
replaced
3851:95134e034042 | 3852:fdb992d83a87 |
---|---|
507 | 507 |
508 IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode)) | 508 IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode)) |
509 // resolve field | 509 // resolve field |
510 FieldAccessInfo info; | 510 FieldAccessInfo info; |
511 constantPoolHandle pool(thread, method(thread)->constants()); | 511 constantPoolHandle pool(thread, method(thread)->constants()); |
512 bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_putstatic); | |
512 bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic); | 513 bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic); |
513 | 514 |
514 { | 515 { |
515 JvmtiHideSingleStepping jhss(thread); | 516 JvmtiHideSingleStepping jhss(thread); |
516 LinkResolver::resolve_field(info, pool, get_index_u2_cpcache(thread, bytecode), | 517 LinkResolver::resolve_field(info, pool, get_index_u2_cpcache(thread, bytecode), |
526 // We need to delay resolving put instructions on final fields | 527 // We need to delay resolving put instructions on final fields |
527 // until we actually invoke one. This is required so we throw | 528 // until we actually invoke one. This is required so we throw |
528 // exceptions at the correct place. If we do not resolve completely | 529 // exceptions at the correct place. If we do not resolve completely |
529 // in the current pass, leaving the put_code set to zero will | 530 // in the current pass, leaving the put_code set to zero will |
530 // cause the next put instruction to reresolve. | 531 // cause the next put instruction to reresolve. |
531 bool is_put = (bytecode == Bytecodes::_putfield || | |
532 bytecode == Bytecodes::_putstatic); | |
533 Bytecodes::Code put_code = (Bytecodes::Code)0; | 532 Bytecodes::Code put_code = (Bytecodes::Code)0; |
534 | 533 |
535 // We also need to delay resolving getstatic instructions until the | 534 // We also need to delay resolving getstatic instructions until the |
536 // class is intitialized. This is required so that access to the static | 535 // class is intitialized. This is required so that access to the static |
537 // field will call the initialization function every time until the class | 536 // field will call the initialization function every time until the class |
539 instanceKlass *klass = instanceKlass::cast(info.klass()->as_klassOop()); | 538 instanceKlass *klass = instanceKlass::cast(info.klass()->as_klassOop()); |
540 bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) && | 539 bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) && |
541 !klass->is_initialized()); | 540 !klass->is_initialized()); |
542 Bytecodes::Code get_code = (Bytecodes::Code)0; | 541 Bytecodes::Code get_code = (Bytecodes::Code)0; |
543 | 542 |
544 | |
545 if (!uninitialized_static) { | 543 if (!uninitialized_static) { |
546 get_code = ((is_static) ? Bytecodes::_getstatic : Bytecodes::_getfield); | 544 get_code = ((is_static) ? Bytecodes::_getstatic : Bytecodes::_getfield); |
547 if (is_put || !info.access_flags().is_final()) { | 545 if (is_put || !info.access_flags().is_final()) { |
548 put_code = ((is_static) ? Bytecodes::_putstatic : Bytecodes::_putfield); | 546 put_code = ((is_static) ? Bytecodes::_putstatic : Bytecodes::_putfield); |
549 } | 547 } |
548 } | |
549 | |
550 if (is_put && !is_static && klass->is_subclass_of(SystemDictionary::CallSite_klass()) && (info.name() == vmSymbols::target_name())) { | |
551 const jint direction = frame::interpreter_frame_expression_stack_direction(); | |
552 oop call_site = *((oop*) thread->last_frame().interpreter_frame_tos_at(-1 * direction)); | |
553 oop method_handle = *((oop*) thread->last_frame().interpreter_frame_tos_at( 0 * direction)); | |
554 assert(call_site ->is_a(SystemDictionary::CallSite_klass()), "must be"); | |
555 assert(method_handle->is_a(SystemDictionary::MethodHandle_klass()), "must be"); | |
556 | |
557 { | |
558 // Walk all nmethods depending on CallSite | |
559 MutexLocker mu(Compile_lock, thread); | |
560 Universe::flush_dependents_on(call_site, method_handle); | |
561 } | |
562 | |
563 // Don't allow fast path for setting CallSite.target and sub-classes. | |
564 put_code = (Bytecodes::Code) 0; | |
550 } | 565 } |
551 | 566 |
552 cache_entry(thread)->set_field( | 567 cache_entry(thread)->set_field( |
553 get_code, | 568 get_code, |
554 put_code, | 569 put_code, |