comparison src/share/vm/interpreter/interpreterRuntime.cpp @ 12355:cefad50507d8

Merge with hs25-b53
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 11 Oct 2013 10:38:03 +0200
parents 3cce976666d9 b2e698d2276c
children d8041d695d19
comparison
equal deleted inserted replaced
12058:ccb4f2af2319 12355:cefad50507d8
509 // Fields 509 // Fields
510 // 510 //
511 511
512 IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode)) 512 IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode))
513 // resolve field 513 // resolve field
514 FieldAccessInfo info; 514 fieldDescriptor info;
515 constantPoolHandle pool(thread, method(thread)->constants()); 515 constantPoolHandle pool(thread, method(thread)->constants());
516 bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_putstatic); 516 bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_putstatic);
517 bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic); 517 bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
518 518
519 { 519 {
520 JvmtiHideSingleStepping jhss(thread); 520 JvmtiHideSingleStepping jhss(thread);
521 LinkResolver::resolve_field(info, pool, get_index_u2_cpcache(thread, bytecode), 521 LinkResolver::resolve_field_access(info, pool, get_index_u2_cpcache(thread, bytecode),
522 bytecode, false, CHECK); 522 bytecode, CHECK);
523 } // end JvmtiHideSingleStepping 523 } // end JvmtiHideSingleStepping
524 524
525 // check if link resolution caused cpCache to be updated 525 // check if link resolution caused cpCache to be updated
526 if (already_resolved(thread)) return; 526 if (already_resolved(thread)) return;
527 527
537 537
538 // We also need to delay resolving getstatic instructions until the 538 // We also need to delay resolving getstatic instructions until the
539 // class is intitialized. This is required so that access to the static 539 // class is intitialized. This is required so that access to the static
540 // field will call the initialization function every time until the class 540 // field will call the initialization function every time until the class
541 // is completely initialized ala. in 2.17.5 in JVM Specification. 541 // is completely initialized ala. in 2.17.5 in JVM Specification.
542 InstanceKlass *klass = InstanceKlass::cast(info.klass()()); 542 InstanceKlass* klass = InstanceKlass::cast(info.field_holder());
543 bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) && 543 bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) &&
544 !klass->is_initialized()); 544 !klass->is_initialized());
545 Bytecodes::Code get_code = (Bytecodes::Code)0; 545 Bytecodes::Code get_code = (Bytecodes::Code)0;
546 546
547 if (!uninitialized_static) { 547 if (!uninitialized_static) {
552 } 552 }
553 553
554 cache_entry(thread)->set_field( 554 cache_entry(thread)->set_field(
555 get_code, 555 get_code,
556 put_code, 556 put_code,
557 info.klass(), 557 info.field_holder(),
558 info.field_index(), 558 info.index(),
559 info.field_offset(), 559 info.offset(),
560 state, 560 state,
561 info.access_flags().is_final(), 561 info.access_flags().is_final(),
562 info.access_flags().is_volatile(), 562 info.access_flags().is_volatile(),
563 pool->pool_holder() 563 pool->pool_holder()
564 ); 564 );
699 699
700 // check if link resolution caused cpCache to be updated 700 // check if link resolution caused cpCache to be updated
701 if (already_resolved(thread)) return; 701 if (already_resolved(thread)) return;
702 702
703 if (bytecode == Bytecodes::_invokeinterface) { 703 if (bytecode == Bytecodes::_invokeinterface) {
704
705 if (TraceItables && Verbose) { 704 if (TraceItables && Verbose) {
706 ResourceMark rm(thread); 705 ResourceMark rm(thread);
707 tty->print_cr("Resolving: klass: %s to method: %s", info.resolved_klass()->name()->as_C_string(), info.resolved_method()->name()->as_C_string()); 706 tty->print_cr("Resolving: klass: %s to method: %s", info.resolved_klass()->name()->as_C_string(), info.resolved_method()->name()->as_C_string());
708 } 707 }
708 }
709 #ifdef ASSERT
710 if (bytecode == Bytecodes::_invokeinterface) {
709 if (info.resolved_method()->method_holder() == 711 if (info.resolved_method()->method_holder() ==
710 SystemDictionary::Object_klass()) { 712 SystemDictionary::Object_klass()) {
711 // NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec 713 // NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec
712 // (see also cpCacheOop.cpp for details) 714 // (see also CallInfo::set_interface for details)
715 assert(info.call_kind() == CallInfo::vtable_call ||
716 info.call_kind() == CallInfo::direct_call, "");
713 methodHandle rm = info.resolved_method(); 717 methodHandle rm = info.resolved_method();
714 assert(rm->is_final() || info.has_vtable_index(), 718 assert(rm->is_final() || info.has_vtable_index(),
715 "should have been set already"); 719 "should have been set already");
716 cache_entry(thread)->set_method(bytecode, rm, info.vtable_index()); 720 } else if (!info.resolved_method()->has_itable_index()) {
721 // Resolved something like CharSequence.toString. Use vtable not itable.
722 assert(info.call_kind() != CallInfo::itable_call, "");
717 } else { 723 } else {
718 // Setup itable entry 724 // Setup itable entry
719 int index = klassItable::compute_itable_index(info.resolved_method()()); 725 assert(info.call_kind() == CallInfo::itable_call, "");
720 cache_entry(thread)->set_interface_call(info.resolved_method(), index); 726 int index = info.resolved_method()->itable_index();
727 assert(info.itable_index() == index, "");
721 } 728 }
722 } else { 729 } else {
723 cache_entry(thread)->set_method( 730 assert(info.call_kind() == CallInfo::direct_call ||
731 info.call_kind() == CallInfo::vtable_call, "");
732 }
733 #endif
734 switch (info.call_kind()) {
735 case CallInfo::direct_call:
736 cache_entry(thread)->set_direct_call(
737 bytecode,
738 info.resolved_method());
739 break;
740 case CallInfo::vtable_call:
741 cache_entry(thread)->set_vtable_call(
724 bytecode, 742 bytecode,
725 info.resolved_method(), 743 info.resolved_method(),
726 info.vtable_index()); 744 info.vtable_index());
745 break;
746 case CallInfo::itable_call:
747 cache_entry(thread)->set_itable_call(
748 bytecode,
749 info.resolved_method(),
750 info.itable_index());
751 break;
752 default: ShouldNotReachHere();
727 } 753 }
728 } 754 }
729 IRT_END 755 IRT_END
730 756
731 757