# HG changeset patch # User Gary Benson # Date 1232652461 18000 # Node ID eb8b5c5aa4db038fb1f78ca09ff7b563833c8ccf # Parent c29bbfa41f2b03576d99af8ba7f7f8aa6e1fb0b9 2009-01-22 Gary Benson * ports/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp: (CppInterpreter::native_entry): Correctly handle asynchronous exceptions during post-call thread state transition. diff -r c29bbfa41f2b -r eb8b5c5aa4db ChangeLog --- a/ChangeLog Thu Jan 22 14:18:45 2009 -0500 +++ b/ChangeLog Thu Jan 22 14:27:41 2009 -0500 @@ -1,5 +1,11 @@ +2009-01-22 Gary Benson + + * ports/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp: + (CppInterpreter::native_entry): Correctly handle asynchronous + exceptions during post-call thread state transition. + 2009-01-22 Omair Majid - Ioana Ivan + Ioana Ivan * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java (start): Return silently if already started. diff -r c29bbfa41f2b -r eb8b5c5aa4db ports/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp --- a/ports/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Thu Jan 22 14:18:45 2009 -0500 +++ b/ports/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp Thu Jan 22 14:27:41 2009 -0500 @@ -292,15 +292,43 @@ // Set up the Java frame anchor thread->set_last_Java_frame(); - // Change the thread state to native + // Change the thread state to _thread_in_native ThreadStateTransition::transition_from_java(thread, _thread_in_native); // Make the call intptr_t result[4 - LogBytesPerWord]; ffi_call(handler->cif(), (void (*)()) function, result, arguments); - // Change the thread state back to Java - ThreadStateTransition::transition_from_native(thread, _thread_in_Java); + // Change the thread state back to _thread_in_Java. + // ThreadStateTransition::transition_from_native() cannot be used + // here because it does not check for asynchronous exceptions. + // We have to manage the transition ourself. + thread->set_thread_state(_thread_in_native_trans); + + // Make sure new state is visible in the GC thread + if (os::is_MP()) { + if (UseMembar) { + OrderAccess::fence(); + } + else { + InterfaceSupport::serialize_memory(thread); + } + } + + // We need to call check_special_condition_for_native_trans() if + // any of the thread's suspend flags are set. We can't use the + // various accessors because thread->_suspend_flags is volatile + // and may change while we're reading it. + volatile uint32_t *suspend_flags; + suspend_flags = (uint32_t *) + ((address) thread + in_bytes(JavaThread::suspend_flags_offset())); + if (*suspend_flags != 0) { + JavaThread::check_special_condition_for_native_trans(thread); + CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops()); + } + + // Finally we can change the thread state to _thread_in_Java. + thread->set_thread_state(_thread_in_Java); fixup_after_potential_safepoint(); // Clear the frame anchor