3712 // use S7 for fetch_unroll_info returned UnrollBlock |
3712 // use S7 for fetch_unroll_info returned UnrollBlock |
3713 Register unroll = S7; |
3713 Register unroll = S7; |
3714 // Prolog for non exception case! |
3714 // Prolog for non exception case! |
3715 // Correct the return address we were given. |
3715 // Correct the return address we were given. |
3716 //FIXME, return address is on the tos or Ra? |
3716 //FIXME, return address is on the tos or Ra? |
3717 __ addi(RA, RA, - (NativeCall::return_address_offset)); |
3717 __ addi(RA, RA, - (NativeCall::return_address_offset_short)); |
3718 // Save everything in sight. |
3718 // Save everything in sight. |
3719 map = RegisterSaver::save_live_registers(masm, additional_words, &frame_size_in_words); |
3719 map = RegisterSaver::save_live_registers(masm, additional_words, &frame_size_in_words); |
3720 // Normal deoptimization |
3720 // Normal deoptimization |
3721 __ move(reason, Deoptimization::Unpack_deopt); |
3721 __ move(reason, Deoptimization::Unpack_deopt); |
3722 __ b(cont); |
3722 __ b(cont); |
3756 |
3756 |
3757 // Return address will be patched later with the throwing pc. The correct value is not |
3757 // Return address will be patched later with the throwing pc. The correct value is not |
3758 // available now because loading it from memory would destroy registers. |
3758 // available now because loading it from memory would destroy registers. |
3759 // Save everything in sight. |
3759 // Save everything in sight. |
3760 // No need to update map as each call to save_live_registers will produce identical oopmap |
3760 // No need to update map as each call to save_live_registers will produce identical oopmap |
3761 __ addi(RA, RA, - (NativeCall::return_address_offset)); |
3761 __ addi(RA, RA, - (NativeCall::return_address_offset_short)); |
3762 (void) RegisterSaver::save_live_registers(masm, additional_words, &frame_size_in_words); |
3762 (void) RegisterSaver::save_live_registers(masm, additional_words, &frame_size_in_words); |
3763 |
3763 |
3764 // Now it is safe to overwrite any register |
3764 // Now it is safe to overwrite any register |
3765 // store the correct deoptimization type |
3765 // store the correct deoptimization type |
3766 __ move(reason, Deoptimization::Unpack_exception); |
3766 __ move(reason, Deoptimization::Unpack_exception); |
3793 // crud. We cannot block on this call, no GC can happen. |
3793 // crud. We cannot block on this call, no GC can happen. |
3794 #ifndef OPT_THREAD |
3794 #ifndef OPT_THREAD |
3795 __ get_thread(thread); |
3795 __ get_thread(thread); |
3796 #endif |
3796 #endif |
3797 |
3797 |
3798 /* |
|
3799 * |
|
3800 0x000000555bd82aec: dadd a0, s6, zero ; __ move(A0, thread); |
|
3801 0x000000555bd82af0: daddi sp, sp, 0xfffffff0 ; __ addi(SP, SP, -additional_words * wordSize); |
|
3802 0x000000555bd82af4: sd sp, 0x1c8(s6) ; __ set_last_Java_frame(thread, NOREG, NOREG, NULL); |
|
3803 0x000000555bd82af8: lui at, 0x0 ; __ li64(AT, save_pc); |
|
3804 0x000000555bd82afc: ori at, at, 0x55 |
|
3805 0x000000555bd82b00: dsll at, at, 16 |
|
3806 0x000000555bd82b04: ori at, at, 0x5bd8 |
|
3807 0x000000555bd82b08: dsll at, at, 16 |
|
3808 0x000000555bd82b0c: ori at, at, 0x2b34 ; save_pc = pc() + NativeMovConstReg::instruction_size + NativeCall::return_address_offset + 4 |
|
3809 0x000000555bd82b10: sd at, 0x1d0(s6) |
|
3810 0x000000555bd82b14: lui t9, 0x0 |
|
3811 0x000000555bd82b18: ori t9, t9, 0x55 |
|
3812 0x000000555bd82b1c: dsll t9, t9, 16 |
|
3813 0x000000555bd82b20: ori t9, t9, 0x5aa6 |
|
3814 0x000000555bd82b24: dsll t9, t9, 16 |
|
3815 0x000000555bd82b28: ori t9, t9, 0x4074 |
|
3816 0x000000555bd82b2c: jalr t9 |
|
3817 0x000000555bd82b30: sll zero, zero, 0 |
|
3818 |
|
3819 0x000000555bd82b34: daddiu sp, sp, 0x10 ; save_pc |
|
3820 */ |
|
3821 __ move(A0, thread); |
3798 __ move(A0, thread); |
3822 __ addi(SP, SP, -additional_words * wordSize); |
3799 __ addi(SP, SP, -additional_words * wordSize); |
3823 |
3800 |
3824 __ set_last_Java_frame(NOREG, NOREG, NULL); |
3801 __ set_last_Java_frame(NOREG, NOREG, NULL); |
3825 |
3802 |
3826 // Call fetch_unroll_info(). Need thread and this frame, but NOT official VM entry - cannot block on |
3803 // Call fetch_unroll_info(). Need thread and this frame, but NOT official VM entry - cannot block on |
3827 // this call, no GC can happen. Call should capture return values. |
3804 // this call, no GC can happen. Call should capture return values. |
3828 |
3805 |
3829 __ relocate(relocInfo::internal_pc_type); |
3806 __ relocate(relocInfo::internal_pc_type); |
3830 { |
3807 { |
3831 intptr_t save_pc = (intptr_t)__ pc() + NativeMovConstReg::instruction_size + NativeCall::return_address_offset + 4; |
3808 intptr_t save_pc = (intptr_t)__ pc() + NativeMovConstReg::instruction_size + 28; |
3832 __ patchable_set48(AT, save_pc); |
3809 __ patchable_set48(AT, save_pc); |
3833 } |
3810 } |
3834 __ sd(AT, thread, in_bytes(JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset())); |
3811 __ sd(AT, thread, in_bytes(JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset())); |
3835 |
3812 |
3836 __ call((address)Deoptimization::fetch_unroll_info); |
3813 __ call((address)Deoptimization::fetch_unroll_info); |
3991 __ move(AT, -(StackAlignmentInBytes)); |
3968 __ move(AT, -(StackAlignmentInBytes)); |
3992 __ andr(SP, SP, AT); // Fix stack alignment as required by ABI |
3969 __ andr(SP, SP, AT); // Fix stack alignment as required by ABI |
3993 |
3970 |
3994 __ relocate(relocInfo::internal_pc_type); |
3971 __ relocate(relocInfo::internal_pc_type); |
3995 { |
3972 { |
3996 intptr_t save_pc = (intptr_t)__ pc() + NativeMovConstReg::instruction_size + NativeCall::return_address_offset + 4; |
3973 intptr_t save_pc = (intptr_t)__ pc() + NativeMovConstReg::instruction_size + 28; |
3997 __ patchable_set48(AT, save_pc); |
3974 __ patchable_set48(AT, save_pc); |
3998 } |
3975 } |
3999 __ sd(AT, thread, in_bytes(JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset())); |
3976 __ sd(AT, thread, in_bytes(JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset())); |
4000 |
3977 |
4001 //__ call(Deoptimization::unpack_frames); |
3978 //__ call(Deoptimization::unpack_frames); |
4089 __ get_thread(thread); |
4066 __ get_thread(thread); |
4090 #endif |
4067 #endif |
4091 // set last_Java_sp |
4068 // set last_Java_sp |
4092 __ set_last_Java_frame(NOREG, FP, NULL); |
4069 __ set_last_Java_frame(NOREG, FP, NULL); |
4093 __ relocate(relocInfo::internal_pc_type); |
4070 __ relocate(relocInfo::internal_pc_type); |
4094 assert(NativeCall::return_address_offset == 24, "in sharedRuntime return_address_offset"); |
|
4095 { |
4071 { |
4096 long save_pc = (long)__ pc() + 28 + NativeCall::return_address_offset; |
4072 long save_pc = (long)__ pc() + 52; |
4097 __ patchable_set48(AT, (long)save_pc); |
4073 __ patchable_set48(AT, (long)save_pc); |
4098 __ sd(AT, thread, in_bytes(JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset())); |
4074 __ sd(AT, thread, in_bytes(JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset())); |
4099 } |
4075 } |
4100 // Call C code. Need thread but NOT official VM entry |
4076 // Call C code. Need thread but NOT official VM entry |
4101 // crud. We cannot block on this call, no GC can happen. Call should |
4077 // crud. We cannot block on this call, no GC can happen. Call should |
4102 // capture callee-saved registers as well as return values. |
4078 // capture callee-saved registers as well as return values. |
4103 __ move(A0, thread); |
4079 __ move(A0, thread); |
4104 // argument already in T0 |
4080 // argument already in T0 |
4105 __ move(A1, T0); |
4081 __ move(A1, T0); |
4106 __ set64(T9, (long)Deoptimization::uncommon_trap); |
4082 __ patchable_set48(T9, (long)Deoptimization::uncommon_trap); |
4107 __ jalr(T9); |
4083 __ jalr(T9); |
4108 __ delayed()->nop(); |
4084 __ delayed()->nop(); |
4109 |
4085 |
4110 // Set an oopmap for the call site |
4086 // Set an oopmap for the call site |
4111 OopMapSet *oop_maps = new OopMapSet(); |
4087 OopMapSet *oop_maps = new OopMapSet(); |
4213 __ move(AT, -(StackAlignmentInBytes)); |
4189 __ move(AT, -(StackAlignmentInBytes)); |
4214 __ andr(SP, SP, AT); // Fix stack alignment as required by ABI |
4190 __ andr(SP, SP, AT); // Fix stack alignment as required by ABI |
4215 |
4191 |
4216 __ relocate(relocInfo::internal_pc_type); |
4192 __ relocate(relocInfo::internal_pc_type); |
4217 { |
4193 { |
4218 long save_pc = (long)__ pc() + 28 + NativeCall::return_address_offset; |
4194 long save_pc = (long)__ pc() + 52; |
4219 __ patchable_set48(AT, (long)save_pc); |
4195 __ patchable_set48(AT, (long)save_pc); |
4220 } |
4196 } |
4221 __ sd(AT, thread,in_bytes(JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset())); |
4197 __ sd(AT, thread,in_bytes(JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset())); |
4222 |
4198 |
4223 // Call C code. Need thread but NOT official VM entry |
4199 // Call C code. Need thread but NOT official VM entry |
4224 // crud. We cannot block on this call, no GC can happen. Call should |
4200 // crud. We cannot block on this call, no GC can happen. Call should |
4225 // restore return values to their stack-slots with the new SP. |
4201 // restore return values to their stack-slots with the new SP. |
4226 __ move(A0, thread); |
4202 __ move(A0, thread); |
4227 __ move(A1, Deoptimization::Unpack_uncommon_trap); |
4203 __ move(A1, Deoptimization::Unpack_uncommon_trap); |
4228 __ set64(T9, (long)Deoptimization::unpack_frames); |
4204 __ patchable_set48(T9, (long)Deoptimization::unpack_frames); |
4229 __ jalr(T9); |
4205 __ jalr(T9); |
4230 __ delayed()->nop(); |
4206 __ delayed()->nop(); |
4231 // Set an oopmap for the call site |
4207 // Set an oopmap for the call site |
4232 //oop_maps->add_gc_map( __ offset(), true, new OopMap( framesize, 0 ) ); |
4208 //oop_maps->add_gc_map( __ offset(), true, new OopMap( framesize, 0 ) ); |
4233 oop_maps->add_gc_map( __ offset(), new OopMap( framesize, 0 ) );//Fu |
4209 oop_maps->add_gc_map( __ offset(), new OopMap( framesize, 0 ) );//Fu |
4404 //align the stack before invoke native |
4380 //align the stack before invoke native |
4405 __ move(AT, -(StackAlignmentInBytes)); |
4381 __ move(AT, -(StackAlignmentInBytes)); |
4406 __ andr(SP, SP, AT); |
4382 __ andr(SP, SP, AT); |
4407 __ relocate(relocInfo::internal_pc_type); |
4383 __ relocate(relocInfo::internal_pc_type); |
4408 { |
4384 { |
4409 intptr_t save_pc = (intptr_t)__ pc() + NativeMovConstReg::instruction_size + NativeCall::return_address_offset + 1 * BytesPerInstWord; |
4385 intptr_t save_pc = (intptr_t)__ pc() + NativeMovConstReg::instruction_size + 24 + 1 * BytesPerInstWord; |
4410 //tty->print_cr(" %s :%d, name:%s, pc: %lx, save_pc: %lx, frame_size_words: %lx", __func__, __LINE__, name, __ pc(), save_pc, frame_size_words); //aoqi_test |
4386 //tty->print_cr(" %s :%d, name:%s, pc: %lx, save_pc: %lx, frame_size_words: %lx", __func__, __LINE__, name, __ pc(), save_pc, frame_size_words); //aoqi_test |
4411 __ patchable_set48(AT, save_pc); |
4387 __ patchable_set48(AT, save_pc); |
4412 } |
4388 } |
4413 __ sd(AT, thread, in_bytes(JavaThread::last_Java_pc_offset())); |
4389 __ sd(AT, thread, in_bytes(JavaThread::last_Java_pc_offset())); |
4414 |
4390 |