34 #include "oops/arrayOop.hpp" 35 #include "oops/methodData.hpp" 36 #include "oops/method.hpp" 37 #include "oops/oop.inline.hpp" 38 #include "prims/jvmtiExport.hpp" 39 #include "prims/jvmtiThreadState.hpp" 40 #include "runtime/arguments.hpp" 41 #include "runtime/deoptimization.hpp" 42 #include "runtime/frame.inline.hpp" 43 #include "runtime/sharedRuntime.hpp" 44 #include "runtime/stubRoutines.hpp" 45 #include "runtime/synchronizer.hpp" 46 #include "runtime/timer.hpp" 47 #include "runtime/vframeArray.hpp" 48 #include "utilities/debug.hpp" 49 #include "utilities/macros.hpp" 50 51 #undef __ 52 #define __ _masm-> 53 54 #ifdef PRODUCT 55 #define BLOCK_COMMENT(str) /* nothing */ 56 #else 57 #define BLOCK_COMMENT(str) __ block_comment(str) 58 #endif 59 60 #define BIND(label) __ bind(label); BLOCK_COMMENT(#label ":") 61 62 //----------------------------------------------------------------------------- 63 64 // Actually we should never reach here since we do stack overflow checks before pushing any frame. 65 address TemplateInterpreterGenerator::generate_StackOverflowError_handler() { 66 address entry = __ pc(); 67 __ unimplemented("generate_StackOverflowError_handler"); 68 return entry; 69 } 70 71 address TemplateInterpreterGenerator::generate_ArrayIndexOutOfBounds_handler(const char* name) { 72 address entry = __ pc(); 73 __ empty_expression_stack(); 74 __ load_const_optimized(R4_ARG2, (address) name); 75 // Index is in R17_tos. 76 __ mr(R5_ARG3, R17_tos); 77 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException)); 78 return entry; 79 } 80 81 #if 0 82 // Call special ClassCastException constructor taking object to cast 83 // and target class as arguments. 203 case ctos: 204 case stos: 205 case atos: 206 case itos: __ mr(R17_tos, R3_RET); break; // GR_RET -> TOS cache 207 case ftos: 208 case dtos: __ fmr(F15_ftos, F1_RET); break; // TOS cache -> GR_FRET 209 case vtos: break; // Nothing to do, this was a void return. 210 default : ShouldNotReachHere(); 211 } 212 213 // Load LcpoolCache @@@ should be already set! 214 __ get_constant_pool_cache(R27_constPoolCache); 215 216 // Handle a pending exception, fall through if none. 217 __ check_and_forward_exception(R11_scratch1, R12_scratch2); 218 219 // Start executing bytecodes. 220 __ dispatch_next(state, step); 221 222 return entry; 223 } 224 225 // A result handler converts the native result into java format. 226 // Use the shared code between c++ and template interpreter. 227 address TemplateInterpreterGenerator::generate_result_handler_for(BasicType type) { 228 return AbstractInterpreterGenerator::generate_result_handler_for(type); 229 } 230 231 address TemplateInterpreterGenerator::generate_safept_entry_for(TosState state, address runtime_entry) { 232 address entry = __ pc(); 233 234 __ push(state); 235 __ call_VM(noreg, runtime_entry); 236 __ dispatch_via(vtos, Interpreter::_normal_table.table_for(vtos)); 237 238 return entry; 239 } 240 241 // Helpers for commoning out cases in the various type of method entries. 242 243 // Increment invocation count & check for overflow. 244 // 245 // Note: checking for negative value instead of overflow 246 // so we have a 'sticky' overflow test. 247 // 248 void TemplateInterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) { | 34 #include "oops/arrayOop.hpp" 35 #include "oops/methodData.hpp" 36 #include "oops/method.hpp" 37 #include "oops/oop.inline.hpp" 38 #include "prims/jvmtiExport.hpp" 39 #include "prims/jvmtiThreadState.hpp" 40 #include "runtime/arguments.hpp" 41 #include "runtime/deoptimization.hpp" 42 #include "runtime/frame.inline.hpp" 43 #include "runtime/sharedRuntime.hpp" 44 #include "runtime/stubRoutines.hpp" 45 #include "runtime/synchronizer.hpp" 46 #include "runtime/timer.hpp" 47 #include "runtime/vframeArray.hpp" 48 #include "utilities/debug.hpp" 49 #include "utilities/macros.hpp" 50 51 #undef __ 52 #define __ _masm-> 53 54 // Size of interpreter code. Increase if too small. Interpreter will 55 // fail with a guarantee ("not enough space for interpreter generation"); 56 // if too small. 57 // Run with +PrintInterpreter to get the VM to print out the size. 58 // Max size with JVMTI 59 int TemplateInterpreter::InterpreterCodeSize = 230*K; 60 61 #ifdef PRODUCT 62 #define BLOCK_COMMENT(str) /* nothing */ 63 #else 64 #define BLOCK_COMMENT(str) __ block_comment(str) 65 #endif 66 67 #define BIND(label) __ bind(label); BLOCK_COMMENT(#label ":") 68 69 //----------------------------------------------------------------------------- 70 71 address TemplateInterpreterGenerator::generate_slow_signature_handler() { 72 // Slow_signature handler that respects the PPC C calling conventions. 73 // 74 // We get called by the native entry code with our output register 75 // area == 8. First we call InterpreterRuntime::get_result_handler 76 // to copy the pointer to the signature string temporarily to the 77 // first C-argument and to return the result_handler in 78 // R3_RET. Since native_entry will copy the jni-pointer to the 79 // first C-argument slot later on, it is OK to occupy this slot 80 // temporarilly. Then we copy the argument list on the java 81 // expression stack into native varargs format on the native stack 82 // and load arguments into argument registers. Integer arguments in 83 // the varargs vector will be sign-extended to 8 bytes. 84 // 85 // On entry: 86 // R3_ARG1 - intptr_t* Address of java argument list in memory. 87 // R15_prev_state - BytecodeInterpreter* Address of interpreter state for 88 // this method 89 // R19_method 90 // 91 // On exit (just before return instruction): 92 // R3_RET - contains the address of the result_handler. 93 // R4_ARG2 - is not updated for static methods and contains "this" otherwise. 94 // R5_ARG3-R10_ARG8: - When the (i-2)th Java argument is not of type float or double, 95 // ARGi contains this argument. Otherwise, ARGi is not updated. 96 // F1_ARG1-F13_ARG13 - contain the first 13 arguments of type float or double. 97 98 const int LogSizeOfTwoInstructions = 3; 99 100 // FIXME: use Argument:: GL: Argument names different numbers! 101 const int max_fp_register_arguments = 13; 102 const int max_int_register_arguments = 6; // first 2 are reserved 103 104 const Register arg_java = R21_tmp1; 105 const Register arg_c = R22_tmp2; 106 const Register signature = R23_tmp3; // is string 107 const Register sig_byte = R24_tmp4; 108 const Register fpcnt = R25_tmp5; 109 const Register argcnt = R26_tmp6; 110 const Register intSlot = R27_tmp7; 111 const Register target_sp = R28_tmp8; 112 const FloatRegister floatSlot = F0; 113 114 address entry = __ function_entry(); 115 116 __ save_LR_CR(R0); 117 __ save_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14)); 118 // We use target_sp for storing arguments in the C frame. 119 __ mr(target_sp, R1_SP); 120 __ push_frame_reg_args_nonvolatiles(0, R11_scratch1); 121 122 __ mr(arg_java, R3_ARG1); 123 124 __ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::get_signature), R16_thread, R19_method); 125 126 // Signature is in R3_RET. Signature is callee saved. 127 __ mr(signature, R3_RET); 128 129 // Get the result handler. 130 __ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::get_result_handler), R16_thread, R19_method); 131 132 { 133 Label L; 134 // test if static 135 // _access_flags._flags must be at offset 0. 136 // TODO PPC port: requires change in shared code. 137 //assert(in_bytes(AccessFlags::flags_offset()) == 0, 138 // "MethodDesc._access_flags == MethodDesc._access_flags._flags"); 139 // _access_flags must be a 32 bit value. 140 assert(sizeof(AccessFlags) == 4, "wrong size"); 141 __ lwa(R11_scratch1/*access_flags*/, method_(access_flags)); 142 // testbit with condition register. 143 __ testbitdi(CCR0, R0, R11_scratch1/*access_flags*/, JVM_ACC_STATIC_BIT); 144 __ btrue(CCR0, L); 145 // For non-static functions, pass "this" in R4_ARG2 and copy it 146 // to 2nd C-arg slot. 147 // We need to box the Java object here, so we use arg_java 148 // (address of current Java stack slot) as argument and don't 149 // dereference it as in case of ints, floats, etc. 150 __ mr(R4_ARG2, arg_java); 151 __ addi(arg_java, arg_java, -BytesPerWord); 152 __ std(R4_ARG2, _abi(carg_2), target_sp); 153 __ bind(L); 154 } 155 156 // Will be incremented directly after loop_start. argcnt=0 157 // corresponds to 3rd C argument. 158 __ li(argcnt, -1); 159 // arg_c points to 3rd C argument 160 __ addi(arg_c, target_sp, _abi(carg_3)); 161 // no floating-point args parsed so far 162 __ li(fpcnt, 0); 163 164 Label move_intSlot_to_ARG, move_floatSlot_to_FARG; 165 Label loop_start, loop_end; 166 Label do_int, do_long, do_float, do_double, do_dontreachhere, do_object, do_array, do_boxed; 167 168 // signature points to '(' at entry 169 #ifdef ASSERT 170 __ lbz(sig_byte, 0, signature); 171 __ cmplwi(CCR0, sig_byte, '('); 172 __ bne(CCR0, do_dontreachhere); 173 #endif 174 175 __ bind(loop_start); 176 177 __ addi(argcnt, argcnt, 1); 178 __ lbzu(sig_byte, 1, signature); 179 180 __ cmplwi(CCR0, sig_byte, ')'); // end of signature 181 __ beq(CCR0, loop_end); 182 183 __ cmplwi(CCR0, sig_byte, 'B'); // byte 184 __ beq(CCR0, do_int); 185 186 __ cmplwi(CCR0, sig_byte, 'C'); // char 187 __ beq(CCR0, do_int); 188 189 __ cmplwi(CCR0, sig_byte, 'D'); // double 190 __ beq(CCR0, do_double); 191 192 __ cmplwi(CCR0, sig_byte, 'F'); // float 193 __ beq(CCR0, do_float); 194 195 __ cmplwi(CCR0, sig_byte, 'I'); // int 196 __ beq(CCR0, do_int); 197 198 __ cmplwi(CCR0, sig_byte, 'J'); // long 199 __ beq(CCR0, do_long); 200 201 __ cmplwi(CCR0, sig_byte, 'S'); // short 202 __ beq(CCR0, do_int); 203 204 __ cmplwi(CCR0, sig_byte, 'Z'); // boolean 205 __ beq(CCR0, do_int); 206 207 __ cmplwi(CCR0, sig_byte, 'L'); // object 208 __ beq(CCR0, do_object); 209 210 __ cmplwi(CCR0, sig_byte, '['); // array 211 __ beq(CCR0, do_array); 212 213 // __ cmplwi(CCR0, sig_byte, 'V'); // void cannot appear since we do not parse the return type 214 // __ beq(CCR0, do_void); 215 216 __ bind(do_dontreachhere); 217 218 __ unimplemented("ShouldNotReachHere in slow_signature_handler", 120); 219 220 __ bind(do_array); 221 222 { 223 Label start_skip, end_skip; 224 225 __ bind(start_skip); 226 __ lbzu(sig_byte, 1, signature); 227 __ cmplwi(CCR0, sig_byte, '['); 228 __ beq(CCR0, start_skip); // skip further brackets 229 __ cmplwi(CCR0, sig_byte, '9'); 230 __ bgt(CCR0, end_skip); // no optional size 231 __ cmplwi(CCR0, sig_byte, '0'); 232 __ bge(CCR0, start_skip); // skip optional size 233 __ bind(end_skip); 234 235 __ cmplwi(CCR0, sig_byte, 'L'); 236 __ beq(CCR0, do_object); // for arrays of objects, the name of the object must be skipped 237 __ b(do_boxed); // otherwise, go directly to do_boxed 238 } 239 240 __ bind(do_object); 241 { 242 Label L; 243 __ bind(L); 244 __ lbzu(sig_byte, 1, signature); 245 __ cmplwi(CCR0, sig_byte, ';'); 246 __ bne(CCR0, L); 247 } 248 // Need to box the Java object here, so we use arg_java (address of 249 // current Java stack slot) as argument and don't dereference it as 250 // in case of ints, floats, etc. 251 Label do_null; 252 __ bind(do_boxed); 253 __ ld(R0,0, arg_java); 254 __ cmpdi(CCR0, R0, 0); 255 __ li(intSlot,0); 256 __ beq(CCR0, do_null); 257 __ mr(intSlot, arg_java); 258 __ bind(do_null); 259 __ std(intSlot, 0, arg_c); 260 __ addi(arg_java, arg_java, -BytesPerWord); 261 __ addi(arg_c, arg_c, BytesPerWord); 262 __ cmplwi(CCR0, argcnt, max_int_register_arguments); 263 __ blt(CCR0, move_intSlot_to_ARG); 264 __ b(loop_start); 265 266 __ bind(do_int); 267 __ lwa(intSlot, 0, arg_java); 268 __ std(intSlot, 0, arg_c); 269 __ addi(arg_java, arg_java, -BytesPerWord); 270 __ addi(arg_c, arg_c, BytesPerWord); 271 __ cmplwi(CCR0, argcnt, max_int_register_arguments); 272 __ blt(CCR0, move_intSlot_to_ARG); 273 __ b(loop_start); 274 275 __ bind(do_long); 276 __ ld(intSlot, -BytesPerWord, arg_java); 277 __ std(intSlot, 0, arg_c); 278 __ addi(arg_java, arg_java, - 2 * BytesPerWord); 279 __ addi(arg_c, arg_c, BytesPerWord); 280 __ cmplwi(CCR0, argcnt, max_int_register_arguments); 281 __ blt(CCR0, move_intSlot_to_ARG); 282 __ b(loop_start); 283 284 __ bind(do_float); 285 __ lfs(floatSlot, 0, arg_java); 286 #if defined(LINUX) 287 // Linux uses ELF ABI. Both original ELF and ELFv2 ABIs have float 288 // in the least significant word of an argument slot. 289 #if defined(VM_LITTLE_ENDIAN) 290 __ stfs(floatSlot, 0, arg_c); 291 #else 292 __ stfs(floatSlot, 4, arg_c); 293 #endif 294 #elif defined(AIX) 295 // Although AIX runs on big endian CPU, float is in most significant 296 // word of an argument slot. 297 __ stfs(floatSlot, 0, arg_c); 298 #else 299 #error "unknown OS" 300 #endif 301 __ addi(arg_java, arg_java, -BytesPerWord); 302 __ addi(arg_c, arg_c, BytesPerWord); 303 __ cmplwi(CCR0, fpcnt, max_fp_register_arguments); 304 __ blt(CCR0, move_floatSlot_to_FARG); 305 __ b(loop_start); 306 307 __ bind(do_double); 308 __ lfd(floatSlot, - BytesPerWord, arg_java); 309 __ stfd(floatSlot, 0, arg_c); 310 __ addi(arg_java, arg_java, - 2 * BytesPerWord); 311 __ addi(arg_c, arg_c, BytesPerWord); 312 __ cmplwi(CCR0, fpcnt, max_fp_register_arguments); 313 __ blt(CCR0, move_floatSlot_to_FARG); 314 __ b(loop_start); 315 316 __ bind(loop_end); 317 318 __ pop_frame(); 319 __ restore_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14)); 320 __ restore_LR_CR(R0); 321 322 __ blr(); 323 324 Label move_int_arg, move_float_arg; 325 __ bind(move_int_arg); // each case must consist of 2 instructions (otherwise adapt LogSizeOfTwoInstructions) 326 __ mr(R5_ARG3, intSlot); __ b(loop_start); 327 __ mr(R6_ARG4, intSlot); __ b(loop_start); 328 __ mr(R7_ARG5, intSlot); __ b(loop_start); 329 __ mr(R8_ARG6, intSlot); __ b(loop_start); 330 __ mr(R9_ARG7, intSlot); __ b(loop_start); 331 __ mr(R10_ARG8, intSlot); __ b(loop_start); 332 333 __ bind(move_float_arg); // each case must consist of 2 instructions (otherwise adapt LogSizeOfTwoInstructions) 334 __ fmr(F1_ARG1, floatSlot); __ b(loop_start); 335 __ fmr(F2_ARG2, floatSlot); __ b(loop_start); 336 __ fmr(F3_ARG3, floatSlot); __ b(loop_start); 337 __ fmr(F4_ARG4, floatSlot); __ b(loop_start); 338 __ fmr(F5_ARG5, floatSlot); __ b(loop_start); 339 __ fmr(F6_ARG6, floatSlot); __ b(loop_start); 340 __ fmr(F7_ARG7, floatSlot); __ b(loop_start); 341 __ fmr(F8_ARG8, floatSlot); __ b(loop_start); 342 __ fmr(F9_ARG9, floatSlot); __ b(loop_start); 343 __ fmr(F10_ARG10, floatSlot); __ b(loop_start); 344 __ fmr(F11_ARG11, floatSlot); __ b(loop_start); 345 __ fmr(F12_ARG12, floatSlot); __ b(loop_start); 346 __ fmr(F13_ARG13, floatSlot); __ b(loop_start); 347 348 __ bind(move_intSlot_to_ARG); 349 __ sldi(R0, argcnt, LogSizeOfTwoInstructions); 350 __ load_const(R11_scratch1, move_int_arg); // Label must be bound here. 351 __ add(R11_scratch1, R0, R11_scratch1); 352 __ mtctr(R11_scratch1/*branch_target*/); 353 __ bctr(); 354 __ bind(move_floatSlot_to_FARG); 355 __ sldi(R0, fpcnt, LogSizeOfTwoInstructions); 356 __ addi(fpcnt, fpcnt, 1); 357 __ load_const(R11_scratch1, move_float_arg); // Label must be bound here. 358 __ add(R11_scratch1, R0, R11_scratch1); 359 __ mtctr(R11_scratch1/*branch_target*/); 360 __ bctr(); 361 362 return entry; 363 } 364 365 address TemplateInterpreterGenerator::generate_result_handler_for(BasicType type) { 366 // 367 // Registers alive 368 // R3_RET 369 // LR 370 // 371 // Registers updated 372 // R3_RET 373 // 374 375 Label done; 376 address entry = __ pc(); 377 378 switch (type) { 379 case T_BOOLEAN: 380 // convert !=0 to 1 381 __ neg(R0, R3_RET); 382 __ orr(R0, R3_RET, R0); 383 __ srwi(R3_RET, R0, 31); 384 break; 385 case T_BYTE: 386 // sign extend 8 bits 387 __ extsb(R3_RET, R3_RET); 388 break; 389 case T_CHAR: 390 // zero extend 16 bits 391 __ clrldi(R3_RET, R3_RET, 48); 392 break; 393 case T_SHORT: 394 // sign extend 16 bits 395 __ extsh(R3_RET, R3_RET); 396 break; 397 case T_INT: 398 // sign extend 32 bits 399 __ extsw(R3_RET, R3_RET); 400 break; 401 case T_LONG: 402 break; 403 case T_OBJECT: 404 // unbox result if not null 405 __ cmpdi(CCR0, R3_RET, 0); 406 __ beq(CCR0, done); 407 __ ld(R3_RET, 0, R3_RET); 408 __ verify_oop(R3_RET); 409 break; 410 case T_FLOAT: 411 break; 412 case T_DOUBLE: 413 break; 414 case T_VOID: 415 break; 416 default: ShouldNotReachHere(); 417 } 418 419 __ BIND(done); 420 __ blr(); 421 422 return entry; 423 } 424 425 // Abstract method entry. 426 // 427 address TemplateInterpreterGenerator::generate_abstract_entry(void) { 428 address entry = __ pc(); 429 430 // 431 // Registers alive 432 // R16_thread - JavaThread* 433 // R19_method - callee's method (method to be invoked) 434 // R1_SP - SP prepared such that caller's outgoing args are near top 435 // LR - return address to caller 436 // 437 // Stack layout at this point: 438 // 439 // 0 [TOP_IJAVA_FRAME_ABI] <-- R1_SP 440 // alignment (optional) 441 // [outgoing Java arguments] 442 // ... 443 // PARENT [PARENT_IJAVA_FRAME_ABI] 444 // ... 445 // 446 447 // Can't use call_VM here because we have not set up a new 448 // interpreter state. Make the call to the vm and make it look like 449 // our caller set up the JavaFrameAnchor. 450 __ set_top_ijava_frame_at_SP_as_last_Java_frame(R1_SP, R12_scratch2/*tmp*/); 451 452 // Push a new C frame and save LR. 453 __ save_LR_CR(R0); 454 __ push_frame_reg_args(0, R11_scratch1); 455 456 // This is not a leaf but we have a JavaFrameAnchor now and we will 457 // check (create) exceptions afterward so this is ok. 458 __ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError), 459 R16_thread); 460 461 // Pop the C frame and restore LR. 462 __ pop_frame(); 463 __ restore_LR_CR(R0); 464 465 // Reset JavaFrameAnchor from call_VM_leaf above. 466 __ reset_last_Java_frame(); 467 468 // We don't know our caller, so jump to the general forward exception stub, 469 // which will also pop our full frame off. Satisfy the interface of 470 // SharedRuntime::generate_forward_exception() 471 __ load_const_optimized(R11_scratch1, StubRoutines::forward_exception_entry(), R0); 472 __ mtctr(R11_scratch1); 473 __ bctr(); 474 475 return entry; 476 } 477 478 // Interpreter intrinsic for WeakReference.get(). 479 // 1. Don't push a full blown frame and go on dispatching, but fetch the value 480 // into R8 and return quickly 481 // 2. If G1 is active we *must* execute this intrinsic for corrrectness: 482 // It contains a GC barrier which puts the reference into the satb buffer 483 // to indicate that someone holds a strong reference to the object the 484 // weak ref points to! 485 address TemplateInterpreterGenerator::generate_Reference_get_entry(void) { 486 // Code: _aload_0, _getfield, _areturn 487 // parameter size = 1 488 // 489 // The code that gets generated by this routine is split into 2 parts: 490 // 1. the "intrinsified" code for G1 (or any SATB based GC), 491 // 2. the slow path - which is an expansion of the regular method entry. 492 // 493 // Notes: 494 // * In the G1 code we do not check whether we need to block for 495 // a safepoint. If G1 is enabled then we must execute the specialized 496 // code for Reference.get (except when the Reference object is null) 497 // so that we can log the value in the referent field with an SATB 498 // update buffer. 499 // If the code for the getfield template is modified so that the 500 // G1 pre-barrier code is executed when the current method is 501 // Reference.get() then going through the normal method entry 502 // will be fine. 503 // * The G1 code can, however, check the receiver object (the instance 504 // of java.lang.Reference) and jump to the slow path if null. If the 505 // Reference object is null then we obviously cannot fetch the referent 506 // and so we don't need to call the G1 pre-barrier. Thus we can use the 507 // regular method entry code to generate the NPE. 508 // 509 510 if (UseG1GC) { 511 address entry = __ pc(); 512 513 const int referent_offset = java_lang_ref_Reference::referent_offset; 514 guarantee(referent_offset > 0, "referent offset not initialized"); 515 516 Label slow_path; 517 518 // Debugging not possible, so can't use __ skip_if_jvmti_mode(slow_path, GR31_SCRATCH); 519 520 // In the G1 code we don't check if we need to reach a safepoint. We 521 // continue and the thread will safepoint at the next bytecode dispatch. 522 523 // If the receiver is null then it is OK to jump to the slow path. 524 __ ld(R3_RET, Interpreter::stackElementSize, R15_esp); // get receiver 525 526 // Check if receiver == NULL and go the slow path. 527 __ cmpdi(CCR0, R3_RET, 0); 528 __ beq(CCR0, slow_path); 529 530 // Load the value of the referent field. 531 __ load_heap_oop(R3_RET, referent_offset, R3_RET); 532 533 // Generate the G1 pre-barrier code to log the value of 534 // the referent field in an SATB buffer. Note with 535 // these parameters the pre-barrier does not generate 536 // the load of the previous value. 537 538 // Restore caller sp for c2i case. 539 #ifdef ASSERT 540 __ ld(R9_ARG7, 0, R1_SP); 541 __ ld(R10_ARG8, 0, R21_sender_SP); 542 __ cmpd(CCR0, R9_ARG7, R10_ARG8); 543 __ asm_assert_eq("backlink", 0x544); 544 #endif // ASSERT 545 __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started. 546 547 __ g1_write_barrier_pre(noreg, // obj 548 noreg, // offset 549 R3_RET, // pre_val 550 R11_scratch1, // tmp 551 R12_scratch2, // tmp 552 true); // needs_frame 553 554 __ blr(); 555 556 // Generate regular method entry. 557 __ bind(slow_path); 558 __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::zerolocals), R11_scratch1); 559 return entry; 560 } 561 562 return NULL; 563 } 564 565 // Actually we should never reach here since we do stack overflow checks before pushing any frame. 566 address TemplateInterpreterGenerator::generate_StackOverflowError_handler() { 567 address entry = __ pc(); 568 __ unimplemented("generate_StackOverflowError_handler"); 569 return entry; 570 } 571 572 address TemplateInterpreterGenerator::generate_ArrayIndexOutOfBounds_handler(const char* name) { 573 address entry = __ pc(); 574 __ empty_expression_stack(); 575 __ load_const_optimized(R4_ARG2, (address) name); 576 // Index is in R17_tos. 577 __ mr(R5_ARG3, R17_tos); 578 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException)); 579 return entry; 580 } 581 582 #if 0 583 // Call special ClassCastException constructor taking object to cast 584 // and target class as arguments. 704 case ctos: 705 case stos: 706 case atos: 707 case itos: __ mr(R17_tos, R3_RET); break; // GR_RET -> TOS cache 708 case ftos: 709 case dtos: __ fmr(F15_ftos, F1_RET); break; // TOS cache -> GR_FRET 710 case vtos: break; // Nothing to do, this was a void return. 711 default : ShouldNotReachHere(); 712 } 713 714 // Load LcpoolCache @@@ should be already set! 715 __ get_constant_pool_cache(R27_constPoolCache); 716 717 // Handle a pending exception, fall through if none. 718 __ check_and_forward_exception(R11_scratch1, R12_scratch2); 719 720 // Start executing bytecodes. 721 __ dispatch_next(state, step); 722 723 return entry; 724 } 725 726 address TemplateInterpreterGenerator::generate_safept_entry_for(TosState state, address runtime_entry) { 727 address entry = __ pc(); 728 729 __ push(state); 730 __ call_VM(noreg, runtime_entry); 731 __ dispatch_via(vtos, Interpreter::_normal_table.table_for(vtos)); 732 733 return entry; 734 } 735 736 // Helpers for commoning out cases in the various type of method entries. 737 738 // Increment invocation count & check for overflow. 739 // 740 // Note: checking for negative value instead of overflow 741 // so we have a 'sticky' overflow test. 742 // 743 void TemplateInterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) { |