< prev index next >

src/cpu/zero/vm/cppInterpreter_zero.cpp

Print this page
rev 13142 : 8183198: Factor out thread state serialization into a proper helper function
Reviewed-by:


 361     }
 362   }
 363 
 364   // Set up the Java frame anchor
 365   thread->set_last_Java_frame();
 366 
 367   // Change the thread state to _thread_in_native
 368   ThreadStateTransition::transition_from_java(thread, _thread_in_native);
 369 
 370   // Make the call
 371   intptr_t result[4 - LogBytesPerWord];
 372   ffi_call(handler->cif(), (void (*)()) function, result, arguments);
 373 
 374   // Change the thread state back to _thread_in_Java.
 375   // ThreadStateTransition::transition_from_native() cannot be used
 376   // here because it does not check for asynchronous exceptions.
 377   // We have to manage the transition ourself.
 378   thread->set_thread_state(_thread_in_native_trans);
 379 
 380   // Make sure new state is visible in the GC thread
 381   if (os::is_MP()) {
 382     if (UseMembar) {
 383       OrderAccess::fence();
 384     }
 385     else {
 386       InterfaceSupport::serialize_memory(thread);
 387     }
 388   }
 389 
 390   // Handle safepoint operations, pending suspend requests,
 391   // and pending asynchronous exceptions.
 392   if (SafepointSynchronize::do_call_back() ||
 393       thread->has_special_condition_for_native_trans()) {
 394     JavaThread::check_special_condition_for_native_trans(thread);
 395     CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops());
 396   }
 397 
 398   // Finally we can change the thread state to _thread_in_Java.
 399   thread->set_thread_state(_thread_in_Java);
 400   fixup_after_potential_safepoint();
 401 
 402   // Clear the frame anchor
 403   thread->reset_last_Java_frame();
 404 
 405   // If the result was an oop then unbox it and store it in
 406   // oop_temp where the garbage collector can see it before
 407   // we release the handle it might be protected by.
 408   if (handler->result_type() == &ffi_type_pointer) {




 361     }
 362   }
 363 
 364   // Set up the Java frame anchor
 365   thread->set_last_Java_frame();
 366 
 367   // Change the thread state to _thread_in_native
 368   ThreadStateTransition::transition_from_java(thread, _thread_in_native);
 369 
 370   // Make the call
 371   intptr_t result[4 - LogBytesPerWord];
 372   ffi_call(handler->cif(), (void (*)()) function, result, arguments);
 373 
 374   // Change the thread state back to _thread_in_Java.
 375   // ThreadStateTransition::transition_from_native() cannot be used
 376   // here because it does not check for asynchronous exceptions.
 377   // We have to manage the transition ourself.
 378   thread->set_thread_state(_thread_in_native_trans);
 379 
 380   // Make sure new state is visible in the GC thread
 381   InterfaceSupport::serialize_thread_state(thread);







 382 
 383   // Handle safepoint operations, pending suspend requests,
 384   // and pending asynchronous exceptions.
 385   if (SafepointSynchronize::do_call_back() ||
 386       thread->has_special_condition_for_native_trans()) {
 387     JavaThread::check_special_condition_for_native_trans(thread);
 388     CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops());
 389   }
 390 
 391   // Finally we can change the thread state to _thread_in_Java.
 392   thread->set_thread_state(_thread_in_Java);
 393   fixup_after_potential_safepoint();
 394 
 395   // Clear the frame anchor
 396   thread->reset_last_Java_frame();
 397 
 398   // If the result was an oop then unbox it and store it in
 399   // oop_temp where the garbage collector can see it before
 400   // we release the handle it might be protected by.
 401   if (handler->result_type() == &ffi_type_pointer) {


< prev index next >