< prev index next >

src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp

Print this page

 790 }
 791 
 792 // Not supported
 793 address TemplateInterpreterGenerator::generate_currentThread() { return nullptr; }
 794 address TemplateInterpreterGenerator::generate_CRC32_update_entry() { return nullptr; }
 795 address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) { return nullptr; }
 796 address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) { return nullptr; }
 797 address TemplateInterpreterGenerator::generate_Float_intBitsToFloat_entry() { return nullptr; }
 798 address TemplateInterpreterGenerator::generate_Float_floatToRawIntBits_entry() { return nullptr; }
 799 address TemplateInterpreterGenerator::generate_Double_longBitsToDouble_entry() { return nullptr; }
 800 address TemplateInterpreterGenerator::generate_Double_doubleToRawLongBits_entry() { return nullptr; }
 801 address TemplateInterpreterGenerator::generate_Float_float16ToFloat_entry() { return nullptr; }
 802 address TemplateInterpreterGenerator::generate_Float_floatToFloat16_entry() { return nullptr; }
 803 
 804 //
 805 // Interpreter stub for calling a native method. (asm interpreter)
 806 // This sets up a somewhat different looking stack for calling the native method
 807 // than the typical interpreter frame setup.
 808 //
 809 
 810 address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
 811   // determine code generation flags
 812   bool inc_counter  = UseCompiler || CountCompiledCalls;
 813 
 814   // Incoming registers:
 815   //
 816   // Rmethod: Method*
 817   // Rthread: thread
 818   // Rsender_sp: sender sp
 819   // Rparams: parameters
 820 
 821   address entry_point = __ pc();
 822 
 823   // Register allocation
 824   const Register Rsize_of_params = R6;
 825   const Register Rsig_handler    = Rtmp_save0;   // R4
 826   const Register Rnative_code    = Rtmp_save1;   // R5
 827   const Register Rresult_handler = R6;
 828 
 829   const Register Rsaved_result_lo = Rtmp_save0;  // R4
 830   const Register Rsaved_result_hi = Rtmp_save1;  // R5
 831   FloatRegister saved_result_fp;
 832 

1124 
1125   // Restore FP/LR, sender_sp and return
1126   __ mov(Rtemp, FP);
1127   __ ldmia(FP, RegisterSet(FP) | RegisterSet(LR));
1128   __ ldr(SP, Address(Rtemp, frame::interpreter_frame_sender_sp_offset * wordSize));
1129 
1130   __ ret();
1131 
1132   if (inc_counter) {
1133     // Handle overflow of counter and compile method
1134     __ bind(invocation_counter_overflow);
1135     generate_counter_overflow(continue_after_compile);
1136   }
1137 
1138   return entry_point;
1139 }
1140 
1141 //
1142 // Generic interpreted method entry to (asm) interpreter
1143 //
1144 address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
1145   // determine code generation flags
1146   bool inc_counter  = UseCompiler || CountCompiledCalls;
1147 
1148   // Rmethod: Method*
1149   // Rthread: thread
1150   // Rsender_sp: sender sp (could differ from SP if we were called via c2i)
1151   // Rparams: pointer to the last parameter in the stack
1152 
1153   address entry_point = __ pc();
1154 
1155   const Register RconstMethod = R3;
1156 
1157 
1158   __ ldr(RconstMethod, Address(Rmethod, Method::const_offset()));
1159 
1160   __ ldrh(R2, Address(RconstMethod, ConstMethod::size_of_parameters_offset()));
1161   __ ldrh(R3, Address(RconstMethod, ConstMethod::size_of_locals_offset()));
1162 
1163   // setup Rlocals
1164   __ sub(Rlocals, Rparams, wordSize);
1165   __ add(Rlocals, Rlocals, AsmOperand(R2, lsl, Interpreter::logStackElementSize));
1166 

1548   lep = __ pc(); __ push(ltos); __ b(L);
1549 
1550   if (VerifyOops) {  // can't share atos entry if VerifyOops
1551     aep = __ pc(); __ push(atos); __ b(L);
1552   } else {
1553     aep = __ pc();              // fall through
1554   }
1555 
1556 #ifdef __SOFTFP__
1557   fep = __ pc();                // fall through
1558 #endif // __SOFTFP__
1559 
1560   bep = cep = sep =             // fall through
1561   iep = __ pc(); __ push(itos); // fall through
1562   vep = __ pc(); __ bind(L);    // fall through
1563   generate_and_dispatch(t);
1564 }
1565 
1566 //------------------------------------------------------------------------------------------------------------------------
1567 









