diff src/cpu/x86/vm/cppInterpreter_x86.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 1d7922586cf6
children 75f33eecc1b3
line wrap: on
line diff
--- a/src/cpu/x86/vm/cppInterpreter_x86.cpp	Fri Aug 31 16:39:35 2012 -0700
+++ b/src/cpu/x86/vm/cppInterpreter_x86.cpp	Sat Sep 01 13:25:18 2012 -0400
@@ -30,8 +30,8 @@
 #include "interpreter/interpreterGenerator.hpp"
 #include "interpreter/interpreterRuntime.hpp"
 #include "oops/arrayOop.hpp"
-#include "oops/methodDataOop.hpp"
-#include "oops/methodOop.hpp"
+#include "oops/methodData.hpp"
+#include "oops/method.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
@@ -421,7 +421,7 @@
   // state == address of new interpreterState
   // rsp == bottom of method's expression stack.
 
-  const Address const_offset      (rbx, methodOopDesc::const_offset());
+  const Address const_offset      (rbx, Method::const_offset());
 
 
   // On entry sp is the sender's sp. This includes the space for the arguments
@@ -471,8 +471,8 @@
   __ get_thread(rax);                                   // get vm's javathread*
   __ movptr(STATE(_thread), rax);                       // state->_bcp = codes()
 #endif // _LP64
-  __ movptr(rdx, Address(rbx, methodOopDesc::const_offset())); // get constantMethodOop
-  __ lea(rdx, Address(rdx, constMethodOopDesc::codes_offset())); // get code base
+  __ movptr(rdx, Address(rbx, Method::const_offset())); // get constantMethodOop
+  __ lea(rdx, Address(rdx, ConstMethod::codes_offset())); // get code base
   if (native) {
     __ movptr(STATE(_bcp), (int32_t)NULL_WORD);         // state->_bcp = NULL
   } else {
@@ -481,9 +481,9 @@
   __ xorptr(rdx, rdx);
   __ movptr(STATE(_oop_temp), rdx);                     // state->_oop_temp = NULL (only really needed for native)
   __ movptr(STATE(_mdx), rdx);                          // state->_mdx = NULL
-  __ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
-  __ movptr(rdx, Address(rdx, constMethodOopDesc::constants_offset()));
-  __ movptr(rdx, Address(rdx, constantPoolOopDesc::cache_offset_in_bytes()));
+  __ movptr(rdx, Address(rbx, Method::const_offset()));
+  __ movptr(rdx, Address(rdx, ConstMethod::constants_offset()));
+  __ movptr(rdx, Address(rdx, ConstantPool::cache_offset_in_bytes()));
   __ movptr(STATE(_constants), rdx);                    // state->_constants = constants()
 
   __ movptr(STATE(_method), rbx);                       // state->_method = method()
@@ -500,7 +500,7 @@
     // immediately.
 
     // synchronize method
-    const Address access_flags      (rbx, methodOopDesc::access_flags_offset());
+    const Address access_flags      (rbx, Method::access_flags_offset());
     const int entry_size            = frame::interpreter_frame_monitor_size() * wordSize;
     Label not_synced;
 
@@ -517,9 +517,9 @@
     __ testl(rax, JVM_ACC_STATIC);
     __ movptr(rax, Address(locals, 0));                   // get receiver (assume this is frequent case)
     __ jcc(Assembler::zero, done);
-    __ movptr(rax, Address(rbx, methodOopDesc::const_offset()));
-    __ movptr(rax, Address(rax, constMethodOopDesc::constants_offset()));
-    __ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes()));
+    __ movptr(rax, Address(rbx, Method::const_offset()));
+    __ movptr(rax, Address(rax, ConstMethod::constants_offset()));
+    __ movptr(rax, Address(rax, ConstantPool::pool_holder_offset_in_bytes()));
     __ movptr(rax, Address(rax, mirror_offset));
     __ bind(done);
     // add space for monitor & lock
@@ -538,8 +538,8 @@
 
     // compute full expression stack limit
 
-    const Address size_of_stack    (rbx, methodOopDesc::max_stack_offset());
-    const int extra_stack = 0; //6815692//methodOopDesc::extra_stack_words();
+    const Address size_of_stack    (rbx, Method::max_stack_offset());
+    const int extra_stack = 0; //6815692//Method::extra_stack_words();
     __ load_unsigned_short(rdx, size_of_stack);                           // get size of expression stack in words
     __ negptr(rdx);                                                       // so we can subtract in next step
     // Allocate expression stack
