Mercurial > hg > graal-compiler
diff src/cpu/sparc/vm/cppInterpreter_sparc.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 | b2dbd323c668 |
line wrap: on
line diff
--- a/src/cpu/sparc/vm/cppInterpreter_sparc.cpp Fri Aug 31 16:39:35 2012 -0700 +++ b/src/cpu/sparc/vm/cppInterpreter_sparc.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" @@ -405,9 +405,9 @@ void InterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) { // Update standard invocation counters __ increment_invocation_counter(O0, G3_scratch); - if (ProfileInterpreter) { // %%% Merge this into methodDataOop + if (ProfileInterpreter) { // %%% Merge this into MethodData* __ ld_ptr(STATE(_method), G3_scratch); - Address interpreter_invocation_counter(G3_scratch, 0, in_bytes(methodOopDesc::interpreter_invocation_counter_offset())); + Address interpreter_invocation_counter(G3_scratch, 0, in_bytes(Method::interpreter_invocation_counter_offset())); __ ld(interpreter_invocation_counter, G3_scratch); __ inc(G3_scratch); __ st(G3_scratch, interpreter_invocation_counter); @@ -429,8 +429,6 @@ address entry = __ pc(); Label slow_path; - __ verify_oop(G5_method); - // do nothing for empty methods (do not even increment invocation counter) if ( UseFastEmptyMethods) { // If we need a safepoint check, generate full interpreter entry. @@ -481,8 +479,8 @@ // read first instruction word and extract bytecode @ 1 and index @ 2 // get first 4 bytes of the bytecodes (big endian!) - __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc::const_offset())), G1_scratch); - __ ld(Address(G1_scratch, 0, in_bytes(constMethodOopDesc::codes_offset())), G1_scratch); + __ ld_ptr(Address(G5_method, 0, in_bytes(Method::const_offset())), G1_scratch); + __ ld(Address(G1_scratch, 0, in_bytes(ConstMethod::codes_offset())), G1_scratch); // move index @ 2 far left then to the right most two bytes. __ sll(G1_scratch, 2*BitsPerByte, G1_scratch); @@ -490,16 +488,16 @@ ConstantPoolCacheEntry::size()) * BytesPerWord), G1_scratch); // get constant pool cache - __ ld_ptr(G5_method, in_bytes(methodOopDesc::const_offset()), G3_scratch); - __ ld_ptr(G3_scratch, in_bytes(constMethodOopDesc::constants_offset()), G3_scratch); - __ ld_ptr(G3_scratch, constantPoolOopDesc::cache_offset_in_bytes(), G3_scratch); + __ ld_ptr(G5_method, in_bytes(Method::const_offset()), G3_scratch); + __ ld_ptr(G3_scratch, in_bytes(ConstMethod::constants_offset()), G3_scratch); + __ ld_ptr(G3_scratch, ConstantPool::cache_offset_in_bytes(), G3_scratch); // get specific constant pool cache entry __ add(G3_scratch, G1_scratch, G3_scratch); // Check the constant Pool cache entry to see if it has been resolved. // If not, need the slow path. - ByteSize cp_base_offset = constantPoolCacheOopDesc::base_offset(); + ByteSize cp_base_offset = ConstantPoolCache::base_offset(); __ ld_ptr(G3_scratch, in_bytes(cp_base_offset + ConstantPoolCacheEntry::indices_offset()), G1_scratch); __ srl(G1_scratch, 2*BitsPerByte, G1_scratch); __ and3(G1_scratch, 0xFF, G1_scratch); @@ -584,20 +582,18 @@ // the following temporary registers are used during frame creation const Register Gtmp1 = G3_scratch ; const Register Gtmp2 = G1_scratch; - const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset())); + const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); bool inc_counter = UseCompiler || CountCompiledCalls; // make sure registers are different! assert_different_registers(G2_thread, G5_method, Gargs, Gtmp1, Gtmp2); - const Address access_flags (G5_method, 0, in_bytes(methodOopDesc::access_flags_offset())); + const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); Label Lentry; __ bind(Lentry); - __ verify_oop(G5_method); - const Register Glocals_size = G3; assert_different_registers(Glocals_size, G4_scratch, Gframe_size); @@ -711,7 +707,7 @@ { Label L; __ ld_ptr(STATE(_method), G5_method); - __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc::signature_handler_offset())), G3_scratch); + __ ld_ptr(Address(G5_method, 0, in_bytes(Method::signature_handler_offset())), G3_scratch); __ tst(G3_scratch); __ brx(Assembler::notZero, false, Assembler::pt, L); __ delayed()->nop(); @@ -721,7 +717,7 @@ Address exception_addr(G2_thread, 0, in_bytes(Thread::pending_exception_offset())); __ ld_ptr(exception_addr, G3_scratch); __ br_notnull_short(G3_scratch, Assembler::pn, pending_exception_present); - __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc::signature_handler_offset())), G3_scratch); + __ ld_ptr(Address(G5_method, 0, in_bytes(Method::signature_handler_offset())), G3_scratch); __ bind(L); } @@ -765,13 +761,13 @@ __ br( Assembler::zero, false, Assembler::pt, not_static); __ delayed()-> // get native function entry point(O0 is a good temp until the very end) - ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc::native_function_offset())), O0); + ld_ptr(Address(G5_method, 0, in_bytes(Method::native_function_offset())), O0); // for static methods insert the mirror argument const int mirror_offset = in_bytes(Klass::java_mirror_offset()); - __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc:: const_offset())), O1); - __ ld_ptr(Address(O1, 0, in_bytes(constMethodOopDesc::constants_offset())), O1); - __ ld_ptr(Address(O1, 0, constantPoolOopDesc::pool_holder_offset_in_bytes()), O1); + __ ld_ptr(Address(G5_method, 0, in_bytes(Method:: const_offset())), O1); + __ ld_ptr(Address(O1, 0, in_bytes(ConstMethod::constants_offset())), O1); + __ ld_ptr(Address(O1, 0, ConstantPool::pool_holder_offset_in_bytes()), O1); __ ld_ptr(O1, mirror_offset, O1); // where the mirror handle body is allocated: #ifdef ASSERT @@ -1049,11 +1045,11 @@ assert_different_registers(state, prev_state); assert_different_registers(prev_state, G3_scratch); const Register Gtmp = G3_scratch; - const Address constMethod (G5_method, 0, in_bytes(methodOopDesc::const_offset())); - const Address access_flags (G5_method, 0, in_bytes(methodOopDesc::access_flags_offset())); - const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset())); - const Address max_stack (G5_method, 0, in_bytes(methodOopDesc::max_stack_offset())); - const Address size_of_locals (G5_method, 0, in_bytes(methodOopDesc::size_of_locals_offset())); + const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); + const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); + const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); + const Address max_stack (G5_method, 0, in_bytes(Method::max_stack_offset())); + const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); // slop factor is two extra slots on the expression stack so that // we always have room to store a result when returning from a call without parameters @@ -1062,7 +1058,7 @@ const int slop_factor = 2*wordSize; const int fixed_size = ((sizeof(BytecodeInterpreter) + slop_factor) >> LogBytesPerWord) + // what is the slop factor? - //6815692//methodOopDesc::extra_stack_words() + // extra push slots for MH adapters + //6815692//Method::extra_stack_words() + // extra push slots for MH adapters frame::memory_parameter_word_sp_offset + // register save area + param window (native ? frame::interpreter_frame_extra_outgoing_argument_words : 0); // JNI, class @@ -1146,8 +1142,8 @@ if (native) { __ st_ptr(G0, XXX_STATE(_bcp)); } else { - __ ld_ptr(G5_method, in_bytes(methodOopDesc::const_offset()), O2); // get constMethodOop - __ add(O2, in_bytes(constMethodOopDesc::codes_offset()), O2); // get bcp + __ ld_ptr(G5_method, in_bytes(Method::const_offset()), O2); // get ConstMethod* + __ add(O2, in_bytes(ConstMethod::codes_offset()), O2); // get bcp __ st_ptr(O2, XXX_STATE(_bcp)); } @@ -1158,8 +1154,8 @@ __ st(O1, XXX_STATE(_msg)); __ ld_ptr(constMethod, O3); - __ ld_ptr(O3, in_bytes(constMethodOopDesc::constants_offset()), O3); - __ ld_ptr(O3, constantPoolOopDesc::cache_offset_in_bytes(), O2); + __ ld_ptr(O3, in_bytes(ConstMethod::constants_offset()), O3); + __ ld_ptr(O3, ConstantPool::cache_offset_in_bytes(), O2); __ st_ptr(O2, XXX_STATE(_constants)); __ st_ptr(G0, XXX_STATE(_result._to_call._callee)); @@ -1182,9 +1178,9 @@ __ br( Assembler::zero, true, Assembler::pt, got_obj); __ delayed()->ld_ptr(O1, 0, O1); // get receiver for not-static case __ ld_ptr(constMethod, O1); - __ ld_ptr( O1, in_bytes(constMethodOopDesc::constants_offset()), O1); - __ ld_ptr( O1, constantPoolOopDesc::pool_holder_offset_in_bytes(), O1); - // lock the mirror, not the klassOop + __ ld_ptr( O1, in_bytes(ConstMethod::constants_offset()), O1); + __ ld_ptr( O1, ConstantPool::pool_holder_offset_in_bytes(), O1); + // lock the mirror, not the Klass* __ ld_ptr( O1, mirror_offset, O1); __ bind(got_obj); @@ -1213,7 +1209,7 @@ __ lduh(max_stack, O3); // Full size expression stack guarantee(!EnableInvokeDynamic, "no support yet for java.lang.invoke.MethodHandle"); //6815692 //6815692//if (EnableInvokeDynamic) - //6815692// __ inc(O3, methodOopDesc::extra_stack_entries()); + //6815692// __ inc(O3, Method::extra_stack_entries()); __ sll(O3, LogBytesPerWord, O3); __ sub(O2, O3, O3); // __ sub(O3, wordSize, O3); // so prepush doesn't look out of bounds @@ -1267,7 +1263,7 @@ #ifdef ASSERT __ ld_ptr(STATE(_method), L2_scratch); - __ ld(L2_scratch, in_bytes(methodOopDesc::access_flags_offset()), O0); + __ ld(L2_scratch, in_bytes(Method::access_flags_offset()), O0); { Label ok; __ btst(JVM_ACC_SYNCHRONIZED, O0); @@ -1436,7 +1432,7 @@ // // Arguments: // -// ebx: methodOop +// ebx: Method* // ecx: receiver - unused (retrieved from stack as needed) // esi: previous frame manager state (NULL from the call_stub/c1/c2) // @@ -1485,8 +1481,8 @@ // assert_different_registers(state, prev_state); const Register Gtmp = G3_scratch; const Register tmp = O2; - const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset())); - const Address size_of_locals (G5_method, 0, in_bytes(methodOopDesc::size_of_locals_offset())); + const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); + const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); __ lduh(size_of_parameters, tmp); __ sll(tmp, LogBytesPerWord, Gtmp); // parameter size in bytes @@ -1520,7 +1516,7 @@ address InterpreterGenerator::generate_normal_entry(bool synchronized) { - // G5_method: methodOop + // G5_method: Method* // G2_thread: thread (unused) // Gargs: bottom of args (sender_sp) // O5: sender's sp @@ -1540,11 +1536,11 @@ const Register Gtmp1 = G3_scratch; // const Register Lmirror = L1; // native mirror (native calls only) - const Address constMethod (G5_method, 0, in_bytes(methodOopDesc::const_offset())); - const Address access_flags (G5_method, 0, in_bytes(methodOopDesc::access_flags_offset())); - const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset())); - const Address max_stack (G5_method, 0, in_bytes(methodOopDesc::max_stack_offset())); - const Address size_of_locals (G5_method, 0, in_bytes(methodOopDesc::size_of_locals_offset())); + const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); + const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); + const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); + const Address max_stack (G5_method, 0, in_bytes(Method::max_stack_offset())); + const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); address entry_point = __ pc(); __ mov(G0, prevState); // no current activation @@ -1701,7 +1697,7 @@ __ verify_thread(); __ st_ptr(O0, exception_addr); - // get the methodOop + // get the Method* __ ld_ptr(STATE(_method), G5_method); // if this current frame vanilla or native? @@ -1752,10 +1748,10 @@ __ ld_ptr(STATE(_result._to_call._callee), L4_scratch); // called method __ ld_ptr(STATE(_stack), L1_scratch); // get top of java expr stack - __ lduh(L4_scratch, in_bytes(methodOopDesc::size_of_parameters_offset()), L2_scratch); // get parameter size + __ lduh(L4_scratch, in_bytes(Method::size_of_parameters_offset()), L2_scratch); // get parameter size __ sll(L2_scratch, LogBytesPerWord, L2_scratch ); // parameter size in bytes __ add(L1_scratch, L2_scratch, L1_scratch); // stack destination for result - __ ld(L4_scratch, in_bytes(methodOopDesc::result_index_offset()), L3_scratch); // called method result type index + __ ld(L4_scratch, in_bytes(Method::result_index_offset()), L3_scratch); // called method result type index // tosca is really just native abi __ set((intptr_t)CppInterpreter::_tosca_to_stack, L4_scratch); @@ -1799,7 +1795,7 @@ __ ld_ptr(STATE(_prev_link), L1_scratch); __ ld_ptr(STATE(_method), L2_scratch); // get method just executed - __ ld(L2_scratch, in_bytes(methodOopDesc::result_index_offset()), L2_scratch); + __ ld(L2_scratch, in_bytes(Method::result_index_offset()), L2_scratch); __ tst(L1_scratch); __ brx(Assembler::zero, false, Assembler::pt, return_to_initial_caller); __ delayed()->sll(L2_scratch, LogBytesPerWord, L2_scratch); @@ -2068,17 +2064,17 @@ const int fixed_size = sizeof(BytecodeInterpreter)/wordSize + // interpreter state object frame::memory_parameter_word_sp_offset; // register save area + param window - const int extra_stack = 0; //6815692//methodOopDesc::extra_stack_entries(); + const int extra_stack = 0; //6815692//Method::extra_stack_entries(); return (round_to(max_stack + extra_stack + slop_factor + fixed_size + monitor_size + - (callee_extra_locals * Interpreter::stackElementWords()), WordsPerLong)); + (callee_extra_locals * Interpreter::stackElementWords), WordsPerLong)); } -int AbstractInterpreter::size_top_interpreter_activation(methodOop method) { +int AbstractInterpreter::size_top_interpreter_activation(Method* method) { // See call_stub code int call_stub_size = round_to(7 + frame::memory_parameter_word_sp_offset, @@ -2095,7 +2091,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, @@ -2157,7 +2153,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() + 1 + extra_stack); to_fill->_monitor_base = (BasicObjectLock*) monitor_base; @@ -2175,7 +2171,7 @@ } -int AbstractInterpreter::layout_activation(methodOop method, +int AbstractInterpreter::layout_activation(Method* method, int tempcount, // Number of slots on java expression stack in use int popframe_extra_args, int moncount, // Number of active monitors @@ -2255,7 +2251,7 @@ // statement is needed. // intptr_t* fp = interpreter_frame->fp(); - int local_words = method->max_locals() * Interpreter::stackElementWords(); + int local_words = method->max_locals() * Interpreter::stackElementWords; if (caller->is_compiled_frame()) { locals = fp + frame::register_save_words + local_words - 1;