src/cpu/x86/vm/templateTable_x86_32.cpp

changeset 4037
da91efe96a93
parent 3969
1d7922586cf6
child 4052
75f33eecc1b3
     1.1 --- a/src/cpu/x86/vm/templateTable_x86_32.cpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -28,7 +28,7 @@
    1.11  #include "interpreter/interpreterRuntime.hpp"
    1.12  #include "interpreter/templateTable.hpp"
    1.13  #include "memory/universe.inline.hpp"
    1.14 -#include "oops/methodDataOop.hpp"
    1.15 +#include "oops/methodData.hpp"
    1.16  #include "oops/objArrayKlass.hpp"
    1.17  #include "oops/oop.inline.hpp"
    1.18  #include "prims/methodHandles.hpp"
    1.19 @@ -357,17 +357,13 @@
    1.20      __ load_unsigned_byte(rbx, at_bcp(1));
    1.21    }
    1.22    __ get_cpool_and_tags(rcx, rax);
    1.23 -  const int base_offset = constantPoolOopDesc::header_size() * wordSize;
    1.24 -  const int tags_offset = typeArrayOopDesc::header_size(T_BYTE) * wordSize;
    1.25 +  const int base_offset = ConstantPool::header_size() * wordSize;
    1.26 +  const int tags_offset = Array<u1>::base_offset_in_bytes();
    1.27  
    1.28    // get type
    1.29    __ xorptr(rdx, rdx);
    1.30    __ movb(rdx, Address(rax, rbx, Address::times_1, tags_offset));
    1.31  
    1.32 -  // unresolved string - get the resolved string
    1.33 -  __ cmpl(rdx, JVM_CONSTANT_UnresolvedString);
    1.34 -  __ jccb(Assembler::equal, call_ldc);
    1.35 -
    1.36    // unresolved class - get the resolved class
    1.37    __ cmpl(rdx, JVM_CONSTANT_UnresolvedClass);
    1.38    __ jccb(Assembler::equal, call_ldc);
    1.39 @@ -400,73 +396,46 @@
    1.40    { Label L;
    1.41      __ cmpl(rdx, JVM_CONSTANT_Integer);
    1.42      __ jcc(Assembler::equal, L);
    1.43 -    __ cmpl(rdx, JVM_CONSTANT_String);
    1.44 -    __ jcc(Assembler::equal, L);
    1.45 -    __ cmpl(rdx, JVM_CONSTANT_Object);
    1.46 -    __ jcc(Assembler::equal, L);
    1.47 +    // String and Object are rewritten to fast_aldc
    1.48      __ stop("unexpected tag type in ldc");
    1.49      __ bind(L);
    1.50    }
    1.51  #endif
    1.52 -  Label isOop;
    1.53 -  // atos and itos
    1.54 -  // Integer is only non-oop type we will see here
    1.55 -  __ cmpl(rdx, JVM_CONSTANT_Integer);
    1.56 -  __ jccb(Assembler::notEqual, isOop);
    1.57 +  // itos JVM_CONSTANT_Integer only
    1.58    __ movl(rax, Address(rcx, rbx, Address::times_ptr, base_offset));
    1.59    __ push(itos);
    1.60 -  __ jmp(Done);
    1.61 -  __ bind(isOop);
    1.62 -  __ movptr(rax, Address(rcx, rbx, Address::times_ptr, base_offset));
    1.63 -  __ push(atos);
    1.64 -
    1.65 -  if (VerifyOops) {
    1.66 -    __ verify_oop(rax);
    1.67 -  }
    1.68    __ bind(Done);
    1.69  }
    1.70  
    1.71  // Fast path for caching oop constants.
    1.72 -// %%% We should use this to handle Class and String constants also.
    1.73 -// %%% It will simplify the ldc/primitive path considerably.
    1.74  void TemplateTable::fast_aldc(bool wide) {
    1.75    transition(vtos, atos);
    1.76  
    1.77 -  if (!EnableInvokeDynamic) {
    1.78 -    // We should not encounter this bytecode if !EnableInvokeDynamic.
    1.79 -    // The verifier will stop it.  However, if we get past the verifier,
    1.80 -    // this will stop the thread in a reasonable way, without crashing the JVM.
    1.81 -    __ call_VM(noreg, CAST_FROM_FN_PTR(address,
    1.82 -                     InterpreterRuntime::throw_IncompatibleClassChangeError));
    1.83 -    // the call_VM checks for exception, so we should never return here.
    1.84 -    __ should_not_reach_here();
    1.85 -    return;
    1.86 +  Register result = rax;
    1.87 +  Register tmp = rdx;
    1.88 +  int index_size = wide ? sizeof(u2) : sizeof(u1);
    1.89 +
    1.90 +  Label resolved;
    1.91 +
    1.92 +  // We are resolved if the resolved reference cache entry contains a
    1.93 +  // non-null object (String, MethodType, etc.)
    1.94 +  assert_different_registers(result, tmp);
    1.95 +  __ get_cache_index_at_bcp(tmp, 1, index_size);
    1.96 +  __ load_resolved_reference_at_index(result, tmp);
    1.97 +  __ testl(result, result);
    1.98 +  __ jcc(Assembler::notZero, resolved);
    1.99 +
   1.100 +  address entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_ldc);
   1.101 +
   1.102 +  // first time invocation - must resolve first
   1.103 +  __ movl(tmp, (int)bytecode());
   1.104 +  __ call_VM(result, entry, tmp);
   1.105 +
   1.106 +  __ bind(resolved);
   1.107 +
   1.108 +  if (VerifyOops) {
   1.109 +    __ verify_oop(result);
   1.110    }
   1.111 -
   1.112 -  const Register cache = rcx;
   1.113 -  const Register index = rdx;
   1.114 -
   1.115 -  resolve_cache_and_index(f12_oop, rax, cache, index, wide ? sizeof(u2) : sizeof(u1));
   1.116 -  if (VerifyOops) {
   1.117 -    __ verify_oop(rax);
   1.118 -  }
   1.119 -
   1.120 -  Label L_done, L_throw_exception;
   1.121 -  const Register con_klass_temp = rcx;  // same as cache
   1.122 -  __ load_klass(con_klass_temp, rax);
   1.123 -  __ cmpptr(con_klass_temp, ExternalAddress((address)Universe::systemObjArrayKlassObj_addr()));
   1.124 -  __ jcc(Assembler::notEqual, L_done);
   1.125 -  __ cmpl(Address(rax, arrayOopDesc::length_offset_in_bytes()), 0);
   1.126 -  __ jcc(Assembler::notEqual, L_throw_exception);
   1.127 -  __ xorptr(rax, rax);
   1.128 -  __ jmp(L_done);
   1.129 -
   1.130 -  // Load the exception from the system-array which wraps it:
   1.131 -  __ bind(L_throw_exception);
   1.132 -  __ load_heap_oop(rax, Address(rax, arrayOopDesc::base_offset_in_bytes(T_OBJECT)));
   1.133 -  __ jump(ExternalAddress(Interpreter::throw_exception_entry()));
   1.134 -
   1.135 -  __ bind(L_done);
   1.136  }
   1.137  
   1.138  void TemplateTable::ldc2_w() {
   1.139 @@ -475,8 +444,8 @@
   1.140    __ get_unsigned_2_byte_index_at_bcp(rbx, 1);
   1.141  
   1.142    __ get_cpool_and_tags(rcx, rax);
   1.143 -  const int base_offset = constantPoolOopDesc::header_size() * wordSize;
   1.144 -  const int tags_offset = typeArrayOopDesc::header_size(T_BYTE) * wordSize;
   1.145 +  const int base_offset = ConstantPool::header_size() * wordSize;
   1.146 +  const int tags_offset = Array<u1>::base_offset_in_bytes();
   1.147  
   1.148    // get type
   1.149    __ cmpb(Address(rax, rbx, Address::times_1, tags_offset), JVM_CONSTANT_Double);
   1.150 @@ -1328,7 +1297,7 @@
   1.151      case mul: {
   1.152        Label L_strict;
   1.153        Label L_join;
   1.154 -      const Address access_flags      (rcx, methodOopDesc::access_flags_offset());
   1.155 +      const Address access_flags      (rcx, Method::access_flags_offset());
   1.156        __ get_method(rcx);
   1.157        __ movl(rcx, access_flags);
   1.158        __ testl(rcx, JVM_ACC_STRICT);
   1.159 @@ -1347,7 +1316,7 @@
   1.160      case div: {
   1.161        Label L_strict;
   1.162        Label L_join;
   1.163 -      const Address access_flags      (rcx, methodOopDesc::access_flags_offset());
   1.164 +      const Address access_flags      (rcx, Method::access_flags_offset());
   1.165        __ get_method(rcx);
   1.166        __ movl(rcx, access_flags);
   1.167        __ testl(rcx, JVM_ACC_STRICT);
   1.168 @@ -1576,8 +1545,8 @@
   1.169    __ get_method(rcx);           // ECX holds method
   1.170    __ profile_taken_branch(rax,rbx); // EAX holds updated MDP, EBX holds bumped taken count
   1.171  
   1.172 -  const ByteSize be_offset = methodOopDesc::backedge_counter_offset() + InvocationCounter::counter_offset();
   1.173 -  const ByteSize inv_offset = methodOopDesc::invocation_counter_offset() + InvocationCounter::counter_offset();
   1.174 +  const ByteSize be_offset = Method::backedge_counter_offset() + InvocationCounter::counter_offset();
   1.175 +  const ByteSize inv_offset = Method::invocation_counter_offset() + InvocationCounter::counter_offset();
   1.176    const int method_offset = frame::interpreter_frame_method_offset * wordSize;
   1.177  
   1.178    // Load up EDX with the branch displacement
   1.179 @@ -1595,8 +1564,8 @@
   1.180      __ load_unsigned_byte(rbx, Address(rsi, rdx, Address::times_1, 0));
   1.181  
   1.182      // compute return address as bci in rax,
   1.183 -    __ lea(rax, at_bcp((is_wide ? 5 : 3) - in_bytes(constMethodOopDesc::codes_offset())));
   1.184 -    __ subptr(rax, Address(rcx, methodOopDesc::const_offset()));
   1.185 +    __ lea(rax, at_bcp((is_wide ? 5 : 3) - in_bytes(ConstMethod::codes_offset())));
   1.186 +    __ subptr(rax, Address(rcx, Method::const_offset()));
   1.187      // Adjust the bcp in RSI by the displacement in EDX
   1.188      __ addptr(rsi, rdx);
   1.189      // Push return address
   1.190 @@ -1632,18 +1601,18 @@
   1.191        int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
   1.192        if (ProfileInterpreter) {
   1.193          // Are we profiling?
   1.194 -        __ movptr(rbx, Address(rcx, in_bytes(methodOopDesc::method_data_offset())));
   1.195 +        __ movptr(rbx, Address(rcx, in_bytes(Method::method_data_offset())));
   1.196          __ testptr(rbx, rbx);
   1.197          __ jccb(Assembler::zero, no_mdo);
   1.198          // Increment the MDO backedge counter
   1.199 -        const Address mdo_backedge_counter(rbx, in_bytes(methodDataOopDesc::backedge_counter_offset()) +
   1.200 +        const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) +
   1.201                                                  in_bytes(InvocationCounter::counter_offset()));
   1.202          __ increment_mask_and_jump(mdo_backedge_counter, increment, mask,
   1.203                                     rax, false, Assembler::zero, &backedge_counter_overflow);
   1.204          __ jmp(dispatch);
   1.205        }
   1.206        __ bind(no_mdo);
   1.207 -      // Increment backedge counter in methodOop
   1.208 +      // Increment backedge counter in Method*
   1.209        __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask,
   1.210                                   rax, false, Assembler::zero, &backedge_counter_overflow);
   1.211      } else {
   1.212 @@ -1672,7 +1641,7 @@
   1.213            __ jcc(Assembler::below, dispatch);
   1.214  
   1.215            // When ProfileInterpreter is on, the backedge_count comes from the
   1.216 -          // methodDataOop, which value does not get reset on the call to
   1.217 +          // MethodData*, which value does not get reset on the call to
   1.218            // frequency_counter_overflow().  To avoid excessive calls to the overflow
   1.219            // routine while the method is being compiled, add a second test to make
   1.220            // sure the overflow function is called only once every overflow_frequency.
   1.221 @@ -1822,9 +1791,9 @@
   1.222    __ movptr(rbx, iaddress(rbx));                   // get return bci, compute return bcp
   1.223    __ profile_ret(rbx, rcx);
   1.224    __ get_method(rax);
   1.225 -  __ movptr(rsi, Address(rax, methodOopDesc::const_offset()));
   1.226 +  __ movptr(rsi, Address(rax, Method::const_offset()));
   1.227    __ lea(rsi, Address(rsi, rbx, Address::times_1,
   1.228 -                      constMethodOopDesc::codes_offset()));
   1.229 +                      ConstMethod::codes_offset()));
   1.230    __ dispatch_next(vtos);
   1.231  }
   1.232  
   1.233 @@ -1835,8 +1804,8 @@
   1.234    __ movptr(rbx, iaddress(rbx));                   // get return bci, compute return bcp
   1.235    __ profile_ret(rbx, rcx);
   1.236    __ get_method(rax);
   1.237 -  __ movptr(rsi, Address(rax, methodOopDesc::const_offset()));
   1.238 -  __ lea(rsi, Address(rsi, rbx, Address::times_1, constMethodOopDesc::codes_offset()));
   1.239 +  __ movptr(rsi, Address(rax, Method::const_offset()));
   1.240 +  __ lea(rsi, Address(rsi, rbx, Address::times_1, ConstMethod::codes_offset()));
   1.241    __ dispatch_next(vtos);
   1.242  }
   1.243  
   1.244 @@ -2080,31 +2049,17 @@
   1.245  }
   1.246  
   1.247  void TemplateTable::resolve_cache_and_index(int byte_no,
   1.248 -                                            Register result,
   1.249                                              Register Rcache,
   1.250                                              Register index,
   1.251                                              size_t index_size) {
   1.252    const Register temp = rbx;
   1.253 -  assert_different_registers(result, Rcache, index, temp);
   1.254 +  assert_different_registers(Rcache, index, temp);
   1.255  
   1.256    Label resolved;
   1.257 -  if (byte_no == f12_oop) {
   1.258 -    // We are resolved if the f1 field contains a non-null object (CallSite, MethodType, etc.)
   1.259 -    // This kind of CP cache entry does not need to match bytecode_1 or bytecode_2, because
   1.260 -    // there is a 1-1 relation between bytecode type and CP entry type.
   1.261 -    // The caller will also load a methodOop from f2.
   1.262 -    assert(result != noreg, ""); //else do cmpptr(Address(...), (int32_t) NULL_WORD)
   1.263 -    __ get_cache_and_index_at_bcp(Rcache, index, 1, index_size);
   1.264 -    __ movptr(result, Address(Rcache, index, Address::times_ptr, constantPoolCacheOopDesc::base_offset() + ConstantPoolCacheEntry::f1_offset()));
   1.265 -    __ testptr(result, result);
   1.266 -    __ jcc(Assembler::notEqual, resolved);
   1.267 -  } else {
   1.268      assert(byte_no == f1_byte || byte_no == f2_byte, "byte_no out of range");
   1.269 -    assert(result == noreg, "");  //else change code for setting result
   1.270      __ get_cache_and_index_and_bytecode_at_bcp(Rcache, index, temp, byte_no, 1, index_size);
   1.271      __ cmpl(temp, (int) bytecode());  // have we resolved this bytecode?
   1.272      __ jcc(Assembler::equal, resolved);
   1.273 -  }
   1.274  
   1.275    // resolve first time through
   1.276    address entry;
   1.277 @@ -2119,8 +2074,6 @@
   1.278      case Bytecodes::_invokeinterface: entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_invoke);         break;
   1.279      case Bytecodes::_invokehandle   : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_invokehandle);   break;
   1.280      case Bytecodes::_invokedynamic  : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_invokedynamic);  break;
   1.281 -    case Bytecodes::_fast_aldc      : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_ldc);            break;
   1.282 -    case Bytecodes::_fast_aldc_w    : entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_ldc);            break;
   1.283      default:
   1.284        fatal(err_msg("unexpected bytecode: %s", Bytecodes::name(bytecode())));
   1.285        break;
   1.286 @@ -2129,8 +2082,6 @@
   1.287    __ call_VM(noreg, entry, temp);
   1.288    // Update registers with resolved info
   1.289    __ get_cache_and_index_at_bcp(Rcache, index, 1, index_size);
   1.290 -  if (result != noreg)
   1.291 -    __ movptr(result, Address(Rcache, index, Address::times_ptr, constantPoolCacheOopDesc::base_offset() + ConstantPoolCacheEntry::f1_offset()));
   1.292    __ bind(resolved);
   1.293  }
   1.294  
   1.295 @@ -2144,7 +2095,7 @@
   1.296                                                bool is_static = false) {
   1.297    assert_different_registers(cache, index, flags, off);
   1.298  
   1.299 -  ByteSize cp_base_offset = constantPoolCacheOopDesc::base_offset();
   1.300 +  ByteSize cp_base_offset = ConstantPoolCache::base_offset();
   1.301    // Field offset
   1.302    __ movptr(off, Address(cache, index, Address::times_ptr,
   1.303                           in_bytes(cp_base_offset + ConstantPoolCacheEntry::f2_offset())));
   1.304 @@ -2156,6 +2107,8 @@
   1.305    if (is_static) {
   1.306      __ movptr(obj, Address(cache, index, Address::times_ptr,
   1.307                             in_bytes(cp_base_offset + ConstantPoolCacheEntry::f1_offset())));
   1.308 +    const int mirror_offset = in_bytes(Klass::java_mirror_offset());
   1.309 +    __ movptr(obj, Address(obj, mirror_offset));
   1.310    }
   1.311  }
   1.312  
   1.313 @@ -2176,31 +2129,21 @@
   1.314    // determine constant pool cache field offsets
   1.315    assert(is_invokevirtual == (byte_no == f2_byte), "is_invokevirtual flag redundant");
   1.316    const int method_offset = in_bytes(
   1.317 -    constantPoolCacheOopDesc::base_offset() +
   1.318 +    ConstantPoolCache::base_offset() +
   1.319        ((byte_no == f2_byte)
   1.320         ? ConstantPoolCacheEntry::f2_offset()
   1.321         : ConstantPoolCacheEntry::f1_offset()));
   1.322 -  const int flags_offset = in_bytes(constantPoolCacheOopDesc::base_offset() +
   1.323 +  const int flags_offset = in_bytes(ConstantPoolCache::base_offset() +
   1.324                                      ConstantPoolCacheEntry::flags_offset());
   1.325    // access constant pool cache fields
   1.326 -  const int index_offset = in_bytes(constantPoolCacheOopDesc::base_offset() +
   1.327 +  const int index_offset = in_bytes(ConstantPoolCache::base_offset() +
   1.328                                      ConstantPoolCacheEntry::f2_offset());
   1.329  
   1.330 -  if (byte_no == f12_oop) {
   1.331 -    // Resolved f1_oop (CallSite, MethodType, etc.) goes into 'itable_index'.
   1.332 -    // Resolved f2_oop (methodOop invoker) will go into 'method' (at index_offset).
   1.333 -    // See ConstantPoolCacheEntry::set_dynamic_call and set_method_handle.
   1.334      size_t index_size = (is_invokedynamic ? sizeof(u4) : sizeof(u2));
   1.335 -    resolve_cache_and_index(byte_no, itable_index, cache, index, index_size);
   1.336 -    __ movptr(method, Address(cache, index, Address::times_ptr, index_offset));
   1.337 -    itable_index = noreg;  // hack to disable load below
   1.338 -  } else {
   1.339 -    resolve_cache_and_index(byte_no, noreg, cache, index, sizeof(u2));
   1.340 +  resolve_cache_and_index(byte_no, cache, index, index_size);
   1.341      __ movptr(method, Address(cache, index, Address::times_ptr, method_offset));
   1.342 -  }
   1.343 +
   1.344    if (itable_index != noreg) {
   1.345 -    // pick up itable index from f2 also:
   1.346 -    assert(byte_no == f1_byte, "already picked up f1");
   1.347      __ movptr(itable_index, Address(cache, index, Address::times_ptr, index_offset));
   1.348    }
   1.349    __ movl(flags, Address(cache, index, Address::times_ptr, flags_offset));
   1.350 @@ -2223,7 +2166,7 @@
   1.351      __ jcc(Assembler::zero, L1);
   1.352  
   1.353      // cache entry pointer
   1.354 -    __ addptr(cache, in_bytes(constantPoolCacheOopDesc::base_offset()));
   1.355 +    __ addptr(cache, in_bytes(ConstantPoolCache::base_offset()));
   1.356      __ shll(index, LogBytesPerWord);
   1.357      __ addptr(cache, index);
   1.358      if (is_static) {
   1.359 @@ -2257,7 +2200,7 @@
   1.360    const Register off   = rbx;
   1.361    const Register flags = rax;
   1.362  
   1.363 -  resolve_cache_and_index(byte_no, noreg, cache, index, sizeof(u2));
   1.364 +  resolve_cache_and_index(byte_no, cache, index, sizeof(u2));
   1.365    jvmti_post_field_access(cache, index, is_static, false);
   1.366    load_field_cp_cache_entry(obj, cache, index, off, flags, is_static);
   1.367  
   1.368 @@ -2395,7 +2338,7 @@
   1.369  // The function may destroy various registers, just not the cache and index registers.
   1.370  void TemplateTable::jvmti_post_field_mod(Register cache, Register index, bool is_static) {
   1.371  
   1.372 -  ByteSize cp_base_offset = constantPoolCacheOopDesc::base_offset();
   1.373 +  ByteSize cp_base_offset = ConstantPoolCache::base_offset();
   1.374  
   1.375    if (JvmtiExport::can_post_field_modification()) {
   1.376      // Check to see if a field modification watch has been set before we take
   1.377 @@ -2466,7 +2409,7 @@
   1.378    const Register off   = rbx;
   1.379    const Register flags = rax;
   1.380  
   1.381 -  resolve_cache_and_index(byte_no, noreg, cache, index, sizeof(u2));
   1.382 +  resolve_cache_and_index(byte_no, cache, index, sizeof(u2));
   1.383    jvmti_post_field_mod(cache, index, is_static);
   1.384    load_field_cp_cache_entry(obj, cache, index, off, flags, is_static);
   1.385  
   1.386 @@ -2708,7 +2651,7 @@
   1.387  void TemplateTable::fast_storefield(TosState state) {
   1.388    transition(state, vtos);
   1.389  
   1.390 -  ByteSize base = constantPoolCacheOopDesc::base_offset();
   1.391 +  ByteSize base = ConstantPoolCache::base_offset();
   1.392  
   1.393    jvmti_post_fast_field_mod();
   1.394  
   1.395 @@ -2827,7 +2770,7 @@
   1.396    __ movptr(rbx, Address(rcx,
   1.397                           rbx,
   1.398                           Address::times_ptr,
   1.399 -                         in_bytes(constantPoolCacheOopDesc::base_offset() + ConstantPoolCacheEntry::f2_offset())));
   1.400 +                         in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::f2_offset())));
   1.401  
   1.402  
   1.403    // rax,: object
   1.404 @@ -2864,7 +2807,7 @@
   1.405    __ movptr(rbx, Address(rcx,
   1.406                           rdx,
   1.407                           Address::times_ptr,
   1.408 -                         in_bytes(constantPoolCacheOopDesc::base_offset() + ConstantPoolCacheEntry::f2_offset())));
   1.409 +                         in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::f2_offset())));
   1.410    // make sure exception is reported in correct bcp range (getfield is next instruction)
   1.411    __ increment(rsi);
   1.412    __ null_check(rax);
   1.413 @@ -2926,12 +2869,15 @@
   1.414    // maybe push appendix to arguments (just before return address)
   1.415    if (is_invokedynamic || is_invokehandle) {
   1.416      Label L_no_push;
   1.417 -    __ verify_oop(index);
   1.418      __ testl(flags, (1 << ConstantPoolCacheEntry::has_appendix_shift));
   1.419      __ jccb(Assembler::zero, L_no_push);
   1.420      // Push the appendix as a trailing parameter.
   1.421      // This must be done before we get the receiver,
   1.422      // since the parameter_size includes it.
   1.423 +    __ push(rbx);
   1.424 +    __ mov(rbx, index);
   1.425 +    __ load_resolved_reference_at_index(index, rbx);
   1.426 +    __ pop(rbx);
   1.427      __ push(index);  // push appendix (MethodType, CallSite, etc.)
   1.428      __ bind(L_no_push);
   1.429    }
   1.430 @@ -2992,11 +2938,10 @@
   1.431  
   1.432    const Register method = index;  // method must be rbx
   1.433    assert(method == rbx,
   1.434 -         "methodOop must be rbx for interpreter calling convention");
   1.435 +         "Method* must be rbx for interpreter calling convention");
   1.436  
   1.437    // do the call - the index is actually the method to call
   1.438 -  // that is, f2 is a vtable index if !is_vfinal, else f2 is a methodOop
   1.439 -  __ verify_oop(method);
   1.440 +  // that is, f2 is a vtable index if !is_vfinal, else f2 is a Method*
   1.441  
   1.442    // It's final, need a null check here!
   1.443    __ null_check(recv);
   1.444 @@ -3011,12 +2956,11 @@
   1.445    // get receiver klass
   1.446    __ null_check(recv, oopDesc::klass_offset_in_bytes());
   1.447    __ load_klass(rax, recv);
   1.448 -  __ verify_oop(rax);
   1.449  
   1.450    // profile this call
   1.451    __ profile_virtual_call(rax, rdi, rdx);
   1.452  
   1.453 -  // get target methodOop & entry point
   1.454 +  // get target Method* & entry point
   1.455    __ lookup_virtual_method(rax, index, method);
   1.456    __ jump_from_interpreted(method, rdx);
   1.457  }
   1.458 @@ -3041,12 +2985,11 @@
   1.459  void TemplateTable::invokespecial(int byte_no) {
   1.460    transition(vtos, vtos);
   1.461    assert(byte_no == f1_byte, "use this argument");
   1.462 -  prepare_invoke(byte_no, rbx, noreg,  // get f1 methodOop
   1.463 +  prepare_invoke(byte_no, rbx, noreg,  // get f1 Method*
   1.464                   rcx);  // get receiver also for null check
   1.465    __ verify_oop(rcx);
   1.466    __ null_check(rcx);
   1.467    // do the call
   1.468 -  __ verify_oop(rbx);
   1.469    __ profile_call(rax);
   1.470    __ jump_from_interpreted(rbx, rax);
   1.471  }
   1.472 @@ -3055,9 +2998,8 @@
   1.473  void TemplateTable::invokestatic(int byte_no) {
   1.474    transition(vtos, vtos);
   1.475    assert(byte_no == f1_byte, "use this argument");
   1.476 -  prepare_invoke(byte_no, rbx);  // get f1 methodOop
   1.477 +  prepare_invoke(byte_no, rbx);  // get f1 Method*
   1.478    // do the call
   1.479 -  __ verify_oop(rbx);
   1.480    __ profile_call(rax);
   1.481    __ jump_from_interpreted(rbx, rax);
   1.482  }
   1.483 @@ -3073,7 +3015,7 @@
   1.484  void TemplateTable::invokeinterface(int byte_no) {
   1.485    transition(vtos, vtos);
   1.486    assert(byte_no == f1_byte, "use this argument");
   1.487 -  prepare_invoke(byte_no, rax, rbx,  // get f1 klassOop, f2 itable index
   1.488 +  prepare_invoke(byte_no, rax, rbx,  // get f1 Klass*, f2 itable index
   1.489                   rcx, rdx); // recv, flags
   1.490  
   1.491    // rax: interface klass (from f1)
   1.492 @@ -3097,7 +3039,6 @@
   1.493    __ restore_locals();  // restore rdi
   1.494    __ null_check(rcx, oopDesc::klass_offset_in_bytes());
   1.495    __ load_klass(rdx, rcx);
   1.496 -  __ verify_oop(rdx);
   1.497  
   1.498    // profile this call
   1.499    __ profile_virtual_call(rdx, rsi, rdi);
   1.500 @@ -3110,7 +3051,7 @@
   1.501                               rbx, rsi,
   1.502                               no_such_interface);
   1.503  
   1.504 -  // rbx: methodOop to call
   1.505 +  // rbx: Method* to call
   1.506    // rcx: receiver
   1.507    // Check for abstract method error
   1.508    // Note: This should be done more efficiently via a throw_abstract_method_error
   1.509 @@ -3121,7 +3062,7 @@
   1.510  
   1.511    // do the call
   1.512    // rcx: receiver
   1.513 -  // rbx,: methodOop
   1.514 +  // rbx,: Method*
   1.515    __ jump_from_interpreted(rbx, rdx);
   1.516    __ should_not_reach_here();
   1.517  
   1.518 @@ -3151,7 +3092,7 @@
   1.519  
   1.520  void TemplateTable::invokehandle(int byte_no) {
   1.521    transition(vtos, vtos);
   1.522 -  assert(byte_no == f12_oop, "use this argument");
   1.523 +  assert(byte_no == f1_byte, "use this argument");
   1.524    const Register rbx_method = rbx;  // (from f2)
   1.525    const Register rax_mtype  = rax;  // (from f1)
   1.526    const Register rcx_recv   = rcx;
   1.527 @@ -3164,7 +3105,7 @@
   1.528    }
   1.529  
   1.530    prepare_invoke(byte_no,
   1.531 -                 rbx_method, rax_mtype,  // get f2 methodOop, f1 MethodType
   1.532 +                 rbx_method, rax_mtype,  // get f2 Method*, f1 MethodType
   1.533                   rcx_recv);
   1.534    __ verify_oop(rbx_method);
   1.535    __ verify_oop(rcx_recv);
   1.536 @@ -3181,7 +3122,7 @@
   1.537  
   1.538  void TemplateTable::invokedynamic(int byte_no) {
   1.539    transition(vtos, vtos);
   1.540 -  assert(byte_no == f12_oop, "use this argument");
   1.541 +  assert(byte_no == f1_byte, "use this argument");
   1.542  
   1.543    if (!EnableInvokeDynamic) {
   1.544      // We should not encounter this bytecode if !EnableInvokeDynamic.
   1.545 @@ -3199,7 +3140,7 @@
   1.546  
   1.547    prepare_invoke(byte_no, rbx_method, rax_callsite);
   1.548  
   1.549 -  // rax: CallSite object (from f1)
   1.550 +  // rax: CallSite object (from cpool->resolved_references[])
   1.551    // rbx: MH.linkToCallSite method (from f2)
   1.552  
   1.553    // Note:  rax_callsite is already pushed by prepare_invoke
   1.554 @@ -3229,22 +3170,22 @@
   1.555    __ get_cpool_and_tags(rcx, rax);
   1.556  
   1.557    // Make sure the class we're about to instantiate has been resolved.
   1.558 -  // This is done before loading instanceKlass to be consistent with the order
   1.559 -  // how Constant Pool is updated (see constantPoolOopDesc::klass_at_put)
   1.560 -  const int tags_offset = typeArrayOopDesc::header_size(T_BYTE) * wordSize;
   1.561 +  // This is done before loading InstanceKlass to be consistent with the order
   1.562 +  // how Constant Pool is updated (see ConstantPool::klass_at_put)
   1.563 +  const int tags_offset = Array<u1>::base_offset_in_bytes();
   1.564    __ cmpb(Address(rax, rdx, Address::times_1, tags_offset), JVM_CONSTANT_Class);
   1.565    __ jcc(Assembler::notEqual, slow_case_no_pop);
   1.566  
   1.567 -  // get instanceKlass
   1.568 -  __ movptr(rcx, Address(rcx, rdx, Address::times_ptr, sizeof(constantPoolOopDesc)));
   1.569 +  // get InstanceKlass
   1.570 +  __ movptr(rcx, Address(rcx, rdx, Address::times_ptr, sizeof(ConstantPool)));
   1.571    __ push(rcx);  // save the contexts of klass for initializing the header
   1.572  
   1.573    // make sure klass is initialized & doesn't have finalizer
   1.574    // make sure klass is fully initialized
   1.575 -  __ cmpb(Address(rcx, instanceKlass::init_state_offset()), instanceKlass::fully_initialized);
   1.576 +  __ cmpb(Address(rcx, InstanceKlass::init_state_offset()), InstanceKlass::fully_initialized);
   1.577    __ jcc(Assembler::notEqual, slow_case);
   1.578  
   1.579 -  // get instance_size in instanceKlass (scaled to a count of bytes)
   1.580 +  // get instance_size in InstanceKlass (scaled to a count of bytes)
   1.581    __ movl(rdx, Address(rcx, Klass::layout_helper_offset()));
   1.582    // test to see if it has a finalizer or is malformed in some way
   1.583    __ testl(rdx, Klass::_lh_instance_slow_path_bit);
   1.584 @@ -3414,18 +3355,23 @@
   1.585    __ get_cpool_and_tags(rcx, rdx); // ECX=cpool, EDX=tags array
   1.586    __ get_unsigned_2_byte_index_at_bcp(rbx, 1); // EBX=index
   1.587    // See if bytecode has already been quicked
   1.588 -  __ cmpb(Address(rdx, rbx, Address::times_1, typeArrayOopDesc::header_size(T_BYTE) * wordSize), JVM_CONSTANT_Class);
   1.589 +  __ cmpb(Address(rdx, rbx, Address::times_1, Array<u1>::base_offset_in_bytes()), JVM_CONSTANT_Class);
   1.590    __ jcc(Assembler::equal, quicked);
   1.591  
   1.592    __ push(atos);
   1.593 -  call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc) );
   1.594 +  call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc) );
   1.595 +  // vm_result_2 has metadata result
   1.596 +  // borrow rdi from locals
   1.597 +  __ get_thread(rdi);
   1.598 +  __ get_vm_result_2(rax, rdi);
   1.599 +  __ restore_locals();
   1.600    __ pop_ptr(rdx);
   1.601    __ jmpb(resolved);
   1.602  
   1.603    // Get superklass in EAX and subklass in EBX
   1.604    __ bind(quicked);
   1.605    __ mov(rdx, rax);          // Save object in EDX; EAX needed for subtype check
   1.606 -  __ movptr(rax, Address(rcx, rbx, Address::times_ptr, sizeof(constantPoolOopDesc)));
   1.607 +  __ movptr(rax, Address(rcx, rbx, Address::times_ptr, sizeof(ConstantPool)));
   1.608  
   1.609    __ bind(resolved);
   1.610    __ load_klass(rbx, rdx);
   1.611 @@ -3465,11 +3411,16 @@
   1.612    __ get_cpool_and_tags(rcx, rdx); // ECX=cpool, EDX=tags array
   1.613    __ get_unsigned_2_byte_index_at_bcp(rbx, 1); // EBX=index
   1.614    // See if bytecode has already been quicked
   1.615 -  __ cmpb(Address(rdx, rbx, Address::times_1, typeArrayOopDesc::header_size(T_BYTE) * wordSize), JVM_CONSTANT_Class);
   1.616 +  __ cmpb(Address(rdx, rbx, Address::times_1, Array<u1>::base_offset_in_bytes()), JVM_CONSTANT_Class);
   1.617    __ jcc(Assembler::equal, quicked);
   1.618  
   1.619    __ push(atos);
   1.620 -  call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc) );
   1.621 +  call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc) );
   1.622 +  // vm_result_2 has metadata result
   1.623 +  // borrow rdi from locals
   1.624 +  __ get_thread(rdi);
   1.625 +  __ get_vm_result_2(rax, rdi);
   1.626 +  __ restore_locals();
   1.627    __ pop_ptr(rdx);
   1.628    __ load_klass(rdx, rdx);
   1.629    __ jmp(resolved);
   1.630 @@ -3477,7 +3428,7 @@
   1.631    // Get superklass in EAX and subklass in EDX
   1.632    __ bind(quicked);
   1.633    __ load_klass(rdx, rax);
   1.634 -  __ movptr(rax, Address(rcx, rbx, Address::times_ptr, sizeof(constantPoolOopDesc)));
   1.635 +  __ movptr(rax, Address(rcx, rbx, Address::times_ptr, sizeof(ConstantPool)));
   1.636  
   1.637    __ bind(resolved);
   1.638  

mercurial