src/cpu/x86/vm/templateInterpreter_x86_64.cpp

Print this page
rev 6214 : 8039146: Fix 64-bit store to int JNIHandleBlock::_top


1242     // runtime call by hand.
1243     //
1244     __ mov(c_rarg0, r15_thread);
1245     __ mov(r12, rsp); // remember sp (can only use r12 if not using call_VM)
1246     __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
1247     __ andptr(rsp, -16); // align stack as required by ABI
1248     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans)));
1249     __ mov(rsp, r12); // restore sp
1250     __ reinit_heapbase();
1251     __ bind(Continue);
1252   }
1253 
1254   // change thread state
1255   __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_Java);
1256 
1257   // reset_last_Java_frame
1258   __ reset_last_Java_frame(true, true);
1259 
1260   // reset handle block
1261   __ movptr(t, Address(r15_thread, JavaThread::active_handles_offset()));
1262   __ movptr(Address(t, JNIHandleBlock::top_offset_in_bytes()), (int32_t)NULL_WORD);
1263 
1264   // If result is an oop unbox and store it in frame where gc will see it
1265   // and result handler will pick it up
1266 
1267   {
1268     Label no_oop, store_result;
1269     __ lea(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT)));
1270     __ cmpptr(t, Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize));
1271     __ jcc(Assembler::notEqual, no_oop);
1272     // retrieve result
1273     __ pop(ltos);
1274     __ testptr(rax, rax);
1275     __ jcc(Assembler::zero, store_result);
1276     __ movptr(rax, Address(rax, 0));
1277     __ bind(store_result);
1278     __ movptr(Address(rbp, frame::interpreter_frame_oop_temp_offset*wordSize), rax);
1279     // keep stack depth as expected by pushing oop which will eventually be discarde
1280     __ push(ltos);
1281     __ bind(no_oop);
1282   }




1242     // runtime call by hand.
1243     //
1244     __ mov(c_rarg0, r15_thread);
1245     __ mov(r12, rsp); // remember sp (can only use r12 if not using call_VM)
1246     __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
1247     __ andptr(rsp, -16); // align stack as required by ABI
1248     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans)));
1249     __ mov(rsp, r12); // restore sp
1250     __ reinit_heapbase();
1251     __ bind(Continue);
1252   }
1253 
1254   // change thread state
1255   __ movl(Address(r15_thread, JavaThread::thread_state_offset()), _thread_in_Java);
1256 
1257   // reset_last_Java_frame
1258   __ reset_last_Java_frame(true, true);
1259 
1260   // reset handle block
1261   __ movptr(t, Address(r15_thread, JavaThread::active_handles_offset()));
1262   __ movl(Address(t, JNIHandleBlock::top_offset_in_bytes()), (int32_t)NULL_WORD);
1263 
1264   // If result is an oop unbox and store it in frame where gc will see it
1265   // and result handler will pick it up
1266 
1267   {
1268     Label no_oop, store_result;
1269     __ lea(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT)));
1270     __ cmpptr(t, Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize));
1271     __ jcc(Assembler::notEqual, no_oop);
1272     // retrieve result
1273     __ pop(ltos);
1274     __ testptr(rax, rax);
1275     __ jcc(Assembler::zero, store_result);
1276     __ movptr(rax, Address(rax, 0));
1277     __ bind(store_result);
1278     __ movptr(Address(rbp, frame::interpreter_frame_oop_temp_offset*wordSize), rax);
1279     // keep stack depth as expected by pushing oop which will eventually be discarde
1280     __ push(ltos);
1281     __ bind(no_oop);
1282   }