src/share/vm/interpreter/interpreterRuntime.cpp

changeset 5732
b2e698d2276c
parent 5496
ca0165daa6ec
child 6472
2b8e28fdf503
     1.1 --- a/src/share/vm/interpreter/interpreterRuntime.cpp	Tue Sep 17 23:12:27 2013 +0200
     1.2 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Fri Sep 13 22:38:02 2013 -0400
     1.3 @@ -496,15 +496,15 @@
     1.4  
     1.5  IRT_ENTRY(void, InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code bytecode))
     1.6    // resolve field
     1.7 -  FieldAccessInfo info;
     1.8 +  fieldDescriptor info;
     1.9    constantPoolHandle pool(thread, method(thread)->constants());
    1.10    bool is_put    = (bytecode == Bytecodes::_putfield  || bytecode == Bytecodes::_putstatic);
    1.11    bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
    1.12  
    1.13    {
    1.14      JvmtiHideSingleStepping jhss(thread);
    1.15 -    LinkResolver::resolve_field(info, pool, get_index_u2_cpcache(thread, bytecode),
    1.16 -                                bytecode, false, CHECK);
    1.17 +    LinkResolver::resolve_field_access(info, pool, get_index_u2_cpcache(thread, bytecode),
    1.18 +                                       bytecode, CHECK);
    1.19    } // end JvmtiHideSingleStepping
    1.20  
    1.21    // check if link resolution caused cpCache to be updated
    1.22 @@ -524,7 +524,7 @@
    1.23    // class is intitialized.  This is required so that access to the static
    1.24    // field will call the initialization function every time until the class
    1.25    // is completely initialized ala. in 2.17.5 in JVM Specification.
    1.26 -  InstanceKlass *klass = InstanceKlass::cast(info.klass()());
    1.27 +  InstanceKlass* klass = InstanceKlass::cast(info.field_holder());
    1.28    bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) &&
    1.29                                 !klass->is_initialized());
    1.30    Bytecodes::Code get_code = (Bytecodes::Code)0;
    1.31 @@ -539,9 +539,9 @@
    1.32    cache_entry(thread)->set_field(
    1.33      get_code,
    1.34      put_code,
    1.35 -    info.klass(),
    1.36 -    info.field_index(),
    1.37 -    info.field_offset(),
    1.38 +    info.field_holder(),
    1.39 +    info.index(),
    1.40 +    info.offset(),
    1.41      state,
    1.42      info.access_flags().is_final(),
    1.43      info.access_flags().is_volatile(),
    1.44 @@ -686,29 +686,55 @@
    1.45    if (already_resolved(thread)) return;
    1.46  
    1.47    if (bytecode == Bytecodes::_invokeinterface) {
    1.48 -
    1.49      if (TraceItables && Verbose) {
    1.50        ResourceMark rm(thread);
    1.51        tty->print_cr("Resolving: klass: %s to method: %s", info.resolved_klass()->name()->as_C_string(), info.resolved_method()->name()->as_C_string());
    1.52      }
    1.53 +  }
    1.54 +#ifdef ASSERT
    1.55 +  if (bytecode == Bytecodes::_invokeinterface) {
    1.56      if (info.resolved_method()->method_holder() ==
    1.57                                              SystemDictionary::Object_klass()) {
    1.58        // NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec
    1.59 -      // (see also cpCacheOop.cpp for details)
    1.60 +      // (see also CallInfo::set_interface for details)
    1.61 +      assert(info.call_kind() == CallInfo::vtable_call ||
    1.62 +             info.call_kind() == CallInfo::direct_call, "");
    1.63        methodHandle rm = info.resolved_method();
    1.64        assert(rm->is_final() || info.has_vtable_index(),
    1.65               "should have been set already");
    1.66 -      cache_entry(thread)->set_method(bytecode, rm, info.vtable_index());
    1.67 +    } else if (!info.resolved_method()->has_itable_index()) {
    1.68 +      // Resolved something like CharSequence.toString.  Use vtable not itable.
    1.69 +      assert(info.call_kind() != CallInfo::itable_call, "");
    1.70      } else {
    1.71        // Setup itable entry
    1.72 -      int index = klassItable::compute_itable_index(info.resolved_method()());
    1.73 -      cache_entry(thread)->set_interface_call(info.resolved_method(), index);
    1.74 +      assert(info.call_kind() == CallInfo::itable_call, "");
    1.75 +      int index = info.resolved_method()->itable_index();
    1.76 +      assert(info.itable_index() == index, "");
    1.77      }
    1.78    } else {
    1.79 -    cache_entry(thread)->set_method(
    1.80 +    assert(info.call_kind() == CallInfo::direct_call ||
    1.81 +           info.call_kind() == CallInfo::vtable_call, "");
    1.82 +  }
    1.83 +#endif
    1.84 +  switch (info.call_kind()) {
    1.85 +  case CallInfo::direct_call:
    1.86 +    cache_entry(thread)->set_direct_call(
    1.87 +      bytecode,
    1.88 +      info.resolved_method());
    1.89 +    break;
    1.90 +  case CallInfo::vtable_call:
    1.91 +    cache_entry(thread)->set_vtable_call(
    1.92        bytecode,
    1.93        info.resolved_method(),
    1.94        info.vtable_index());
    1.95 +    break;
    1.96 +  case CallInfo::itable_call:
    1.97 +    cache_entry(thread)->set_itable_call(
    1.98 +      bytecode,
    1.99 +      info.resolved_method(),
   1.100 +      info.itable_index());
   1.101 +    break;
   1.102 +  default:  ShouldNotReachHere();
   1.103    }
   1.104  }
   1.105  IRT_END

mercurial