Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/8b25d3953f2fa7055dc217e77a849cac92d2aa78

>---------------------------------------------------------------

commit 8b25d3953f2fa7055dc217e77a849cac92d2aa78
Author: Simon Marlow <marlo...@gmail.com>
Date:   Fri Nov 2 11:28:16 2012 +0000

    Save R1/R2/.. across foreign calls

>---------------------------------------------------------------

 rts/Exception.cmm |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/rts/Exception.cmm b/rts/Exception.cmm
index 3f1dc10..2b63328 100644
--- a/rts/Exception.cmm
+++ b/rts/Exception.cmm
@@ -55,6 +55,9 @@ INFO_TABLE_RET(stg_unmaskAsyncExceptionszh_ret, RET_SMALL, W_ 
info_ptr)
 {
     CInt r;
 
+    P_ ret;
+    ret = R1;
+
     StgTSO_flags(CurrentTSO) = %lobits32(
       TO_W_(StgTSO_flags(CurrentTSO)) & ~(TSO_BLOCKEX|TSO_INTERRUPTIBLE));
 
@@ -68,18 +71,18 @@ INFO_TABLE_RET(stg_unmaskAsyncExceptionszh_ret, RET_SMALL, 
W_ info_ptr)
          * thread, which might result in the thread being killed.
          */
         Sp_adj(-2);
-        Sp(1) = R1;
+        Sp(1) = ret;
         Sp(0) = stg_ret_p_info;
         SAVE_THREAD_STATE();
         (r) = ccall maybePerformBlockedException (MyCapability() "ptr", 
                                                       CurrentTSO "ptr");
-
         if (r != 0::CInt) {
             if (StgTSO_what_next(CurrentTSO) == ThreadKilled::I16) {
                 jump stg_threadFinished [];
             } else {
                 LOAD_THREAD_STATE();
                 ASSERT(StgTSO_what_next(CurrentTSO) == ThreadRunGHC::I16);
+                R1 = ret;
                 jump %ENTRY_CODE(Sp(0)) [R1];
             }
         }
@@ -94,6 +97,7 @@ INFO_TABLE_RET(stg_unmaskAsyncExceptionszh_ret, RET_SMALL, W_ 
info_ptr)
     }
 
     Sp_adj(1);
+    R1 = ret;
     jump %ENTRY_CODE(Sp(0)) [R1];
 }
 
@@ -184,7 +188,10 @@ stg_unmaskAsyncExceptionszh /* explicit stack */
     W_ level;
 
     /* Args: R1 :: IO a */
-    STK_CHK_P (WDS(4), stg_unmaskAsyncExceptionszh, R1);
+    P_ io;
+    io = R1;
+
+    STK_CHK_P (WDS(4), stg_unmaskAsyncExceptionszh, io);
     /* 4 words: one for the unblock frame, 3 for setting up the
      * stack to call maybePerformBlockedException() below.
      */
@@ -222,7 +229,7 @@ stg_unmaskAsyncExceptionszh /* explicit stack */
              */
             Sp_adj(-3);
             Sp(2) = stg_ap_v_info;
-            Sp(1) = R1;
+            Sp(1) = io;
             Sp(0) = stg_enter_info;
 
             SAVE_THREAD_STATE();
@@ -235,6 +242,7 @@ stg_unmaskAsyncExceptionszh /* explicit stack */
                } else {
                    LOAD_THREAD_STATE();
                    ASSERT(StgTSO_what_next(CurrentTSO) == ThreadRunGHC::I16);
+                    R1 = io;
                     jump %ENTRY_CODE(Sp(0)) [R1];
                }
             } else {
@@ -246,6 +254,7 @@ stg_unmaskAsyncExceptionszh /* explicit stack */
     }
     TICK_UNKNOWN_CALL();
     TICK_SLOW_CALL_v();
+    R1 = io;
     jump stg_ap_v_fast [R1];
 }
 



_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to