2367 2368 // Call C code. Need thread and this frame, but NOT official VM entry 2369 // crud. We cannot block on this call, no GC can happen. 2370 // 2371 // UnrollBlock* fetch_unroll_info(JavaThread* thread) 2372 2373 // fetch_unroll_info needs to call last_java_frame(). 2374 2375 Label retaddr; 2376 __ set_last_Java_frame(sp, noreg, retaddr, rscratch1); 2377 #ifdef ASSERT0 2378 { Label L; 2379 __ ldr(rscratch1, Address(rthread, 2380 JavaThread::last_Java_fp_offset())); 2381 __ cbz(rscratch1, L); 2382 __ stop("SharedRuntime::generate_deopt_blob: last_Java_fp not cleared"); 2383 __ bind(L); 2384 } 2385 #endif // ASSERT 2386 __ mov(c_rarg0, rthread); 2387 __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info))); 2388 __ blrt(rscratch1, 1, 0, 1); 2389 __ bind(retaddr); 2390 2391 // Need to have an oopmap that tells fetch_unroll_info where to 2392 // find any register it might need. 2393 oop_maps->add_gc_map(__ pc() - start, map); 2394 2395 __ reset_last_Java_frame(false, true); 2396 2397 // Load UnrollBlock* into rdi 2398 __ mov(r5, r0); 2399 2400 Label noException; 2401 __ cmpw(rcpool, Deoptimization::Unpack_exception); // Was exception pending? 2402 __ br(Assembler::NE, noException); 2403 __ ldr(r0, Address(rthread, JavaThread::exception_oop_offset())); 2404 // QQQ this is useless it was NULL above 2405 __ ldr(r3, Address(rthread, JavaThread::exception_pc_offset())); 2406 __ str(zr, Address(rthread, JavaThread::exception_oop_offset())); 2407 __ str(zr, Address(rthread, JavaThread::exception_pc_offset())); 2408 2409 __ verify_oop(r0); 2410 2411 // Overwrite the result registers with the exception results. 2412 __ str(r0, Address(sp, RegisterSaver::r0_offset_in_bytes())); 2413 // I think this is useless 2414 // __ str(r3, Address(sp, RegisterSaver::r3_offset_in_bytes())); 2415 2416 __ bind(noException); 2417 2418 // Only register save data is on the stack. 2419 // Now restore the result registers. Everything else is either dead 2592 if (c_rarg1 != j_rarg0) { 2593 __ movw(c_rarg1, j_rarg0); 2594 } 2595 2596 // we need to set the past SP to the stack pointer of the stub frame 2597 // and the pc to the address where this runtime call will return 2598 // although actually any pc in this code blob will do). 2599 Label retaddr; 2600 __ set_last_Java_frame(sp, noreg, retaddr, rscratch1); 2601 2602 // Call C code. Need thread but NOT official VM entry 2603 // crud. We cannot block on this call, no GC can happen. Call should 2604 // capture callee-saved registers as well as return values. 2605 // Thread is in rdi already. 2606 // 2607 // UnrollBlock* uncommon_trap(JavaThread* thread, jint unloaded_class_index); 2608 // 2609 // n.b. 2 gp args, 0 fp args, integral return type 2610 2611 __ mov(c_rarg0, rthread); 2612 __ lea(rscratch1, 2613 RuntimeAddress(CAST_FROM_FN_PTR(address, 2614 Deoptimization::uncommon_trap))); 2615 __ blrt(rscratch1, 2, 0, MacroAssembler::ret_type_integral); 2616 __ bind(retaddr); 2617 2618 // Set an oopmap for the call site 2619 OopMapSet* oop_maps = new OopMapSet(); 2620 OopMap* map = new OopMap(SimpleRuntimeFrame::framesize, 0); 2621 2622 // location of rfp is known implicitly by the frame sender code 2623 2624 oop_maps->add_gc_map(__ pc() - start, map); 2625 2626 __ reset_last_Java_frame(false, true); 2627 2628 // move UnrollBlock* into r4 2629 __ mov(r4, r0); 2630 2631 // Pop all the frames we must move/replace. 2632 // 2633 // Frame picture (youngest to oldest) 2634 // 1: self-frame (no frame link) 2635 // 2: deopting frame (no frame link) 2636 // 3: caller of deopting frame (could be compiled/interpreted). 2637 2638 // Pop self-frame. We have no frame, and must rely only on r0 and sp. 2639 __ add(sp, sp, (SimpleRuntimeFrame::framesize) << LogBytesPerInt); // Epilog! 2640 2641 // Pop deoptimized frame (int) 2642 __ ldrw(r2, Address(r4, 2643 Deoptimization::UnrollBlock:: 2644 size_of_deoptimized_frame_offset_in_bytes())); 2645 __ sub(r2, r2, 2 * wordSize); 2646 __ add(sp, sp, r2); 2647 __ ldp(rfp, lr, __ post(sp, 2 * wordSize)); 2648 // LR should now be the return address to the caller (3) frame 2649 | 2367 2368 // Call C code. Need thread and this frame, but NOT official VM entry 2369 // crud. We cannot block on this call, no GC can happen. 2370 // 2371 // UnrollBlock* fetch_unroll_info(JavaThread* thread) 2372 2373 // fetch_unroll_info needs to call last_java_frame(). 2374 2375 Label retaddr; 2376 __ set_last_Java_frame(sp, noreg, retaddr, rscratch1); 2377 #ifdef ASSERT0 2378 { Label L; 2379 __ ldr(rscratch1, Address(rthread, 2380 JavaThread::last_Java_fp_offset())); 2381 __ cbz(rscratch1, L); 2382 __ stop("SharedRuntime::generate_deopt_blob: last_Java_fp not cleared"); 2383 __ bind(L); 2384 } 2385 #endif // ASSERT 2386 __ mov(c_rarg0, rthread); 2387 __ mov(c_rarg1, rcpool); 2388 __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info))); 2389 __ blrt(rscratch1, 1, 0, 1); 2390 __ bind(retaddr); 2391 2392 // Need to have an oopmap that tells fetch_unroll_info where to 2393 // find any register it might need. 2394 oop_maps->add_gc_map(__ pc() - start, map); 2395 2396 __ reset_last_Java_frame(false, true); 2397 2398 // Load UnrollBlock* into rdi 2399 __ mov(r5, r0); 2400 2401 __ ldrw(rcpool, Address(r5, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes())); 2402 Label noException; 2403 __ cmpw(rcpool, Deoptimization::Unpack_exception); // Was exception pending? 2404 __ br(Assembler::NE, noException); 2405 __ ldr(r0, Address(rthread, JavaThread::exception_oop_offset())); 2406 // QQQ this is useless it was NULL above 2407 __ ldr(r3, Address(rthread, JavaThread::exception_pc_offset())); 2408 __ str(zr, Address(rthread, JavaThread::exception_oop_offset())); 2409 __ str(zr, Address(rthread, JavaThread::exception_pc_offset())); 2410 2411 __ verify_oop(r0); 2412 2413 // Overwrite the result registers with the exception results. 2414 __ str(r0, Address(sp, RegisterSaver::r0_offset_in_bytes())); 2415 // I think this is useless 2416 // __ str(r3, Address(sp, RegisterSaver::r3_offset_in_bytes())); 2417 2418 __ bind(noException); 2419 2420 // Only register save data is on the stack. 2421 // Now restore the result registers. Everything else is either dead 2594 if (c_rarg1 != j_rarg0) { 2595 __ movw(c_rarg1, j_rarg0); 2596 } 2597 2598 // we need to set the past SP to the stack pointer of the stub frame 2599 // and the pc to the address where this runtime call will return 2600 // although actually any pc in this code blob will do). 2601 Label retaddr; 2602 __ set_last_Java_frame(sp, noreg, retaddr, rscratch1); 2603 2604 // Call C code. Need thread but NOT official VM entry 2605 // crud. We cannot block on this call, no GC can happen. Call should 2606 // capture callee-saved registers as well as return values. 2607 // Thread is in rdi already. 2608 // 2609 // UnrollBlock* uncommon_trap(JavaThread* thread, jint unloaded_class_index); 2610 // 2611 // n.b. 2 gp args, 0 fp args, integral return type 2612 2613 __ mov(c_rarg0, rthread); 2614 __ movw(c_rarg2, (unsigned)Deoptimization::Unpack_uncommon_trap); 2615 __ lea(rscratch1, 2616 RuntimeAddress(CAST_FROM_FN_PTR(address, 2617 Deoptimization::uncommon_trap))); 2618 __ blrt(rscratch1, 2, 0, MacroAssembler::ret_type_integral); 2619 __ bind(retaddr); 2620 2621 // Set an oopmap for the call site 2622 OopMapSet* oop_maps = new OopMapSet(); 2623 OopMap* map = new OopMap(SimpleRuntimeFrame::framesize, 0); 2624 2625 // location of rfp is known implicitly by the frame sender code 2626 2627 oop_maps->add_gc_map(__ pc() - start, map); 2628 2629 __ reset_last_Java_frame(false, true); 2630 2631 // move UnrollBlock* into r4 2632 __ mov(r4, r0); 2633 2634 #ifdef ASSERT 2635 { Label L; 2636 __ ldrw(rscratch1, Address(r4, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes())); 2637 __ cmpw(rscratch1, (unsigned)Deoptimization::Unpack_uncommon_trap); 2638 __ br(Assembler::EQ, L); 2639 __ stop("SharedRuntime::generate_deopt_blob: last_Java_fp not cleared"); 2640 __ bind(L); 2641 } 2642 #endif 2643 2644 // Pop all the frames we must move/replace. 2645 // 2646 // Frame picture (youngest to oldest) 2647 // 1: self-frame (no frame link) 2648 // 2: deopting frame (no frame link) 2649 // 3: caller of deopting frame (could be compiled/interpreted). 2650 2651 // Pop self-frame. We have no frame, and must rely only on r0 and sp. 2652 __ add(sp, sp, (SimpleRuntimeFrame::framesize) << LogBytesPerInt); // Epilog! 2653 2654 // Pop deoptimized frame (int) 2655 __ ldrw(r2, Address(r4, 2656 Deoptimization::UnrollBlock:: 2657 size_of_deoptimized_frame_offset_in_bytes())); 2658 __ sub(r2, r2, 2 * wordSize); 2659 __ add(sp, sp, r2); 2660 __ ldp(rfp, lr, __ post(sp, 2 * wordSize)); 2661 // LR should now be the return address to the caller (3) frame 2662 |