3338 // trash the return value as there is nothing to return yet
3339 __ set(0xDEAD0001, O7);
3340 #endif
3341
3342 __ mov(SP, O5_savedSP);
3343 }
3344
3345
3346 static void make_new_frames(MacroAssembler* masm, bool deopt) {
3347 //
3348 // loop through the UnrollBlock info and create new frames
3349 //
3350 Register G3pcs = G3_scratch;
3351 Register Oreturn0 = O0;
3352 Register Oreturn1 = O1;
3353 Register O2UnrollBlock = O2;
3354 Register O3array = O3;
3355 Register O4array_size = O4;
3356 Label loop;
3357
3358 // Before we make new frames, check to see if stack is available.
3359 // Do this after the caller's return address is on top of stack
3360 if (UseStackBanging) {
3361 // Get total frame size for interpreted frames
3362 __ ld(O2UnrollBlock, Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes(), O4);
3363 __ bang_stack_size(O4, O3, G3_scratch);
3364 }
3365
3366 __ ld(O2UnrollBlock, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes(), O4array_size);
3367 __ ld_ptr(O2UnrollBlock, Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes(), G3pcs);
3368 __ ld_ptr(O2UnrollBlock, Deoptimization::UnrollBlock::frame_sizes_offset_in_bytes(), O3array);
3369
3370 // Adjust old interpreter frame to make space for new frame's extra java locals
3371 //
3372 // We capture the original sp for the transition frame only because it is needed in
3373 // order to properly calculate interpreter_sp_adjustment. Even though in real life
3374 // every interpreter frame captures a savedSP it is only needed at the transition
3375 // (fortunately). If we had to have it correct everywhere then we would need to
3376 // be told the sp_adjustment for each frame we create. If the frame size array
3377 // were to have twice the frame count entries then we could have pairs [sp_adjustment, frame_size]
3378 // for each frame we create and keep up the illusion every where.
3379 //
3380
3381 __ ld(O2UnrollBlock, Deoptimization::UnrollBlock::caller_adjustment_offset_in_bytes(), O7);
3382 __ mov(SP, O5_savedSP); // remember initial sender's original sp before adjustment
3383 __ sub(SP, O7, SP);
3384
3392 __ bind(loop);
3393
3394 // allocate a new frame, filling the registers
3395
3396 gen_new_frame(masm, deopt); // allocate an interpreter frame
3397
3398 __ cmp_zero_and_br(Assembler::notZero, O4array_size, loop);
3399 __ delayed()->add(O3array, wordSize, O3array);
3400 __ ld_ptr(G3pcs, 0, O7); // load final frame new pc
3401
3402 }
3403
3404 //------------------------------generate_deopt_blob----------------------------
3405 // Ought to generate an ideal graph & compile, but here's some SPARC ASM
3406 // instead.
3407 void SharedRuntime::generate_deopt_blob() {
3408 // allocate space for the code
3409 ResourceMark rm;
3410 // setup code generation tools
3411 int pad = VerifyThread ? 512 : 0;// Extra slop space for more verify code
3412 if (UseStackBanging) {
3413 pad += StackShadowPages*16 + 32;
3414 }
3415 #ifdef _LP64
3416 CodeBuffer buffer("deopt_blob", 2100+pad, 512);
3417 #else
3418 // Measured 8/7/03 at 1212 in 32bit debug build (no VerifyThread)
3419 // Measured 8/7/03 at 1396 in 32bit debug build (VerifyThread)
3420 CodeBuffer buffer("deopt_blob", 1600+pad, 512);
3421 #endif /* _LP64 */
3422 MacroAssembler* masm = new MacroAssembler(&buffer);
3423 FloatRegister Freturn0 = F0;
3424 Register Greturn1 = G1;
3425 Register Oreturn0 = O0;
3426 Register Oreturn1 = O1;
3427 Register O2UnrollBlock = O2;
3428 Register L0deopt_mode = L0;
3429 Register G4deopt_mode = G4_scratch;
3430 int frame_size_words;
3431 Address saved_Freturn0_addr(FP, -sizeof(double) + STACK_BIAS);
3432 #if !defined(_LP64) && defined(COMPILER2)
3433 Address saved_Greturn1_addr(FP, -sizeof(double) -sizeof(jlong) + STACK_BIAS);
3434 #endif
3615 __ bind(not_long);
3616 #endif
3617 __ ret();
3618 __ delayed()->restore();
3619
3620 masm->flush();
3621 _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_words);
3622 _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset);
3623 }
3624
3625 #ifdef COMPILER2
3626
3627 //------------------------------generate_uncommon_trap_blob--------------------
3628 // Ought to generate an ideal graph & compile, but here's some SPARC ASM
3629 // instead.
3630 void SharedRuntime::generate_uncommon_trap_blob() {
3631 // allocate space for the code
3632 ResourceMark rm;
3633 // setup code generation tools
3634 int pad = VerifyThread ? 512 : 0;
3635 if (UseStackBanging) {
3636 pad += StackShadowPages*16 + 32;
3637 }
3638 #ifdef _LP64
3639 CodeBuffer buffer("uncommon_trap_blob", 2700+pad, 512);
3640 #else
3641 // Measured 8/7/03 at 660 in 32bit debug build (no VerifyThread)
3642 // Measured 8/7/03 at 1028 in 32bit debug build (VerifyThread)
3643 CodeBuffer buffer("uncommon_trap_blob", 2000+pad, 512);
3644 #endif
3645 MacroAssembler* masm = new MacroAssembler(&buffer);
3646 Register O2UnrollBlock = O2;
3647 Register O2klass_index = O2;
3648
3649 //
3650 // This is the entry point for all traps the compiler takes when it thinks
3651 // it cannot handle further execution of compilation code. The frame is
3652 // deoptimized in these cases and converted into interpreter frames for
3653 // execution
3654 // The steps taken by this frame are as follows:
3655 // - push a fake "unpack_frame"
3656 // - call the C routine Deoptimization::uncommon_trap (this function
3657 // packs the current compiled frame into vframe arrays and returns
|
3338 // trash the return value as there is nothing to return yet
3339 __ set(0xDEAD0001, O7);
3340 #endif
3341
3342 __ mov(SP, O5_savedSP);
3343 }
3344
3345
3346 static void make_new_frames(MacroAssembler* masm, bool deopt) {
3347 //
3348 // loop through the UnrollBlock info and create new frames
3349 //
3350 Register G3pcs = G3_scratch;
3351 Register Oreturn0 = O0;
3352 Register Oreturn1 = O1;
3353 Register O2UnrollBlock = O2;
3354 Register O3array = O3;
3355 Register O4array_size = O4;
3356 Label loop;
3357
3358 #ifdef ASSERT
3359 // Compilers generate code that bang the stack by as much as the
3360 // interpreter would need. So this stack banging should never
3361 // trigger a fault. Verify that it does not on non product builds.
3362 if (UseStackBanging) {
3363 // Get total frame size for interpreted frames
3364 __ ld(O2UnrollBlock, Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes(), O4);
3365 __ bang_stack_size(O4, O3, G3_scratch);
3366 }
3367 #endif
3368
3369 __ ld(O2UnrollBlock, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes(), O4array_size);
3370 __ ld_ptr(O2UnrollBlock, Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes(), G3pcs);
3371 __ ld_ptr(O2UnrollBlock, Deoptimization::UnrollBlock::frame_sizes_offset_in_bytes(), O3array);
3372
3373 // Adjust old interpreter frame to make space for new frame's extra java locals
3374 //
3375 // We capture the original sp for the transition frame only because it is needed in
3376 // order to properly calculate interpreter_sp_adjustment. Even though in real life
3377 // every interpreter frame captures a savedSP it is only needed at the transition
3378 // (fortunately). If we had to have it correct everywhere then we would need to
3379 // be told the sp_adjustment for each frame we create. If the frame size array
3380 // were to have twice the frame count entries then we could have pairs [sp_adjustment, frame_size]
3381 // for each frame we create and keep up the illusion every where.
3382 //
3383
3384 __ ld(O2UnrollBlock, Deoptimization::UnrollBlock::caller_adjustment_offset_in_bytes(), O7);
3385 __ mov(SP, O5_savedSP); // remember initial sender's original sp before adjustment
3386 __ sub(SP, O7, SP);
3387
3395 __ bind(loop);
3396
3397 // allocate a new frame, filling the registers
3398
3399 gen_new_frame(masm, deopt); // allocate an interpreter frame
3400
3401 __ cmp_zero_and_br(Assembler::notZero, O4array_size, loop);
3402 __ delayed()->add(O3array, wordSize, O3array);
3403 __ ld_ptr(G3pcs, 0, O7); // load final frame new pc
3404
3405 }
3406
3407 //------------------------------generate_deopt_blob----------------------------
3408 // Ought to generate an ideal graph & compile, but here's some SPARC ASM
3409 // instead.
3410 void SharedRuntime::generate_deopt_blob() {
3411 // allocate space for the code
3412 ResourceMark rm;
3413 // setup code generation tools
3414 int pad = VerifyThread ? 512 : 0;// Extra slop space for more verify code
3415 #ifdef ASSERT
3416 if (UseStackBanging) {
3417 pad += StackShadowPages*16 + 32;
3418 }
3419 #endif
3420 #ifdef _LP64
3421 CodeBuffer buffer("deopt_blob", 2100+pad, 512);
3422 #else
3423 // Measured 8/7/03 at 1212 in 32bit debug build (no VerifyThread)
3424 // Measured 8/7/03 at 1396 in 32bit debug build (VerifyThread)
3425 CodeBuffer buffer("deopt_blob", 1600+pad, 512);
3426 #endif /* _LP64 */
3427 MacroAssembler* masm = new MacroAssembler(&buffer);
3428 FloatRegister Freturn0 = F0;
3429 Register Greturn1 = G1;
3430 Register Oreturn0 = O0;
3431 Register Oreturn1 = O1;
3432 Register O2UnrollBlock = O2;
3433 Register L0deopt_mode = L0;
3434 Register G4deopt_mode = G4_scratch;
3435 int frame_size_words;
3436 Address saved_Freturn0_addr(FP, -sizeof(double) + STACK_BIAS);
3437 #if !defined(_LP64) && defined(COMPILER2)
3438 Address saved_Greturn1_addr(FP, -sizeof(double) -sizeof(jlong) + STACK_BIAS);
3439 #endif
3620 __ bind(not_long);
3621 #endif
3622 __ ret();
3623 __ delayed()->restore();
3624
3625 masm->flush();
3626 _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_words);
3627 _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset);
3628 }
3629
3630 #ifdef COMPILER2
3631
3632 //------------------------------generate_uncommon_trap_blob--------------------
3633 // Ought to generate an ideal graph & compile, but here's some SPARC ASM
3634 // instead.
3635 void SharedRuntime::generate_uncommon_trap_blob() {
3636 // allocate space for the code
3637 ResourceMark rm;
3638 // setup code generation tools
3639 int pad = VerifyThread ? 512 : 0;
3640 #ifdef ASSERT
3641 if (UseStackBanging) {
3642 pad += StackShadowPages*16 + 32;
3643 }
3644 #endif
3645 #ifdef _LP64
3646 CodeBuffer buffer("uncommon_trap_blob", 2700+pad, 512);
3647 #else
3648 // Measured 8/7/03 at 660 in 32bit debug build (no VerifyThread)
3649 // Measured 8/7/03 at 1028 in 32bit debug build (VerifyThread)
3650 CodeBuffer buffer("uncommon_trap_blob", 2000+pad, 512);
3651 #endif
3652 MacroAssembler* masm = new MacroAssembler(&buffer);
3653 Register O2UnrollBlock = O2;
3654 Register O2klass_index = O2;
3655
3656 //
3657 // This is the entry point for all traps the compiler takes when it thinks
3658 // it cannot handle further execution of compilation code. The frame is
3659 // deoptimized in these cases and converted into interpreter frames for
3660 // execution
3661 // The steps taken by this frame are as follows:
3662 // - push a fake "unpack_frame"
3663 // - call the C routine Deoptimization::uncommon_trap (this function
3664 // packs the current compiled frame into vframe arrays and returns
|