@@ -570,11 +570,11 @@
 //
 void InterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) {
 
-  const Address invocation_counter(rbx, methodOopDesc::invocation_counter_offset() + InvocationCounter::counter_offset());
-  const Address backedge_counter  (rbx, methodOopDesc::backedge_counter_offset() + InvocationCounter::counter_offset());
-
-  if (ProfileInterpreter) { // %%% Merge this into methodDataOop
-    __ incrementl(Address(rbx,methodOopDesc::interpreter_invocation_counter_offset()));
+  const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
+  const Address backedge_counter  (rbx, Method::backedge_counter_offset() + InvocationCounter::counter_offset());
+
+  if (ProfileInterpreter) { // %%% Merge this into MethodData*
+    __ incrementl(Address(rbx,Method::interpreter_invocation_counter_offset()));
   }
   // Update standard invocation counters
   __ movl(rax, backedge_counter);               // load backedge counter
@@ -611,7 +611,7 @@
   // C++ interpreter only
   // rsi/r13 - previous interpreter state pointer
 
-  const Address size_of_parameters(rbx, methodOopDesc::size_of_parameters_offset());
+  const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
 
   // InterpreterRuntime::frequency_counter_overflow takes one argument
   // indicating if the counter overflow occurs at a backwards branch (non-NULL bcp).
@@ -638,14 +638,14 @@
   //
   // Asm interpreter
   // rdx: number of additional locals this frame needs (what we must check)
-  // rbx,: methodOop
+  // rbx,: Method*
 
   // C++ Interpreter
   // rsi/r13: previous interpreter frame state object
   // rdi: &locals[0]
   // rcx: # of locals
   // rdx: number of additional locals this frame needs (what we must check)
-  // rbx: methodOop
+  // rbx: Method*
 
   // destroyed on exit
   // rax,
@@ -682,11 +682,11 @@
   const Address stack_size(thread, Thread::stack_size_offset());
 
   // locals + overhead, in bytes
-    const Address size_of_stack    (rbx, methodOopDesc::max_stack_offset());
+    const Address size_of_stack    (rbx, Method::max_stack_offset());
     // Always give one monitor to allow us to start interp if sync method.
     // Any additional monitors need a check when moving the expression stack
     const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize;
-    const int extra_stack = 0; //6815692//methodOopDesc::extra_stack_entries();
+    const int extra_stack = 0; //6815692//Method::extra_stack_entries();
   __ load_unsigned_short(rax, size_of_stack);                           // get size of expression stack in words
   __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), extra_stack + one_monitor));
   __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size));
@@ -738,7 +738,7 @@
 }
 
 // Find preallocated  monitor and lock method (C++ interpreter)
-// rbx - methodOop
+// rbx - Method*
 //
 void InterpreterGenerator::lock_method(void) {
   // assumes state == rsi/r13 == pointer to current interpreterState
@@ -746,7 +746,7 @@
   //
   // synchronize method
   const int entry_size            = frame::interpreter_frame_monitor_size() * wordSize;
-  const Address access_flags      (rbx, methodOopDesc::access_flags_offset());
+  const Address access_flags      (rbx, Method::access_flags_offset());
 
   const Register monitor  = NOT_LP64(rdx) LP64_ONLY(c_rarg1);
 
@@ -771,9 +771,9 @@
     __ testl(rax, JVM_ACC_STATIC);
     __ movptr(rax, Address(rdi, 0));                                    // get receiver (assume this is frequent case)
     __ jcc(Assembler::zero, done);
-    __ movptr(rax, Address(rbx, methodOopDesc::const_offset()));
-    __ movptr(rax, Address(rax, constMethodOopDesc::constants_offset()));
-    __ movptr(rax, Address(rax, constantPoolOopDesc::pool_holder_offset_in_bytes()));
+    __ movptr(rax, Address(rbx, Method::const_offset()));
+    __ movptr(rax, Address(rax, ConstMethod::constants_offset()));
+    __ movptr(rax, Address(rax, ConstantPool::pool_holder_offset_in_bytes()));
     __ movptr(rax, Address(rax, mirror_offset));
     __ bind(done);
   }
