harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r526220 - /harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp
Date Fri, 06 Apr 2007 16:37:05 GMT
Author: gshimansky
Date: Fri Apr  6 09:37:04 2007
New Revision: 526220

URL: http://svn.apache.org/viewvc?view=rev&rev=526220
Log:
Applied HARMONY-1650 [drlvm][exception handling] enqueuing references, doing finalization,
running finalizers can lose a risen exception


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp?view=diff&rev=526220&r1=526219&r2=526220
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp Fri Apr  6 09:37:04 2007
@@ -394,6 +394,11 @@
 
     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 @@
     }
 #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 @@
 
     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 @@
         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();
@@ -570,6 +589,10 @@
         }
 #endif
         exn_clear();
+    }
+    // restores curent thread exception risen before if any
+    if (NULL != cte) {
+        exn_raise_object(cte);
     }
 
     TRACE2("ref", "enqueue_references() completed");



Mime
View raw message