Mercurial > hg > graal-jvmci-8
comparison src/cpu/sparc/vm/sharedRuntime_sparc.cpp @ 23408:f84a5ac3be22
make JVMCI JDK immutable and sharable among different JVMCI clients
minimize diff to jvmci-9, including adding support for EnableJVMCI (default is true in jvmci-8)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 30 May 2016 22:56:59 +0200 |
parents | 3ef45d0a6d77 |
children | b5f3a471e646 |
comparison
equal
deleted
inserted
replaced
23407:a1d1f1e4817f | 23408:f84a5ac3be22 |
---|---|
990 } | 990 } |
991 | 991 |
992 // Jump to the compiled code just as if compiled code was doing it. | 992 // Jump to the compiled code just as if compiled code was doing it. |
993 __ ld_ptr(G5_method, in_bytes(Method::from_compiled_offset()), G3); | 993 __ ld_ptr(G5_method, in_bytes(Method::from_compiled_offset()), G3); |
994 #if INCLUDE_JVMCI | 994 #if INCLUDE_JVMCI |
995 // check if this call should be routed towards a specific entry point | 995 if (EnableJVMCI) { |
996 __ ld_ptr(Address(G2_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())), G1); | 996 // check if this call should be routed towards a specific entry point |
997 __ cmp(G0, G1); | 997 __ ld_ptr(Address(G2_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())), G1); |
998 Label no_alternative_target; | 998 __ cmp(G0, G1); |
999 __ br(Assembler::equal, false, Assembler::pn, no_alternative_target); | 999 Label no_alternative_target; |
1000 __ delayed()->nop(); | 1000 __ br(Assembler::equal, false, Assembler::pn, no_alternative_target); |
1001 | 1001 __ delayed()->nop(); |
1002 __ ld_ptr(G2_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset()), G3); | 1002 |
1003 __ st_ptr(G0, Address(G2_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset()))); | 1003 __ ld_ptr(G2_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset()), G3); |
1004 | 1004 __ st_ptr(G0, Address(G2_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset()))); |
1005 __ bind(no_alternative_target); | 1005 |
1006 __ bind(no_alternative_target); | |
1007 } | |
1006 #endif | 1008 #endif |
1007 | 1009 |
1008 // 6243940 We might end up in handle_wrong_method if | 1010 // 6243940 We might end up in handle_wrong_method if |
1009 // the callee is deoptimized as we race thru here. If that | 1011 // the callee is deoptimized as we race thru here. If that |
1010 // happens we don't want to take a safepoint because the | 1012 // happens we don't want to take a safepoint because the |
3467 if (UseStackBanging) { | 3469 if (UseStackBanging) { |
3468 pad += StackShadowPages*16 + 32; | 3470 pad += StackShadowPages*16 + 32; |
3469 } | 3471 } |
3470 #endif | 3472 #endif |
3471 #if INCLUDE_JVMCI | 3473 #if INCLUDE_JVMCI |
3472 pad += 512; // Increase the buffer size when compiling for JVMCI | 3474 if (EnableJVMCI) { |
3475 pad += 512; // Increase the buffer size when compiling for JVMCI | |
3476 } | |
3473 #endif | 3477 #endif |
3474 #ifdef _LP64 | 3478 #ifdef _LP64 |
3475 CodeBuffer buffer("deopt_blob", 2100+pad, 512); | 3479 CodeBuffer buffer("deopt_blob", 2100+pad, 512); |
3476 #else | 3480 #else |
3477 // Measured 8/7/03 at 1212 in 32bit debug build (no VerifyThread) | 3481 // Measured 8/7/03 at 1212 in 32bit debug build (no VerifyThread) |
3537 __ ba(cont); | 3541 __ ba(cont); |
3538 __ delayed()->mov(Deoptimization::Unpack_deopt, L0deopt_mode); | 3542 __ delayed()->mov(Deoptimization::Unpack_deopt, L0deopt_mode); |
3539 | 3543 |
3540 | 3544 |
3541 #if INCLUDE_JVMCI | 3545 #if INCLUDE_JVMCI |
3542 masm->block_comment("BEGIN implicit_exception_uncommon_trap"); | |
3543 int implicit_exception_uncommon_trap_offset = __ offset() - start; | |
3544 __ ld_ptr(G2_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset()), O7); | |
3545 __ st_ptr(G0, Address(G2_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset()))); | |
3546 __ add(O7, -8, O7); | |
3547 | |
3548 int uncommon_trap_offset = __ offset() - start; | |
3549 | |
3550 // Save everything in sight. | |
3551 (void) RegisterSaver::save_live_registers(masm, 0, &frame_size_words); | |
3552 __ set_last_Java_frame(SP, NULL); | |
3553 | |
3554 __ ld(G2_thread, in_bytes(JavaThread::pending_deoptimization_offset()), O1); | |
3555 __ sub(G0, 1, L1); | |
3556 __ st(L1, G2_thread, in_bytes(JavaThread::pending_deoptimization_offset())); | |
3557 | |
3558 __ mov((int32_t)Deoptimization::Unpack_reexecute, L0deopt_mode); | |
3559 __ mov(G2_thread, O0); | |
3560 __ mov(L0deopt_mode, O2); | |
3561 __ call(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)); | |
3562 __ delayed()->nop(); | |
3563 oop_maps->add_gc_map( __ offset()-start, map->deep_copy()); | |
3564 __ get_thread(); | |
3565 __ add(O7, 8, O7); | |
3566 __ reset_last_Java_frame(); | |
3567 | |
3568 Label after_fetch_unroll_info_call; | 3546 Label after_fetch_unroll_info_call; |
3569 __ ba(after_fetch_unroll_info_call); | 3547 int implicit_exception_uncommon_trap_offset = 0; |
3570 __ delayed()->nop(); // Delay slot | 3548 int uncommon_trap_offset = 0; |
3571 masm->block_comment("END implicit_exception_uncommon_trap"); | 3549 |
3550 if (EnableJVMCI) { | |
3551 masm->block_comment("BEGIN implicit_exception_uncommon_trap"); | |
3552 implicit_exception_uncommon_trap_offset = __ offset() - start; | |
3553 __ ld_ptr(G2_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset()), O7); | |
3554 __ st_ptr(G0, Address(G2_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset()))); | |
3555 __ add(O7, -8, O7); | |
3556 | |
3557 uncommon_trap_offset = __ offset() - start; | |
3558 | |
3559 // Save everything in sight. | |
3560 (void) RegisterSaver::save_live_registers(masm, 0, &frame_size_words); | |
3561 __ set_last_Java_frame(SP, NULL); | |
3562 | |
3563 __ ld(G2_thread, in_bytes(JavaThread::pending_deoptimization_offset()), O1); | |
3564 __ sub(G0, 1, L1); | |
3565 __ st(L1, G2_thread, in_bytes(JavaThread::pending_deoptimization_offset())); | |
3566 | |
3567 __ mov((int32_t)Deoptimization::Unpack_reexecute, L0deopt_mode); | |
3568 __ mov(G2_thread, O0); | |
3569 __ mov(L0deopt_mode, O2); | |
3570 __ call(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)); | |
3571 __ delayed()->nop(); | |
3572 oop_maps->add_gc_map( __ offset()-start, map->deep_copy()); | |
3573 __ get_thread(); | |
3574 __ add(O7, 8, O7); | |
3575 __ reset_last_Java_frame(); | |
3576 | |
3577 after_fetch_unroll_info_call; | |
3578 __ ba(after_fetch_unroll_info_call); | |
3579 __ delayed()->nop(); // Delay slot | |
3580 masm->block_comment("END implicit_exception_uncommon_trap"); | |
3581 } // EnableJVMCI | |
3572 #endif // INCLUDE_JVMCI | 3582 #endif // INCLUDE_JVMCI |
3573 | 3583 |
3574 int exception_offset = __ offset() - start; | 3584 int exception_offset = __ offset() - start; |
3575 | 3585 |
3576 // restore G2, the trampoline destroyed it | 3586 // restore G2, the trampoline destroyed it |
3654 __ mov(L7_thread_cache, G2_thread); | 3664 __ mov(L7_thread_cache, G2_thread); |
3655 | 3665 |
3656 __ reset_last_Java_frame(); | 3666 __ reset_last_Java_frame(); |
3657 | 3667 |
3658 #if INCLUDE_JVMCI | 3668 #if INCLUDE_JVMCI |
3659 __ bind(after_fetch_unroll_info_call); | 3669 if (EnableJVMCI) { |
3670 __ bind(after_fetch_unroll_info_call); | |
3671 } | |
3660 #endif | 3672 #endif |
3661 // NOTE: we know that only O0/O1 will be reloaded by restore_result_registers | 3673 // NOTE: we know that only O0/O1 will be reloaded by restore_result_registers |
3662 // so this move will survive | 3674 // so this move will survive |
3663 | 3675 |
3664 __ mov(L0deopt_mode, G4deopt_mode); | 3676 __ mov(L0deopt_mode, G4deopt_mode); |
3723 | 3735 |
3724 masm->flush(); | 3736 masm->flush(); |
3725 _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_words); | 3737 _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_words); |
3726 _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset); | 3738 _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset); |
3727 #if INCLUDE_JVMCI | 3739 #if INCLUDE_JVMCI |
3728 _deopt_blob->set_uncommon_trap_offset(uncommon_trap_offset); | 3740 if (EnableJVMCI) { |
3729 _deopt_blob->set_implicit_exception_uncommon_trap_offset(implicit_exception_uncommon_trap_offset); | 3741 _deopt_blob->set_uncommon_trap_offset(uncommon_trap_offset); |
3742 _deopt_blob->set_implicit_exception_uncommon_trap_offset(implicit_exception_uncommon_trap_offset); | |
3743 } | |
3730 #endif | 3744 #endif |
3731 } | 3745 } |
3732 | 3746 |
3733 #ifdef COMPILER2 | 3747 #ifdef COMPILER2 |
3734 | 3748 |