@@ -793,7 +793,7 @@
 
 address InterpreterGenerator::generate_accessor_entry(void) {
 
-  // rbx: methodOop
+  // rbx: Method*
 
   // rsi/r13: senderSP must preserved for slow path, set SP to it on fast path
 
@@ -825,14 +825,14 @@
     __ jcc(Assembler::zero, slow_path);
 
     // read first instruction word and extract bytecode @ 1 and index @ 2
-    __ movptr(rdx, Address(rbx, methodOopDesc::const_offset()));
-    __ movptr(rdi, Address(rdx, constMethodOopDesc::constants_offset()));
-    __ movl(rdx, Address(rdx, constMethodOopDesc::codes_offset()));
+    __ movptr(rdx, Address(rbx, Method::const_offset()));
+    __ movptr(rdi, Address(rdx, ConstMethod::constants_offset()));
+    __ movl(rdx, Address(rdx, ConstMethod::codes_offset()));
     // Shift codes right to get the index on the right.
     // The bytecode fetched looks like <index><0xb4><0x2a>
     __ shrl(rdx, 2*BitsPerByte);
     __ shll(rdx, exact_log2(in_words(ConstantPoolCacheEntry::size())));
-    __ movptr(rdi, Address(rdi, constantPoolOopDesc::cache_offset_in_bytes()));
+    __ movptr(rdi, Address(rdi, ConstantPool::cache_offset_in_bytes()));
 
     // rax,: local 0
     // rbx,: method
@@ -849,7 +849,7 @@
     __ movl(rcx,
             Address(rdi,
                     rdx,
-                    Address::times_ptr, constantPoolCacheOopDesc::base_offset() + ConstantPoolCacheEntry::indices_offset()));
+                    Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::indices_offset()));
     __ shrl(rcx, 2*BitsPerByte);
     __ andl(rcx, 0xFF);
     __ cmpl(rcx, Bytecodes::_getfield);
@@ -859,11 +859,11 @@
     __ movptr(rcx,
             Address(rdi,
                     rdx,
-                    Address::times_ptr, constantPoolCacheOopDesc::base_offset() + ConstantPoolCacheEntry::f2_offset()));
+                    Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::f2_offset()));
     __ movl(rdx,
             Address(rdi,
                     rdx,
-                    Address::times_ptr, constantPoolCacheOopDesc::base_offset() + ConstantPoolCacheEntry::flags_offset()));
+                    Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
 
     Label notByte, notShort, notChar;
     const Address field_address (rax, rcx, Address::times_1);
@@ -970,17 +970,17 @@
   // determine code generation flags
   bool inc_counter  = UseCompiler || CountCompiledCalls;
 
-  // rbx: methodOop
+  // rbx: Method*
   // rcx: receiver (unused)
   // rsi/r13: previous interpreter state (if called from C++ interpreter) must preserve
   //      in any case. If called via c1/c2/call_stub rsi/r13 is junk (to use) but harmless
   //      to save/restore.
   address entry_point = __ pc();
 
-  const Address size_of_parameters(rbx, methodOopDesc::size_of_parameters_offset());
-  const Address size_of_locals    (rbx, methodOopDesc::size_of_locals_offset());
-  const Address invocation_counter(rbx, methodOopDesc::invocation_counter_offset() + InvocationCounter::counter_offset());
-  const Address access_flags      (rbx, methodOopDesc::access_flags_offset());
+  const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
+  const Address size_of_locals    (rbx, Method::size_of_locals_offset());
+  const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
+  const Address access_flags      (rbx, Method::access_flags_offset());
 
   // rsi/r13 == state/locals rdi == prevstate
   const Register locals = rdi;
@@ -988,7 +988,7 @@
   // get parameter size (always needed)
   __ load_unsigned_short(rcx, size_of_parameters);
 
-  // rbx: methodOop
+  // rbx: Method*
   // rcx: size of parameters
   __ pop(rax);                                       // get return address
   // for natives the size of locals is zero
@@ -1111,7 +1111,7 @@
   // allocate space for parameters
   __ movptr(method, STATE(_method));
   __ verify_oop(method);
-  __ load_unsigned_short(t, Address(method, methodOopDesc::size_of_parameters_offset()));
+  __ load_unsigned_short(t, Address(method, Method::size_of_parameters_offset()));
   __ shll(t, 2);
 #ifdef _LP64
   __ subptr(rsp, t);
@@ -1127,7 +1127,7 @@
     Label pending_exception_present;
 
   { Label L;
-    __ movptr(t, Address(method, methodOopDesc::signature_handler_offset()));
+    __ movptr(t, Address(method, Method::signature_handler_offset()));
     __ testptr(t, t);
     __ jcc(Assembler::notZero, L);
     __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::prepare_native_call), method, false);
