28 #include "interpreter/cppInterpreter.hpp" |
28 #include "interpreter/cppInterpreter.hpp" |
29 #include "interpreter/interpreter.hpp" |
29 #include "interpreter/interpreter.hpp" |
30 #include "interpreter/interpreterGenerator.hpp" |
30 #include "interpreter/interpreterGenerator.hpp" |
31 #include "interpreter/interpreterRuntime.hpp" |
31 #include "interpreter/interpreterRuntime.hpp" |
32 #include "oops/arrayOop.hpp" |
32 #include "oops/arrayOop.hpp" |
33 #include "oops/methodDataOop.hpp" |
33 #include "oops/methodData.hpp" |
34 #include "oops/methodOop.hpp" |
34 #include "oops/method.hpp" |
35 #include "oops/oop.inline.hpp" |
35 #include "oops/oop.inline.hpp" |
36 #include "prims/jvmtiExport.hpp" |
36 #include "prims/jvmtiExport.hpp" |
37 #include "prims/jvmtiThreadState.hpp" |
37 #include "prims/jvmtiThreadState.hpp" |
38 #include "runtime/arguments.hpp" |
38 #include "runtime/arguments.hpp" |
39 #include "runtime/deoptimization.hpp" |
39 #include "runtime/deoptimization.hpp" |
403 // ??: invocation counter |
403 // ??: invocation counter |
404 // |
404 // |
405 void InterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) { |
405 void InterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) { |
406 // Update standard invocation counters |
406 // Update standard invocation counters |
407 __ increment_invocation_counter(O0, G3_scratch); |
407 __ increment_invocation_counter(O0, G3_scratch); |
408 if (ProfileInterpreter) { // %%% Merge this into methodDataOop |
408 if (ProfileInterpreter) { // %%% Merge this into MethodData* |
409 __ ld_ptr(STATE(_method), G3_scratch); |
409 __ ld_ptr(STATE(_method), G3_scratch); |
410 Address interpreter_invocation_counter(G3_scratch, 0, in_bytes(methodOopDesc::interpreter_invocation_counter_offset())); |
410 Address interpreter_invocation_counter(G3_scratch, 0, in_bytes(Method::interpreter_invocation_counter_offset())); |
411 __ ld(interpreter_invocation_counter, G3_scratch); |
411 __ ld(interpreter_invocation_counter, G3_scratch); |
412 __ inc(G3_scratch); |
412 __ inc(G3_scratch); |
413 __ st(G3_scratch, interpreter_invocation_counter); |
413 __ st(G3_scratch, interpreter_invocation_counter); |
414 } |
414 } |
415 |
415 |
426 |
426 |
427 // A method that does nothing but return... |
427 // A method that does nothing but return... |
428 |
428 |
429 address entry = __ pc(); |
429 address entry = __ pc(); |
430 Label slow_path; |
430 Label slow_path; |
431 |
|
432 __ verify_oop(G5_method); |
|
433 |
431 |
434 // do nothing for empty methods (do not even increment invocation counter) |
432 // do nothing for empty methods (do not even increment invocation counter) |
435 if ( UseFastEmptyMethods) { |
433 if ( UseFastEmptyMethods) { |
436 // If we need a safepoint check, generate full interpreter entry. |
434 // If we need a safepoint check, generate full interpreter entry. |
437 Address sync_state(G3_scratch, SafepointSynchronize::address_of_state()); |
435 Address sync_state(G3_scratch, SafepointSynchronize::address_of_state()); |
479 __ delayed()->nop(); |
477 __ delayed()->nop(); |
480 |
478 |
481 |
479 |
482 // read first instruction word and extract bytecode @ 1 and index @ 2 |
480 // read first instruction word and extract bytecode @ 1 and index @ 2 |
483 // get first 4 bytes of the bytecodes (big endian!) |
481 // get first 4 bytes of the bytecodes (big endian!) |
484 __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc::const_offset())), G1_scratch); |
482 __ ld_ptr(Address(G5_method, 0, in_bytes(Method::const_offset())), G1_scratch); |
485 __ ld(Address(G1_scratch, 0, in_bytes(constMethodOopDesc::codes_offset())), G1_scratch); |
483 __ ld(Address(G1_scratch, 0, in_bytes(ConstMethod::codes_offset())), G1_scratch); |
486 |
484 |
487 // move index @ 2 far left then to the right most two bytes. |
485 // move index @ 2 far left then to the right most two bytes. |
488 __ sll(G1_scratch, 2*BitsPerByte, G1_scratch); |
486 __ sll(G1_scratch, 2*BitsPerByte, G1_scratch); |
489 __ srl(G1_scratch, 2*BitsPerByte - exact_log2(in_words( |
487 __ srl(G1_scratch, 2*BitsPerByte - exact_log2(in_words( |
490 ConstantPoolCacheEntry::size()) * BytesPerWord), G1_scratch); |
488 ConstantPoolCacheEntry::size()) * BytesPerWord), G1_scratch); |
491 |
489 |
492 // get constant pool cache |
490 // get constant pool cache |
493 __ ld_ptr(G5_method, in_bytes(methodOopDesc::const_offset()), G3_scratch); |
491 __ ld_ptr(G5_method, in_bytes(Method::const_offset()), G3_scratch); |
494 __ ld_ptr(G3_scratch, in_bytes(constMethodOopDesc::constants_offset()), G3_scratch); |
492 __ ld_ptr(G3_scratch, in_bytes(ConstMethod::constants_offset()), G3_scratch); |
495 __ ld_ptr(G3_scratch, constantPoolOopDesc::cache_offset_in_bytes(), G3_scratch); |
493 __ ld_ptr(G3_scratch, ConstantPool::cache_offset_in_bytes(), G3_scratch); |
496 |
494 |
497 // get specific constant pool cache entry |
495 // get specific constant pool cache entry |
498 __ add(G3_scratch, G1_scratch, G3_scratch); |
496 __ add(G3_scratch, G1_scratch, G3_scratch); |
499 |
497 |
500 // Check the constant Pool cache entry to see if it has been resolved. |
498 // Check the constant Pool cache entry to see if it has been resolved. |
501 // If not, need the slow path. |
499 // If not, need the slow path. |
502 ByteSize cp_base_offset = constantPoolCacheOopDesc::base_offset(); |
500 ByteSize cp_base_offset = ConstantPoolCache::base_offset(); |
503 __ ld_ptr(G3_scratch, in_bytes(cp_base_offset + ConstantPoolCacheEntry::indices_offset()), G1_scratch); |
501 __ ld_ptr(G3_scratch, in_bytes(cp_base_offset + ConstantPoolCacheEntry::indices_offset()), G1_scratch); |
504 __ srl(G1_scratch, 2*BitsPerByte, G1_scratch); |
502 __ srl(G1_scratch, 2*BitsPerByte, G1_scratch); |
505 __ and3(G1_scratch, 0xFF, G1_scratch); |
503 __ and3(G1_scratch, 0xFF, G1_scratch); |
506 __ cmp(G1_scratch, Bytecodes::_getfield); |
504 __ cmp(G1_scratch, Bytecodes::_getfield); |
507 __ br(Assembler::notEqual, false, Assembler::pn, slow_path); |
505 __ br(Assembler::notEqual, false, Assembler::pn, slow_path); |
582 address entry = __ pc(); |
580 address entry = __ pc(); |
583 |
581 |
584 // the following temporary registers are used during frame creation |
582 // the following temporary registers are used during frame creation |
585 const Register Gtmp1 = G3_scratch ; |
583 const Register Gtmp1 = G3_scratch ; |
586 const Register Gtmp2 = G1_scratch; |
584 const Register Gtmp2 = G1_scratch; |
587 const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset())); |
585 const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); |
588 |
586 |
589 bool inc_counter = UseCompiler || CountCompiledCalls; |
587 bool inc_counter = UseCompiler || CountCompiledCalls; |
590 |
588 |
591 // make sure registers are different! |
589 // make sure registers are different! |
592 assert_different_registers(G2_thread, G5_method, Gargs, Gtmp1, Gtmp2); |
590 assert_different_registers(G2_thread, G5_method, Gargs, Gtmp1, Gtmp2); |
593 |
591 |
594 const Address access_flags (G5_method, 0, in_bytes(methodOopDesc::access_flags_offset())); |
592 const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); |
595 |
593 |
596 Label Lentry; |
594 Label Lentry; |
597 __ bind(Lentry); |
595 __ bind(Lentry); |
598 |
|
599 __ verify_oop(G5_method); |
|
600 |
596 |
601 const Register Glocals_size = G3; |
597 const Register Glocals_size = G3; |
602 assert_different_registers(Glocals_size, G4_scratch, Gframe_size); |
598 assert_different_registers(Glocals_size, G4_scratch, Gframe_size); |
603 |
599 |
604 // make sure method is native & not abstract |
600 // make sure method is native & not abstract |
709 |
705 |
710 Label pending_exception_present; |
706 Label pending_exception_present; |
711 |
707 |
712 { Label L; |
708 { Label L; |
713 __ ld_ptr(STATE(_method), G5_method); |
709 __ ld_ptr(STATE(_method), G5_method); |
714 __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc::signature_handler_offset())), G3_scratch); |
710 __ ld_ptr(Address(G5_method, 0, in_bytes(Method::signature_handler_offset())), G3_scratch); |
715 __ tst(G3_scratch); |
711 __ tst(G3_scratch); |
716 __ brx(Assembler::notZero, false, Assembler::pt, L); |
712 __ brx(Assembler::notZero, false, Assembler::pt, L); |
717 __ delayed()->nop(); |
713 __ delayed()->nop(); |
718 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::prepare_native_call), G5_method, false); |
714 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::prepare_native_call), G5_method, false); |
719 __ ld_ptr(STATE(_method), G5_method); |
715 __ ld_ptr(STATE(_method), G5_method); |
720 |
716 |
721 Address exception_addr(G2_thread, 0, in_bytes(Thread::pending_exception_offset())); |
717 Address exception_addr(G2_thread, 0, in_bytes(Thread::pending_exception_offset())); |
722 __ ld_ptr(exception_addr, G3_scratch); |
718 __ ld_ptr(exception_addr, G3_scratch); |
723 __ br_notnull_short(G3_scratch, Assembler::pn, pending_exception_present); |
719 __ br_notnull_short(G3_scratch, Assembler::pn, pending_exception_present); |
724 __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc::signature_handler_offset())), G3_scratch); |
720 __ ld_ptr(Address(G5_method, 0, in_bytes(Method::signature_handler_offset())), G3_scratch); |
725 __ bind(L); |
721 __ bind(L); |
726 } |
722 } |
727 |
723 |
728 // Push a new frame so that the args will really be stored in |
724 // Push a new frame so that the args will really be stored in |
729 // Copy a few locals across so the new frame has the variables |
725 // Copy a few locals across so the new frame has the variables |
763 __ ld(access_flags, O0); |
759 __ ld(access_flags, O0); |
764 __ btst(JVM_ACC_STATIC, O0); |
760 __ btst(JVM_ACC_STATIC, O0); |
765 __ br( Assembler::zero, false, Assembler::pt, not_static); |
761 __ br( Assembler::zero, false, Assembler::pt, not_static); |
766 __ delayed()-> |
762 __ delayed()-> |
767 // get native function entry point(O0 is a good temp until the very end) |
763 // get native function entry point(O0 is a good temp until the very end) |
768 ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc::native_function_offset())), O0); |
764 ld_ptr(Address(G5_method, 0, in_bytes(Method::native_function_offset())), O0); |
769 // for static methods insert the mirror argument |
765 // for static methods insert the mirror argument |
770 const int mirror_offset = in_bytes(Klass::java_mirror_offset()); |
766 const int mirror_offset = in_bytes(Klass::java_mirror_offset()); |
771 |
767 |
772 __ ld_ptr(Address(G5_method, 0, in_bytes(methodOopDesc:: const_offset())), O1); |
768 __ ld_ptr(Address(G5_method, 0, in_bytes(Method:: const_offset())), O1); |
773 __ ld_ptr(Address(O1, 0, in_bytes(constMethodOopDesc::constants_offset())), O1); |
769 __ ld_ptr(Address(O1, 0, in_bytes(ConstMethod::constants_offset())), O1); |
774 __ ld_ptr(Address(O1, 0, constantPoolOopDesc::pool_holder_offset_in_bytes()), O1); |
770 __ ld_ptr(Address(O1, 0, ConstantPool::pool_holder_offset_in_bytes()), O1); |
775 __ ld_ptr(O1, mirror_offset, O1); |
771 __ ld_ptr(O1, mirror_offset, O1); |
776 // where the mirror handle body is allocated: |
772 // where the mirror handle body is allocated: |
777 #ifdef ASSERT |
773 #ifdef ASSERT |
778 if (!PrintSignatureHandlers) // do not dirty the output with this |
774 if (!PrintSignatureHandlers) // do not dirty the output with this |
779 { Label L; |
775 { Label L; |
1047 // a new interpretState object and the method expression stack. |
1043 // a new interpretState object and the method expression stack. |
1048 |
1044 |
1049 assert_different_registers(state, prev_state); |
1045 assert_different_registers(state, prev_state); |
1050 assert_different_registers(prev_state, G3_scratch); |
1046 assert_different_registers(prev_state, G3_scratch); |
1051 const Register Gtmp = G3_scratch; |
1047 const Register Gtmp = G3_scratch; |
1052 const Address constMethod (G5_method, 0, in_bytes(methodOopDesc::const_offset())); |
1048 const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); |
1053 const Address access_flags (G5_method, 0, in_bytes(methodOopDesc::access_flags_offset())); |
1049 const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); |
1054 const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset())); |
1050 const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); |
1055 const Address max_stack (G5_method, 0, in_bytes(methodOopDesc::max_stack_offset())); |
1051 const Address max_stack (G5_method, 0, in_bytes(Method::max_stack_offset())); |
1056 const Address size_of_locals (G5_method, 0, in_bytes(methodOopDesc::size_of_locals_offset())); |
1052 const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); |
1057 |
1053 |
1058 // slop factor is two extra slots on the expression stack so that |
1054 // slop factor is two extra slots on the expression stack so that |
1059 // we always have room to store a result when returning from a call without parameters |
1055 // we always have room to store a result when returning from a call without parameters |
1060 // that returns a result. |
1056 // that returns a result. |
1061 |
1057 |
1062 const int slop_factor = 2*wordSize; |
1058 const int slop_factor = 2*wordSize; |
1063 |
1059 |
1064 const int fixed_size = ((sizeof(BytecodeInterpreter) + slop_factor) >> LogBytesPerWord) + // what is the slop factor? |
1060 const int fixed_size = ((sizeof(BytecodeInterpreter) + slop_factor) >> LogBytesPerWord) + // what is the slop factor? |
1065 //6815692//methodOopDesc::extra_stack_words() + // extra push slots for MH adapters |
1061 //6815692//Method::extra_stack_words() + // extra push slots for MH adapters |
1066 frame::memory_parameter_word_sp_offset + // register save area + param window |
1062 frame::memory_parameter_word_sp_offset + // register save area + param window |
1067 (native ? frame::interpreter_frame_extra_outgoing_argument_words : 0); // JNI, class |
1063 (native ? frame::interpreter_frame_extra_outgoing_argument_words : 0); // JNI, class |
1068 |
1064 |
1069 // XXX G5_method valid |
1065 // XXX G5_method valid |
1070 |
1066 |
1144 __ st_ptr(G2_thread, XXX_STATE(_thread)); // Store javathread |
1140 __ st_ptr(G2_thread, XXX_STATE(_thread)); // Store javathread |
1145 |
1141 |
1146 if (native) { |
1142 if (native) { |
1147 __ st_ptr(G0, XXX_STATE(_bcp)); |
1143 __ st_ptr(G0, XXX_STATE(_bcp)); |
1148 } else { |
1144 } else { |
1149 __ ld_ptr(G5_method, in_bytes(methodOopDesc::const_offset()), O2); // get constMethodOop |
1145 __ ld_ptr(G5_method, in_bytes(Method::const_offset()), O2); // get ConstMethod* |
1150 __ add(O2, in_bytes(constMethodOopDesc::codes_offset()), O2); // get bcp |
1146 __ add(O2, in_bytes(ConstMethod::codes_offset()), O2); // get bcp |
1151 __ st_ptr(O2, XXX_STATE(_bcp)); |
1147 __ st_ptr(O2, XXX_STATE(_bcp)); |
1152 } |
1148 } |
1153 |
1149 |
1154 __ st_ptr(G0, XXX_STATE(_mdx)); |
1150 __ st_ptr(G0, XXX_STATE(_mdx)); |
1155 __ st_ptr(G5_method, XXX_STATE(_method)); |
1151 __ st_ptr(G5_method, XXX_STATE(_method)); |
1156 |
1152 |
1157 __ set((int) BytecodeInterpreter::method_entry, O1); |
1153 __ set((int) BytecodeInterpreter::method_entry, O1); |
1158 __ st(O1, XXX_STATE(_msg)); |
1154 __ st(O1, XXX_STATE(_msg)); |
1159 |
1155 |
1160 __ ld_ptr(constMethod, O3); |
1156 __ ld_ptr(constMethod, O3); |
1161 __ ld_ptr(O3, in_bytes(constMethodOopDesc::constants_offset()), O3); |
1157 __ ld_ptr(O3, in_bytes(ConstMethod::constants_offset()), O3); |
1162 __ ld_ptr(O3, constantPoolOopDesc::cache_offset_in_bytes(), O2); |
1158 __ ld_ptr(O3, ConstantPool::cache_offset_in_bytes(), O2); |
1163 __ st_ptr(O2, XXX_STATE(_constants)); |
1159 __ st_ptr(O2, XXX_STATE(_constants)); |
1164 |
1160 |
1165 __ st_ptr(G0, XXX_STATE(_result._to_call._callee)); |
1161 __ st_ptr(G0, XXX_STATE(_result._to_call._callee)); |
1166 |
1162 |
1167 // Monitor base is just start of BytecodeInterpreter object; |
1163 // Monitor base is just start of BytecodeInterpreter object; |
1180 __ delayed()->btst(JVM_ACC_STATIC, O1); |
1176 __ delayed()->btst(JVM_ACC_STATIC, O1); |
1181 __ ld_ptr(XXX_STATE(_locals), O1); |
1177 __ ld_ptr(XXX_STATE(_locals), O1); |
1182 __ br( Assembler::zero, true, Assembler::pt, got_obj); |
1178 __ br( Assembler::zero, true, Assembler::pt, got_obj); |
1183 __ delayed()->ld_ptr(O1, 0, O1); // get receiver for not-static case |
1179 __ delayed()->ld_ptr(O1, 0, O1); // get receiver for not-static case |
1184 __ ld_ptr(constMethod, O1); |
1180 __ ld_ptr(constMethod, O1); |
1185 __ ld_ptr( O1, in_bytes(constMethodOopDesc::constants_offset()), O1); |
1181 __ ld_ptr( O1, in_bytes(ConstMethod::constants_offset()), O1); |
1186 __ ld_ptr( O1, constantPoolOopDesc::pool_holder_offset_in_bytes(), O1); |
1182 __ ld_ptr( O1, ConstantPool::pool_holder_offset_in_bytes(), O1); |
1187 // lock the mirror, not the klassOop |
1183 // lock the mirror, not the Klass* |
1188 __ ld_ptr( O1, mirror_offset, O1); |
1184 __ ld_ptr( O1, mirror_offset, O1); |
1189 |
1185 |
1190 __ bind(got_obj); |
1186 __ bind(got_obj); |
1191 |
1187 |
1192 #ifdef ASSERT |
1188 #ifdef ASSERT |
1211 __ st_ptr(O2, XXX_STATE(_stack)); // PREPUSH |
1207 __ st_ptr(O2, XXX_STATE(_stack)); // PREPUSH |
1212 |
1208 |
1213 __ lduh(max_stack, O3); // Full size expression stack |
1209 __ lduh(max_stack, O3); // Full size expression stack |
1214 guarantee(!EnableInvokeDynamic, "no support yet for java.lang.invoke.MethodHandle"); //6815692 |
1210 guarantee(!EnableInvokeDynamic, "no support yet for java.lang.invoke.MethodHandle"); //6815692 |
1215 //6815692//if (EnableInvokeDynamic) |
1211 //6815692//if (EnableInvokeDynamic) |
1216 //6815692// __ inc(O3, methodOopDesc::extra_stack_entries()); |
1212 //6815692// __ inc(O3, Method::extra_stack_entries()); |
1217 __ sll(O3, LogBytesPerWord, O3); |
1213 __ sll(O3, LogBytesPerWord, O3); |
1218 __ sub(O2, O3, O3); |
1214 __ sub(O2, O3, O3); |
1219 // __ sub(O3, wordSize, O3); // so prepush doesn't look out of bounds |
1215 // __ sub(O3, wordSize, O3); // so prepush doesn't look out of bounds |
1220 __ st_ptr(O3, XXX_STATE(_stack_limit)); |
1216 __ st_ptr(O3, XXX_STATE(_stack_limit)); |
1221 |
1217 |
1265 // |
1261 // |
1266 // Find everything relative to Lstate |
1262 // Find everything relative to Lstate |
1267 |
1263 |
1268 #ifdef ASSERT |
1264 #ifdef ASSERT |
1269 __ ld_ptr(STATE(_method), L2_scratch); |
1265 __ ld_ptr(STATE(_method), L2_scratch); |
1270 __ ld(L2_scratch, in_bytes(methodOopDesc::access_flags_offset()), O0); |
1266 __ ld(L2_scratch, in_bytes(Method::access_flags_offset()), O0); |
1271 |
1267 |
1272 { Label ok; |
1268 { Label ok; |
1273 __ btst(JVM_ACC_SYNCHRONIZED, O0); |
1269 __ btst(JVM_ACC_SYNCHRONIZED, O0); |
1274 __ br( Assembler::notZero, false, Assembler::pt, ok); |
1270 __ br( Assembler::notZero, false, Assembler::pt, ok); |
1275 __ delayed()->nop(); |
1271 __ delayed()->nop(); |
1483 // In/Out O5_savedSP (sender's original SP) |
1479 // In/Out O5_savedSP (sender's original SP) |
1484 // |
1480 // |
1485 // assert_different_registers(state, prev_state); |
1481 // assert_different_registers(state, prev_state); |
1486 const Register Gtmp = G3_scratch; |
1482 const Register Gtmp = G3_scratch; |
1487 const Register tmp = O2; |
1483 const Register tmp = O2; |
1488 const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset())); |
1484 const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); |
1489 const Address size_of_locals (G5_method, 0, in_bytes(methodOopDesc::size_of_locals_offset())); |
1485 const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); |
1490 |
1486 |
1491 __ lduh(size_of_parameters, tmp); |
1487 __ lduh(size_of_parameters, tmp); |
1492 __ sll(tmp, LogBytesPerWord, Gtmp); // parameter size in bytes |
1488 __ sll(tmp, LogBytesPerWord, Gtmp); // parameter size in bytes |
1493 __ add(args, Gtmp, Gargs); // points to first local + BytesPerWord |
1489 __ add(args, Gtmp, Gargs); // points to first local + BytesPerWord |
1494 // NEW |
1490 // NEW |
1538 |
1534 |
1539 // the following temporary registers are used during frame creation |
1535 // the following temporary registers are used during frame creation |
1540 const Register Gtmp1 = G3_scratch; |
1536 const Register Gtmp1 = G3_scratch; |
1541 // const Register Lmirror = L1; // native mirror (native calls only) |
1537 // const Register Lmirror = L1; // native mirror (native calls only) |
1542 |
1538 |
1543 const Address constMethod (G5_method, 0, in_bytes(methodOopDesc::const_offset())); |
1539 const Address constMethod (G5_method, 0, in_bytes(Method::const_offset())); |
1544 const Address access_flags (G5_method, 0, in_bytes(methodOopDesc::access_flags_offset())); |
1540 const Address access_flags (G5_method, 0, in_bytes(Method::access_flags_offset())); |
1545 const Address size_of_parameters(G5_method, 0, in_bytes(methodOopDesc::size_of_parameters_offset())); |
1541 const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset())); |
1546 const Address max_stack (G5_method, 0, in_bytes(methodOopDesc::max_stack_offset())); |
1542 const Address max_stack (G5_method, 0, in_bytes(Method::max_stack_offset())); |
1547 const Address size_of_locals (G5_method, 0, in_bytes(methodOopDesc::size_of_locals_offset())); |
1543 const Address size_of_locals (G5_method, 0, in_bytes(Method::size_of_locals_offset())); |
1548 |
1544 |
1549 address entry_point = __ pc(); |
1545 address entry_point = __ pc(); |
1550 __ mov(G0, prevState); // no current activation |
1546 __ mov(G0, prevState); // no current activation |
1551 |
1547 |
1552 |
1548 |
1750 |
1746 |
1751 // Process the native abi result to java expression stack |
1747 // Process the native abi result to java expression stack |
1752 |
1748 |
1753 __ ld_ptr(STATE(_result._to_call._callee), L4_scratch); // called method |
1749 __ ld_ptr(STATE(_result._to_call._callee), L4_scratch); // called method |
1754 __ ld_ptr(STATE(_stack), L1_scratch); // get top of java expr stack |
1750 __ ld_ptr(STATE(_stack), L1_scratch); // get top of java expr stack |
1755 __ lduh(L4_scratch, in_bytes(methodOopDesc::size_of_parameters_offset()), L2_scratch); // get parameter size |
1751 __ lduh(L4_scratch, in_bytes(Method::size_of_parameters_offset()), L2_scratch); // get parameter size |
1756 __ sll(L2_scratch, LogBytesPerWord, L2_scratch ); // parameter size in bytes |
1752 __ sll(L2_scratch, LogBytesPerWord, L2_scratch ); // parameter size in bytes |
1757 __ add(L1_scratch, L2_scratch, L1_scratch); // stack destination for result |
1753 __ add(L1_scratch, L2_scratch, L1_scratch); // stack destination for result |
1758 __ ld(L4_scratch, in_bytes(methodOopDesc::result_index_offset()), L3_scratch); // called method result type index |
1754 __ ld(L4_scratch, in_bytes(Method::result_index_offset()), L3_scratch); // called method result type index |
1759 |
1755 |
1760 // tosca is really just native abi |
1756 // tosca is really just native abi |
1761 __ set((intptr_t)CppInterpreter::_tosca_to_stack, L4_scratch); |
1757 __ set((intptr_t)CppInterpreter::_tosca_to_stack, L4_scratch); |
1762 __ sll(L3_scratch, LogBytesPerWord, L3_scratch); |
1758 __ sll(L3_scratch, LogBytesPerWord, L3_scratch); |
1763 __ ld_ptr(L4_scratch, L3_scratch, Lscratch); // get typed result converter address |
1759 __ ld_ptr(L4_scratch, L3_scratch, Lscratch); // get typed result converter address |
1797 // other thing that makes it easy is that the top of the caller's stack is stored in STATE(_locals) |
1793 // other thing that makes it easy is that the top of the caller's stack is stored in STATE(_locals) |
1798 // for the current activation |
1794 // for the current activation |
1799 |
1795 |
1800 __ ld_ptr(STATE(_prev_link), L1_scratch); |
1796 __ ld_ptr(STATE(_prev_link), L1_scratch); |
1801 __ ld_ptr(STATE(_method), L2_scratch); // get method just executed |
1797 __ ld_ptr(STATE(_method), L2_scratch); // get method just executed |
1802 __ ld(L2_scratch, in_bytes(methodOopDesc::result_index_offset()), L2_scratch); |
1798 __ ld(L2_scratch, in_bytes(Method::result_index_offset()), L2_scratch); |
1803 __ tst(L1_scratch); |
1799 __ tst(L1_scratch); |
1804 __ brx(Assembler::zero, false, Assembler::pt, return_to_initial_caller); |
1800 __ brx(Assembler::zero, false, Assembler::pt, return_to_initial_caller); |
1805 __ delayed()->sll(L2_scratch, LogBytesPerWord, L2_scratch); |
1801 __ delayed()->sll(L2_scratch, LogBytesPerWord, L2_scratch); |
1806 |
1802 |
1807 // Copy result to callers java stack |
1803 // Copy result to callers java stack |
2066 // is "slop_factor" here. |
2062 // is "slop_factor" here. |
2067 const int slop_factor = 2; |
2063 const int slop_factor = 2; |
2068 |
2064 |
2069 const int fixed_size = sizeof(BytecodeInterpreter)/wordSize + // interpreter state object |
2065 const int fixed_size = sizeof(BytecodeInterpreter)/wordSize + // interpreter state object |
2070 frame::memory_parameter_word_sp_offset; // register save area + param window |
2066 frame::memory_parameter_word_sp_offset; // register save area + param window |
2071 const int extra_stack = 0; //6815692//methodOopDesc::extra_stack_entries(); |
2067 const int extra_stack = 0; //6815692//Method::extra_stack_entries(); |
2072 return (round_to(max_stack + |
2068 return (round_to(max_stack + |
2073 extra_stack + |
2069 extra_stack + |
2074 slop_factor + |
2070 slop_factor + |
2075 fixed_size + |
2071 fixed_size + |
2076 monitor_size + |
2072 monitor_size + |
2077 (callee_extra_locals * Interpreter::stackElementWords()), WordsPerLong)); |
2073 (callee_extra_locals * Interpreter::stackElementWords), WordsPerLong)); |
2078 |
2074 |
2079 } |
2075 } |
2080 |
2076 |
2081 int AbstractInterpreter::size_top_interpreter_activation(methodOop method) { |
2077 int AbstractInterpreter::size_top_interpreter_activation(Method* method) { |
2082 |
2078 |
2083 // See call_stub code |
2079 // See call_stub code |
2084 int call_stub_size = round_to(7 + frame::memory_parameter_word_sp_offset, |
2080 int call_stub_size = round_to(7 + frame::memory_parameter_word_sp_offset, |
2085 WordsPerLong); // 7 + register save area |
2081 WordsPerLong); // 7 + register save area |
2086 |
2082 |
2155 to_fill->_oop_temp = NULL; |
2151 to_fill->_oop_temp = NULL; |
2156 to_fill->_stack_base = stack_base; |
2152 to_fill->_stack_base = stack_base; |
2157 // Need +1 here because stack_base points to the word just above the first expr stack entry |
2153 // Need +1 here because stack_base points to the word just above the first expr stack entry |
2158 // and stack_limit is supposed to point to the word just below the last expr stack entry. |
2154 // and stack_limit is supposed to point to the word just below the last expr stack entry. |
2159 // See generate_compute_interpreter_state. |
2155 // See generate_compute_interpreter_state. |
2160 int extra_stack = 0; //6815692//methodOopDesc::extra_stack_entries(); |
2156 int extra_stack = 0; //6815692//Method::extra_stack_entries(); |
2161 to_fill->_stack_limit = stack_base - (method->max_stack() + 1 + extra_stack); |
2157 to_fill->_stack_limit = stack_base - (method->max_stack() + 1 + extra_stack); |
2162 to_fill->_monitor_base = (BasicObjectLock*) monitor_base; |
2158 to_fill->_monitor_base = (BasicObjectLock*) monitor_base; |
2163 |
2159 |
2164 // sparc specific |
2160 // sparc specific |
2165 to_fill->_frame_bottom = frame_bottom; |
2161 to_fill->_frame_bottom = frame_bottom; |
2173 void BytecodeInterpreter::pd_layout_interpreterState(interpreterState istate, address last_Java_pc, intptr_t* last_Java_fp) { |
2169 void BytecodeInterpreter::pd_layout_interpreterState(interpreterState istate, address last_Java_pc, intptr_t* last_Java_fp) { |
2174 istate->_last_Java_pc = (intptr_t*) last_Java_pc; |
2170 istate->_last_Java_pc = (intptr_t*) last_Java_pc; |
2175 } |
2171 } |
2176 |
2172 |
2177 |
2173 |
2178 int AbstractInterpreter::layout_activation(methodOop method, |
2174 int AbstractInterpreter::layout_activation(Method* method, |
2179 int tempcount, // Number of slots on java expression stack in use |
2175 int tempcount, // Number of slots on java expression stack in use |
2180 int popframe_extra_args, |
2176 int popframe_extra_args, |
2181 int moncount, // Number of active monitors |
2177 int moncount, // Number of active monitors |
2182 int caller_actual_parameters, |
2178 int caller_actual_parameters, |
2183 int callee_param_size, |
2179 int callee_param_size, |