1568 // Non-product code
1569 #ifndef PRODUCT
1570 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
1571   address entry = __ pc();
1572 
1573   // prepare expression stack
1574   __ push(state);       // save tosca
1575 
1576   // pass tosca registers as arguments
1577   __ mov(R2, R0_tos);
1578   __ mov(R3, R1_tos_hi);
1579   __ mov(R1, LR);       // save return address
1580 
1581   // call tracer
1582   __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), R1, R2, R3);
1583 
1584   __ mov(LR, R0);       // restore return address
1585   __ pop(state);        // restore tosca
1586 
1587   // return
1588   __ ret();
1589 
1590   return entry;
1591 }
1592 
1593 
1594 void TemplateInterpreterGenerator::count_bytecode() {
1595   __ inc_global_counter((address) &BytecodeCounter::_counter_value, 0, Rtemp, R2_tmp, true);
1596 }
1597 
1598 
1599 void TemplateInterpreterGenerator::histogram_bytecode(Template* t) {
1600   __ inc_global_counter((address)&BytecodeHistogram::_counters[0], sizeof(BytecodeHistogram::_counters[0]) * t->bytecode(), Rtemp, R2_tmp, true);
1601 }
1602 
1603 
1604 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template* t) {
1605   const Register Rindex_addr = R2_tmp;
1606   Label Lcontinue;
1607   InlinedAddress Lcounters((address)BytecodePairHistogram::_counters);
1608   InlinedAddress Lindex((address)&BytecodePairHistogram::_index);
1609   const Register Rcounters_addr = R2_tmp;
1610   const Register Rindex = R4_tmp;
1611 
1612   // calculate new index for counter:
1613   // index = (_index >> log2_number_of_codes) | (bytecode << log2_number_of_codes).
1614   // (_index >> log2_number_of_codes) is previous bytecode
1615 
1616   __ ldr_literal(Rindex_addr, Lindex);
1617   __ ldr_s32(Rindex, Address(Rindex_addr));
1618   __ mov_slow(Rtemp, ((int)t->bytecode()) << BytecodePairHistogram::log2_number_of_codes);
1619   __ orr(Rindex, Rtemp, AsmOperand(Rindex, lsr, BytecodePairHistogram::log2_number_of_codes));
1620   __ str_32(Rindex, Address(Rindex_addr));
1621 
1622   // Rindex (R4) contains index of counter
1623 

 790 }
 791 
 792 // Not supported
 793 address TemplateInterpreterGenerator::generate_currentThread() { return nullptr; }
 794 address TemplateInterpreterGenerator::generate_CRC32_update_entry() { return nullptr; }
 795 address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) { return nullptr; }
 796 address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) { return nullptr; }
 797 address TemplateInterpreterGenerator::generate_Float_intBitsToFloat_entry() { return nullptr; }
 798 address TemplateInterpreterGenerator::generate_Float_floatToRawIntBits_entry() { return nullptr; }
 799 address TemplateInterpreterGenerator::generate_Double_longBitsToDouble_entry() { return nullptr; }
 800 address TemplateInterpreterGenerator::generate_Double_doubleToRawLongBits_entry() { return nullptr; }
 801 address TemplateInterpreterGenerator::generate_Float_float16ToFloat_entry() { return nullptr; }
 802 address TemplateInterpreterGenerator::generate_Float_floatToFloat16_entry() { return nullptr; }
 803 
 804 //
 805 // Interpreter stub for calling a native method. (asm interpreter)
 806 // This sets up a somewhat different looking stack for calling the native method
 807 // than the typical interpreter frame setup.
 808 //
 809 
 810 address TemplateInterpreterGenerator::generate_native_entry(bool synchronized, bool runtime_upcalls) {
 811   // determine code generation flags
 812   bool inc_counter = (UseCompiler || CountCompiledCalls) && !PreloadOnly;
 813 
 814   // Incoming registers:
 815   //
 816   // Rmethod: Method*
 817   // Rthread: thread
 818   // Rsender_sp: sender sp
 819   // Rparams: parameters
 820 
 821   address entry_point = __ pc();
 822 
 823   // Register allocation
 824   const Register Rsize_of_params = R6;
 825   const Register Rsig_handler    = Rtmp_save0;   // R4
 826   const Register Rnative_code    = Rtmp_save1;   // R5
 827   const Register Rresult_handler = R6;
 828 
 829   const Register Rsaved_result_lo = Rtmp_save0;  // R4
 830   const Register Rsaved_result_hi = Rtmp_save1;  // R5
 831   FloatRegister saved_result_fp;
 832 

1124 
1125   // Restore FP/LR, sender_sp and return
1126   __ mov(Rtemp, FP);
1127   __ ldmia(FP, RegisterSet(FP) | RegisterSet(LR));
1128   __ ldr(SP, Address(Rtemp, frame::interpreter_frame_sender_sp_offset * wordSize));
1129 
1130   __ ret();
1131 
1132   if (inc_counter) {
1133     // Handle overflow of counter and compile method
1134     __ bind(invocation_counter_overflow);
1135     generate_counter_overflow(continue_after_compile);
1136   }
1137 
1138   return entry_point;
1139 }
1140 
1141 //
1142 // Generic interpreted method entry to (asm) interpreter
1143 //
1144 address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized, bool runtime_upcalls) {
1145   // determine code generation flags
1146   bool inc_counter = (UseCompiler || CountCompiledCalls) && !PreloadOnly;
1147 
1148   // Rmethod: Method*
1149   // Rthread: thread
1150   // Rsender_sp: sender sp (could differ from SP if we were called via c2i)
1151   // Rparams: pointer to the last parameter in the stack
1152 
1153   address entry_point = __ pc();
1154 
1155   const Register RconstMethod = R3;
1156 
1157 
1158   __ ldr(RconstMethod, Address(Rmethod, Method::const_offset()));
1159 
1160   __ ldrh(R2, Address(RconstMethod, ConstMethod::size_of_parameters_offset()));
1161   __ ldrh(R3, Address(RconstMethod, ConstMethod::size_of_locals_offset()));
1162 
1163   // setup Rlocals
1164   __ sub(Rlocals, Rparams, wordSize);
1165   __ add(Rlocals, Rlocals, AsmOperand(R2, lsl, Interpreter::logStackElementSize));
1166 

1548   lep = __ pc(); __ push(ltos); __ b(L);
1549 
1550   if (VerifyOops) {  // can't share atos entry if VerifyOops
1551     aep = __ pc(); __ push(atos); __ b(L);
1552   } else {
1553     aep = __ pc();              // fall through
1554   }
1555 
1556 #ifdef __SOFTFP__
1557   fep = __ pc();                // fall through
1558 #endif // __SOFTFP__
1559 
1560   bep = cep = sep =             // fall through
1561   iep = __ pc(); __ push(itos); // fall through
1562   vep = __ pc(); __ bind(L);    // fall through
1563   generate_and_dispatch(t);
1564 }
1565 
1566 //------------------------------------------------------------------------------------------------------------------------
1567 
1568 void TemplateInterpreterGenerator::count_bytecode() {
1569   __ inc_global_counter((address) &BytecodeCounter::_counter_value, 0, Rtemp, R2_tmp, true);
1570 }
1571 
1572 
1573 void TemplateInterpreterGenerator::histogram_bytecode(Template* t) {
1574   __ inc_global_counter((address)&BytecodeHistogram::_counters[0], sizeof(BytecodeHistogram::_counters[0]) * t->bytecode(), Rtemp, R2_tmp, true);
1575 }
1576 
1577 // Non-product code
1578 #ifndef PRODUCT
1579 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
1580   address entry = __ pc();
1581 
1582   // prepare expression stack
1583   __ push(state);       // save tosca
1584 
1585   // pass tosca registers as arguments
1586   __ mov(R2, R0_tos);
1587   __ mov(R3, R1_tos_hi);
1588   __ mov(R1, LR);       // save return address
1589 
1590   // call tracer
1591   __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), R1, R2, R3);
1592 
1593   __ mov(LR, R0);       // restore return address
1594   __ pop(state);        // restore tosca
1595 
1596   // return
1597   __ ret();
1598 
1599   return entry;
1600 }
1601 











1602 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template* t) {
1603   const Register Rindex_addr = R2_tmp;
1604   Label Lcontinue;
1605   InlinedAddress Lcounters((address)BytecodePairHistogram::_counters);
1606   InlinedAddress Lindex((address)&BytecodePairHistogram::_index);
1607   const Register Rcounters_addr = R2_tmp;
1608   const Register Rindex = R4_tmp;
1609 
1610   // calculate new index for counter:
1611   // index = (_index >> log2_number_of_codes) | (bytecode << log2_number_of_codes).
1612   // (_index >> log2_number_of_codes) is previous bytecode
1613 
1614   __ ldr_literal(Rindex_addr, Lindex);
1615   __ ldr_s32(Rindex, Address(Rindex_addr));
1616   __ mov_slow(Rtemp, ((int)t->bytecode()) << BytecodePairHistogram::log2_number_of_codes);
1617   __ orr(Rindex, Rtemp, AsmOperand(Rindex, lsr, BytecodePairHistogram::log2_number_of_codes));
1618   __ str_32(Rindex, Address(Rindex_addr));
1619 
1620   // Rindex (R4) contains index of counter
1621 
< prev index next >