From nobody Mon Sep 17 00:00:00 2001 From: Pavel Afremov Date: Thu, 5 Apr 2007 19:38:34 +0400 Subject: [PATCH] Fix exn_raised assertion during finalization start up. Fix consist in: • save exception before start java method in Objects_To_Finalize::run_finalizers and • restore it after java method. --- vm/vmcore/src/init/finalize.cpp | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) mode change 100644 => 100755 vm/vmcore/src/init/finalize.cpp 561f23c6da7610eea367fa00ebea0f780b253fa0 diff --git a/vm/vmcore/src/init/finalize.cpp b/vm/vmcore/src/init/finalize.cpp old mode 100644 new mode 100755 index 0ec7b0b..f0cd66c --- a/vm/vmcore/src/init/finalize.cpp +++ b/vm/vmcore/src/init/finalize.cpp @@ -394,6 +394,11 @@ void Objects_To_Finalize::run_finalizers p_TLS_vmthread->finalize_thread_flags |= FINALIZER_STARTER; TRACE2("finalize", "run_finalizers() started"); + + // saves curent thread exception risen before running finalizers + // if any and clears it to allow java to work + jthrowable cte = exn_get(); + exn_clear(); if (FRAME_COMPILATION == (FRAME_COMPILATION | m2n_get_frame_type(m2n_get_last_frame()))) { @@ -426,6 +431,11 @@ #ifndef NDEBUG } #endif exn_clear(); + + // restores curent thread exception risen before if any + if (NULL != cte) { + exn_raise_object(cte); + } p_TLS_vmthread->finalize_thread_flags &= ~FINALIZER_STARTER; } //Objects_To_Finalize::run_finalizers @@ -537,6 +547,11 @@ void References_To_Enqueue::enqueue_refe args[0].l = (jobject) handle; + // saves curent thread exception risen before enqueuing references + // if any and clears it to allow java to work + jthrowable cte = exn_get(); + exn_clear(); + while(true) { tmn_suspend_disable(); ManagedObject* object = remove_object(); @@ -544,6 +559,10 @@ void References_To_Enqueue::enqueue_refe tmn_suspend_enable(); if (object == NULL) { + // restores curent thread exception risen before if any + if (NULL != cte) { + exn_raise_object(cte); + } return; } tmn_suspend_disable(); @@ -571,6 +590,10 @@ #ifndef NDEBUG #endif exn_clear(); } + // restores curent thread exception risen before if any + if (NULL != cte) { + exn_raise_object(cte); + } TRACE2("ref", "enqueue_references() completed"); } //Objects_To_Finalize::notify_reference_queues -- 1.3.3