134 // index to G4_scratch for the VM call 135 __ mov(G3_scratch, G4_scratch); 136 __ set((intptr_t)name, G3_scratch); 137 __ call_VM(Oexception, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException), G3_scratch, G4_scratch); 138 __ should_not_reach_here(); 139 return entry; 140 } 141 142 143 address TemplateInterpreterGenerator::generate_StackOverflowError_handler() { 144 address entry = __ pc(); 145 // expression stack must be empty before entering the VM if an exception happened 146 __ empty_expression_stack(); 147 __ call_VM(Oexception, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_StackOverflowError)); 148 __ should_not_reach_here(); 149 return entry; 150 } 151 152 153 address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { 154 address compiled_entry = __ pc(); 155 Label cont; 156 157 address entry = __ pc(); 158 #if !defined(_LP64) && defined(COMPILER2) 159 // All return values are where we want them, except for Longs. C2 returns 160 // longs in G1 in the 32-bit build whereas the interpreter wants them in O0/O1. 161 // Since the interpreter will return longs in G1 and O0/O1 in the 32bit 162 // build even if we are returning from interpreted we just do a little 163 // stupid shuffing. 164 // Note: I tried to make c2 return longs in O0/O1 and G1 so we wouldn't have to 165 // do this here. Unfortunately if we did a rethrow we'd see an machepilog node 166 // first which would move g1 -> O0/O1 and destroy the exception we were throwing. 167 168 if( state == ltos ) { 169 __ srl (G1, 0,O1); 170 __ srlx(G1,32,O0); 171 } 172 #endif /* !_LP64 && COMPILER2 */ 173 174 175 __ bind(cont); 176 177 // The callee returns with the stack possibly adjusted by adapter transition 178 // We remove that possible adjustment here. 179 // All interpreter local registers are untouched. Any result is passed back 180 // in the O0/O1 or float registers. Before continuing, the arguments must be 181 // popped from the java expression stack; i.e., Lesp must be adjusted. 182 183 __ mov(Llast_SP, SP); // Remove any adapter added stack space. 184 185 186 const Register cache = G3_scratch; 187 const Register size = G1_scratch; 188 __ get_cache_and_index_at_bcp(cache, G1_scratch, 1); 189 __ ld_ptr(cache, constantPoolCacheOopDesc::base_offset() + 190 ConstantPoolCacheEntry::flags_offset(), size); 191 __ and3(size, 0xFF, size); // argument size in words 192 __ sll(size, Interpreter::logStackElementSize(), size); // each argument size in bytes 193 __ add(Lesp, size, Lesp); // pop arguments 194 __ dispatch_next(state, step); 195 196 return entry; 197 } 198 199 200 address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, int step) { 201 address entry = __ pc(); 202 __ get_constant_pool_cache(LcpoolCache); // load LcpoolCache 203 { Label L; 204 Address exception_addr(G2_thread, Thread::pending_exception_offset()); 205 __ ld_ptr(exception_addr, Gtemp); // Load pending exception. 206 __ tst(Gtemp); 207 __ brx(Assembler::equal, false, Assembler::pt, L); 208 __ delayed()->nop(); 209 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_pending_exception)); 210 __ should_not_reach_here(); 211 __ bind(L); 212 } 213 __ dispatch_next(state, step); 214 return entry; 215 } | 134 // index to G4_scratch for the VM call 135 __ mov(G3_scratch, G4_scratch); 136 __ set((intptr_t)name, G3_scratch); 137 __ call_VM(Oexception, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException), G3_scratch, G4_scratch); 138 __ should_not_reach_here(); 139 return entry; 140 } 141 142 143 address TemplateInterpreterGenerator::generate_StackOverflowError_handler() { 144 address entry = __ pc(); 145 // expression stack must be empty before entering the VM if an exception happened 146 __ empty_expression_stack(); 147 __ call_VM(Oexception, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_StackOverflowError)); 148 __ should_not_reach_here(); 149 return entry; 150 } 151 152 153 address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { 154 TosState incoming_state = state; 155 156 Label cont; 157 address compiled_entry = __ pc(); 158 159 address entry = __ pc(); 160 #if !defined(_LP64) && defined(COMPILER2) 161 // All return values are where we want them, except for Longs. C2 returns 162 // longs in G1 in the 32-bit build whereas the interpreter wants them in O0/O1. 163 // Since the interpreter will return longs in G1 and O0/O1 in the 32bit 164 // build even if we are returning from interpreted we just do a little 165 // stupid shuffing. 166 // Note: I tried to make c2 return longs in O0/O1 and G1 so we wouldn't have to 167 // do this here. Unfortunately if we did a rethrow we'd see an machepilog node 168 // first which would move g1 -> O0/O1 and destroy the exception we were throwing. 169 170 if (incoming_state == ltos) { 171 __ srl (G1, 0, O1); 172 __ srlx(G1, 32, O0); 173 } 174 #endif // !_LP64 && COMPILER2 175 176 __ bind(cont); 177 178 // The callee returns with the stack possibly adjusted by adapter transition 179 // We remove that possible adjustment here. 180 // All interpreter local registers are untouched. Any result is passed back 181 // in the O0/O1 or float registers. Before continuing, the arguments must be 182 // popped from the java expression stack; i.e., Lesp must be adjusted. 183 184 __ mov(Llast_SP, SP); // Remove any adapter added stack space. 185 186 Label L_got_cache, L_giant_index; 187 const Register cache = G3_scratch; 188 const Register size = G1_scratch; 189 if (EnableInvokeDynamic) { 190 __ ldub(Address(Lbcp, 0), G1_scratch); // Load current bytecode. 191 __ cmp(G1_scratch, Bytecodes::_invokedynamic); 192 __ br(Assembler::equal, false, Assembler::pn, L_giant_index); 193 __ delayed()->nop(); 194 } 195 __ get_cache_and_index_at_bcp(cache, G1_scratch, 1); 196 __ bind(L_got_cache); 197 __ ld_ptr(cache, constantPoolCacheOopDesc::base_offset() + 198 ConstantPoolCacheEntry::flags_offset(), size); 199 __ and3(size, 0xFF, size); // argument size in words 200 __ sll(size, Interpreter::logStackElementSize(), size); // each argument size in bytes 201 __ add(Lesp, size, Lesp); // pop arguments 202 __ dispatch_next(state, step); 203 204 // out of the main line of code... 205 if (EnableInvokeDynamic) { 206 __ bind(L_giant_index); 207 __ get_cache_and_index_at_bcp(cache, G1_scratch, 1, true); 208 __ ba(false, L_got_cache); 209 __ delayed()->nop(); 210 } 211 212 return entry; 213 } 214 215 216 address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, int step) { 217 address entry = __ pc(); 218 __ get_constant_pool_cache(LcpoolCache); // load LcpoolCache 219 { Label L; 220 Address exception_addr(G2_thread, Thread::pending_exception_offset()); 221 __ ld_ptr(exception_addr, Gtemp); // Load pending exception. 222 __ tst(Gtemp); 223 __ brx(Assembler::equal, false, Assembler::pt, L); 224 __ delayed()->nop(); 225 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_pending_exception)); 226 __ should_not_reach_here(); 227 __ bind(L); 228 } 229 __ dispatch_next(state, step); 230 return entry; 231 } |