src/cpu/x86/vm/interp_masm_x86_64.cpp

changeset 4037
da91efe96a93
parent 3969
1d7922586cf6
child 4299
f34d701e952e
     1.1 --- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2003, 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,8 +28,8 @@
    1.11  #include "interpreter/interpreterRuntime.hpp"
    1.12  #include "oops/arrayOop.hpp"
    1.13  #include "oops/markOop.hpp"
    1.14 -#include "oops/methodDataOop.hpp"
    1.15 -#include "oops/methodOop.hpp"
    1.16 +#include "oops/methodData.hpp"
    1.17 +#include "oops/method.hpp"
    1.18  #include "prims/jvmtiExport.hpp"
    1.19  #include "prims/jvmtiRedefineClassesTrace.hpp"
    1.20  #include "prims/jvmtiThreadState.hpp"
    1.21 @@ -221,10 +221,9 @@
    1.22      // Check if the secondary index definition is still ~x, otherwise
    1.23      // we have to change the following assembler code to calculate the
    1.24      // plain index.
    1.25 -    assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line");
    1.26 +    assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
    1.27      notl(index);  // convert to plain index
    1.28    } else if (index_size == sizeof(u1)) {
    1.29 -    assert(EnableInvokeDynamic, "tiny index used only for JSR 292");
    1.30      load_unsigned_byte(index, Address(r13, bcp_offset));
    1.31    } else {
    1.32      ShouldNotReachHere();
    1.33 @@ -241,6 +240,7 @@
    1.34    movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize));
    1.35    assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below");
    1.36    // convert from field index to ConstantPoolCacheEntry index
    1.37 +  assert(exact_log2(in_words(ConstantPoolCacheEntry::size())) == 2, "else change next line");
    1.38    shll(index, 2);
    1.39  }
    1.40  
    1.41 @@ -254,7 +254,7 @@
    1.42    get_cache_and_index_at_bcp(cache, index, bcp_offset, index_size);
    1.43    // We use a 32-bit load here since the layout of 64-bit words on
    1.44    // little-endian machines allow us that.
    1.45 -  movl(bytecode, Address(cache, index, Address::times_ptr, constantPoolCacheOopDesc::base_offset() + ConstantPoolCacheEntry::indices_offset()));
    1.46 +  movl(bytecode, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::indices_offset()));
    1.47    const int shift_count = (1 + byte_no) * BitsPerByte;
    1.48    assert((byte_no == TemplateTable::f1_byte && shift_count == ConstantPoolCacheEntry::bytecode_1_shift) ||
    1.49           (byte_no == TemplateTable::f2_byte && shift_count == ConstantPoolCacheEntry::bytecode_2_shift),
    1.50 @@ -274,13 +274,32 @@
    1.51    assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below");
    1.52    // convert from field index to ConstantPoolCacheEntry index
    1.53    // and from word offset to byte offset
    1.54 +  assert(exact_log2(in_bytes(ConstantPoolCacheEntry::size_in_bytes())) == 2 + LogBytesPerWord, "else change next line");
    1.55    shll(tmp, 2 + LogBytesPerWord);
    1.56    movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize));
    1.57    // skip past the header
    1.58 -  addptr(cache, in_bytes(constantPoolCacheOopDesc::base_offset()));
    1.59 +  addptr(cache, in_bytes(ConstantPoolCache::base_offset()));
    1.60    addptr(cache, tmp);  // construct pointer to cache entry
    1.61  }
    1.62  
    1.63 +// Load object from cpool->resolved_references(index)
    1.64 +void InterpreterMacroAssembler::load_resolved_reference_at_index(
    1.65 +                                           Register result, Register index) {
    1.66 +  assert_different_registers(result, index);
    1.67 +  // convert from field index to resolved_references() index and from
    1.68 +  // word index to byte offset. Since this is a java object, it can be compressed
    1.69 +  Register tmp = index;  // reuse
    1.70 +  shll(tmp, LogBytesPerHeapOop);
    1.71 +
    1.72 +  get_constant_pool(result);
    1.73 +  // load pointer for resolved_references[] objArray
    1.74 +  movptr(result, Address(result, ConstantPool::resolved_references_offset_in_bytes()));
    1.75 +  // JNIHandles::resolve(obj);
    1.76 +  movptr(result, Address(result, 0));
    1.77 +  // Add in the index
    1.78 +  addptr(result, tmp);
    1.79 +  load_heap_oop(result, Address(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT)));
    1.80 +}
    1.81  
    1.82  // Generate a subtype check: branch to ok_is_subtype if sub_klass is a
    1.83  // subtype of super_klass.
    1.84 @@ -426,11 +445,11 @@
    1.85      // Is a cmpl faster?
    1.86      cmpb(Address(r15_thread, JavaThread::interp_only_mode_offset()), 0);
    1.87      jccb(Assembler::zero, run_compiled_code);
    1.88 -    jmp(Address(method, methodOopDesc::interpreter_entry_offset()));
    1.89 +    jmp(Address(method, Method::interpreter_entry_offset()));
    1.90      bind(run_compiled_code);
    1.91    }
    1.92  
    1.93 -  jmp(Address(method, methodOopDesc::from_interpreted_offset()));
    1.94 +  jmp(Address(method, Method::from_interpreted_offset()));
    1.95  
    1.96  }
    1.97  
    1.98 @@ -526,7 +545,7 @@
    1.99  
   1.100   // get method access flags
   1.101    movptr(rbx, Address(rbp, frame::interpreter_frame_method_offset * wordSize));
   1.102 -  movl(rcx, Address(rbx, methodOopDesc::access_flags_offset()));
   1.103 +  movl(rcx, Address(rbx, Method::access_flags_offset()));
   1.104    testl(rcx, JVM_ACC_SYNCHRONIZED);
   1.105    jcc(Assembler::zero, unlocked);
   1.106  
   1.107 @@ -834,7 +853,7 @@
   1.108  
   1.109    get_method(rbx);
   1.110    // Test MDO to avoid the call if it is NULL.
   1.111 -  movptr(rax, Address(rbx, in_bytes(methodOopDesc::method_data_offset())));
   1.112 +  movptr(rax, Address(rbx, in_bytes(Method::method_data_offset())));
   1.113    testptr(rax, rax);
   1.114    jcc(Assembler::zero, set_mdp);
   1.115    // rbx: method
   1.116 @@ -842,8 +861,8 @@
   1.117    call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), rbx, r13);
   1.118    // rax: mdi
   1.119    // mdo is guaranteed to be non-zero here, we checked for it before the call.
   1.120 -  movptr(rbx, Address(rbx, in_bytes(methodOopDesc::method_data_offset())));
   1.121 -  addptr(rbx, in_bytes(methodDataOopDesc::data_offset()));
   1.122 +  movptr(rbx, Address(rbx, in_bytes(Method::method_data_offset())));
   1.123 +  addptr(rbx, in_bytes(MethodData::data_offset()));
   1.124    addptr(rax, rbx);
   1.125    bind(set_mdp);
   1.126    movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rax);
   1.127 @@ -866,8 +885,8 @@
   1.128    // consistent with the bcp.  The converse is highly probable also.
   1.129    load_unsigned_short(c_rarg2,
   1.130                        Address(c_rarg3, in_bytes(DataLayout::bci_offset())));
   1.131 -  addptr(c_rarg2, Address(rbx, methodOopDesc::const_offset()));
   1.132 -  lea(c_rarg2, Address(c_rarg2, constMethodOopDesc::codes_offset()));
   1.133 +  addptr(c_rarg2, Address(rbx, Method::const_offset()));
   1.134 +  lea(c_rarg2, Address(c_rarg2, ConstMethod::codes_offset()));
   1.135    cmpptr(c_rarg2, r13);
   1.136    jcc(Assembler::equal, verify_continue);
   1.137    // rbx: method

mercurial