@@ -1135,7 +1135,7 @@
     __ cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD);
     __ jcc(Assembler::notEqual, pending_exception_present);
     __ verify_oop(method);
-    __ movptr(t, Address(method, methodOopDesc::signature_handler_offset()));
+    __ movptr(t, Address(method, Method::signature_handler_offset()));
     __ bind(L);
   }
 #ifdef ASSERT
@@ -1171,26 +1171,26 @@
 
   // get native function entry point
   { Label L;
-    __ movptr(rax, Address(method, methodOopDesc::native_function_offset()));
+    __ movptr(rax, Address(method, Method::native_function_offset()));
     __ testptr(rax, rax);
     __ jcc(Assembler::notZero, L);
     __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::prepare_native_call), method);
     __ movptr(method, STATE(_method));
     __ verify_oop(method);
-    __ movptr(rax, Address(method, methodOopDesc::native_function_offset()));
+    __ movptr(rax, Address(method, Method::native_function_offset()));
     __ bind(L);
   }
 
   // pass mirror handle if static call
   { Label L;
     const int mirror_offset = in_bytes(Klass::java_mirror_offset());
-    __ movl(t, Address(method, methodOopDesc::access_flags_offset()));
+    __ movl(t, Address(method, Method::access_flags_offset()));
     __ testl(t, JVM_ACC_STATIC);
     __ jcc(Assembler::zero, L);
     // get mirror
-    __ movptr(t, Address(method, methodOopDesc:: const_offset()));
-    __ movptr(t, Address(t, constMethodOopDesc::constants_offset()));
-    __ movptr(t, Address(t, constantPoolOopDesc::pool_holder_offset_in_bytes()));
+    __ movptr(t, Address(method, Method:: const_offset()));
+    __ movptr(t, Address(t, ConstMethod::constants_offset()));
+    __ movptr(t, Address(t, ConstantPool::pool_holder_offset_in_bytes()));
     __ movptr(t, Address(t, mirror_offset));
     // copy mirror into activation object
     __ movptr(STATE(_oop_temp), t);
@@ -1438,7 +1438,7 @@
 
   // do unlocking if necessary
   { Label L;
-    __ movl(t, Address(method, methodOopDesc::access_flags_offset()));
+    __ movl(t, Address(method, Method::access_flags_offset()));
     __ testl(t, JVM_ACC_SYNCHRONIZED);
     __ jcc(Assembler::zero, L);
     // the code below should be shared with interpreter macro assembler implementation
@@ -1634,7 +1634,7 @@
 //
 // Arguments:
 //
-// rbx: methodOop
+// rbx: Method*
 // rcx: receiver - unused (retrieved from stack as needed)
 // rsi/r13: previous frame manager state (NULL from the call_stub/c1/c2)
 //
@@ -1657,7 +1657,7 @@
 
 address InterpreterGenerator::generate_normal_entry(bool synchronized) {
 
-  // rbx: methodOop
+  // rbx: Method*
   // rsi/r13: sender sp
 
   // Because we redispatch "recursive" interpreter entries thru this same entry point
@@ -1700,9 +1700,9 @@
   // save sender sp
   __ push(rcx);
 
-  const Address size_of_parameters(rbx, methodOopDesc::size_of_parameters_offset());
-  const Address size_of_locals    (rbx, methodOopDesc::size_of_locals_offset());
-  const Address access_flags      (rbx, methodOopDesc::access_flags_offset());
+  const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
+  const Address size_of_locals    (rbx, Method::size_of_locals_offset());
+  const Address access_flags      (rbx, Method::access_flags_offset());
 
   // const Address monitor_block_top (rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
   // const Address monitor_block_bot (rbp, frame::interpreter_frame_initial_sp_offset        * wordSize);
@@ -1711,7 +1711,7 @@
   // get parameter size (always needed)
   __ load_unsigned_short(rcx, size_of_parameters);
 
-  // rbx: methodOop
+  // rbx: Method*
   // rcx: size of parameters
   __ load_unsigned_short(rdx, size_of_locals);                     // get size of locals in words
 
@@ -1927,7 +1927,7 @@
   if (UseSSE < 2) {
     __ lea(state, Address(rbp,  -(int)sizeof(BytecodeInterpreter)));
     __ movptr(rbx, STATE(_result._to_call._callee));                   // get method just executed
-    __ movl(rcx, Address(rbx, methodOopDesc::result_index_offset()));
+    __ movl(rcx, Address(rbx, Method::result_index_offset()));
     __ cmpl(rcx, AbstractInterpreter::BasicType_as_index(T_FLOAT));    // Result stub address array index
     __ jcc(Assembler::equal, do_float);
     __ cmpl(rcx, AbstractInterpreter::BasicType_as_index(T_DOUBLE));    // Result stub address array index
@@ -1989,10 +1989,10 @@
   __ movptr(rbx, STATE(_result._to_call._callee));
 
   // callee left args on top of expression stack, remove them
-  __ load_unsigned_short(rcx, Address(rbx, methodOopDesc::size_of_parameters_offset()));
+  __ load_unsigned_short(rcx, Address(rbx, Method::size_of_parameters_offset()));
   __ lea(rsp, Address(rsp, rcx, Address::times_ptr));
 
-  __ movl(rcx, Address(rbx, methodOopDesc::result_index_offset()));
+  __ movl(rcx, Address(rbx, Method::result_index_offset()));
   ExternalAddress tosca_to_stack((address)CppInterpreter::_tosca_to_stack);
   // Address index(noreg, rax, Address::times_ptr);
   __ movptr(rcx, ArrayAddress(tosca_to_stack, Address(noreg, rcx, Address::times_ptr)));
@@ -2019,7 +2019,7 @@
 
   __ movptr(rbx, STATE(_method));                                   // get method just executed
   __ cmpptr(STATE(_prev_link), (int32_t)NULL_WORD);                 // returning from "recursive" interpreter call?
-  __ movl(rax, Address(rbx, methodOopDesc::result_index_offset())); // get result type index
+  __ movl(rax, Address(rbx, Method::result_index_offset())); // get result type index
   __ jcc(Assembler::equal, return_to_initial_caller);               // back to native code (call_stub/c1/c2)
 
   // Copy result to callers java stack
@@ -2253,7 +2253,7 @@
 // Deoptimization helpers for C++ interpreter
 
 // How much stack a method activation needs in words.
-int AbstractInterpreter::size_top_interpreter_activation(methodOop method) {
+int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
 
   const int stub_code = 4;  // see generate_call_stub
   // Save space for one monitor to get into the interpreted method in case
@@ -2267,9 +2267,9 @@
   const int overhead_size = sizeof(BytecodeInterpreter)/wordSize +
     ( frame::sender_sp_offset - frame::link_offset) + 2;
 
-  const int extra_stack = 0; //6815692//methodOopDesc::extra_stack_entries();
+  const int extra_stack = 0; //6815692//Method::extra_stack_entries();
   const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) *
-                           Interpreter::stackElementWords();
+                           Interpreter::stackElementWords;
   return overhead_size + method_stack + stub_code;
 }
 
@@ -2285,7 +2285,7 @@
 void BytecodeInterpreter::layout_interpreterState(interpreterState to_fill,
                                            frame* caller,
                                            frame* current,
-                                           methodOop method,
+                                           Method* method,
                                            intptr_t* locals,
                                            intptr_t* stack,
                                            intptr_t* stack_base,
@@ -2333,7 +2333,7 @@
   // Need +1 here because stack_base points to the word just above the first expr stack entry
   // and stack_limit is supposed to point to the word just below the last expr stack entry.
   // See generate_compute_interpreter_state.
-  int extra_stack = 0; //6815692//methodOopDesc::extra_stack_entries();
+  int extra_stack = 0; //6815692//Method::extra_stack_entries();
   to_fill->_stack_limit = stack_base - (method->max_stack() + extra_stack + 1);
   to_fill->_monitor_base = (BasicObjectLock*) monitor_base;
 
@@ -2342,7 +2342,7 @@
          "Stack top out of range");
 }
 
-int AbstractInterpreter::layout_activation(methodOop method,
+int AbstractInterpreter::layout_activation(Method* method,
                                            int tempcount,  //
                                            int popframe_extra_args,
                                            int moncount,
@@ -2381,7 +2381,7 @@
                                                 monitor_size);
 
   // Now with full size expression stack
-  int extra_stack = 0; //6815692//methodOopDesc::extra_stack_entries();
+  int extra_stack = 0; //6815692//Method::extra_stack_entries();
   int full_frame_size = short_frame_size + (method->max_stack() + extra_stack) * BytesPerWord;
 
   // and now with only live portion of the expression stack