[commit: ghc] master: rts/Compact.cmm: fix UNREG build failure (c480860)

git at git.haskell.org git at git.haskell.org
Sat Dec 17 16:53:14 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/c4808602124577217dbd39576c120a77f923ca6f/ghc

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

commit c4808602124577217dbd39576c120a77f923ca6f
Author: Sergei Trofimovich <siarheit at google.com>
Date:   Sat Dec 17 13:39:18 2016 +0000

    rts/Compact.cmm: fix UNREG build failure
    
    The change does the following:
    - Add explicit declaration of exception closures
      from base. C backend needs those symbols to be
      visible.
    - Reorder cmm functions in use order. Again C
      backend needs symbol declaration/definition
      before use. even for module-local cmm functions.
    
    Fixes the following build failure:
    
      rts_dist_HC rts/dist/build/Compact.o
        In file included from /tmp/ghc3348_0/ghc_4.hc:3:0: error:
        /tmp/ghc3348_0/ghc_4.hc: In function 'stg_compactAddWithSharingzh':
    
        /tmp/ghc3348_0/ghc_4.hc:27:11: error:
         error: 'stg_compactAddWorkerzh' undeclared (first use in this function)
         JMP_((W_)&stg_compactAddWorkerzh);
                   ^
        ...
        /tmp/ghc3348_0/ghc_4.hc:230:13: error:
         error: 'base_GHCziIOziException_cannotCompactMutable_closure'
         undeclared (first use in this function)
         R1.w = (W_)&base_GHCziIOziException_cannotCompactMutable_closure;
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Sergei Trofimovich <siarheit at google.com>


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

c4808602124577217dbd39576c120a77f923ca6f
 rts/Compact.cmm | 109 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 55 insertions(+), 54 deletions(-)

diff --git a/rts/Compact.cmm b/rts/Compact.cmm
index fe54d2a..0b98f39 100644
--- a/rts/Compact.cmm
+++ b/rts/Compact.cmm
@@ -10,60 +10,9 @@
 #include "Cmm.h"
 #include "sm/ShouldCompact.h"
 
-
-//
-// compactAddWithSharing#
-//   :: State# RealWorld
-//   -> Compact#
-//   -> a
-//   -> (# State# RealWorld, a #)
-//
-stg_compactAddWithSharingzh (P_ compact, P_ p)
-{
-    W_ hash;
-    ASSERT(StgCompactNFData_hash(compact) == NULL);
-    (hash) = ccall allocHashTable();
-    StgCompactNFData_hash(compact) = hash;
-
-    // Note [compactAddWorker result]
-    //
-    // compactAddWorker needs somewhere to store the result - this is
-    // so that it can be tail-recursive.  It must be an address that
-    // doesn't move during GC, so we can't use heap or stack.
-    // Therefore we have a special field in the StgCompactNFData
-    // object to hold the final result of compaction.
-    W_ pp;
-    pp = compact + SIZEOF_StgHeader + OFFSET_StgCompactNFData_result;
-    call stg_compactAddWorkerzh(compact, p, pp);
-    ccall freeHashTable(StgCompactNFData_hash(compact), NULL);
-    StgCompactNFData_hash(compact) = NULL;
-#ifdef DEBUG
-    ccall verifyCompact(compact);
-#endif
-    return (P_[pp]);
-}
-
-
-//
-// compactAdd#
-//   :: State# RealWorld
-//   -> Compact#
-//   -> a
-//   -> (# State# RealWorld, a #)
-//
-stg_compactAddzh (P_ compact, P_ p)
-{
-    ASSERT(StgCompactNFData_hash(compact) == NULL);
-
-    W_ pp; // See Note [compactAddWorker result]
-    pp = compact + SIZEOF_StgHeader + OFFSET_StgCompactNFData_result;
-    call stg_compactAddWorkerzh(compact, p, pp);
-#ifdef DEBUG
-    ccall verifyCompact(compact);
-#endif
-    return (P_[pp]);
-}
-
+import CLOSURE base_GHCziIOziException_cannotCompactFunction_closure;
+import CLOSURE base_GHCziIOziException_cannotCompactMutable_closure;
+import CLOSURE base_GHCziIOziException_cannotCompactPinned_closure;
 
 //
 // Allocate space for a new object in the compact region.  We first try
@@ -310,6 +259,58 @@ eval:
     ccall barf("stg_compactWorkerzh");
 }
 
+//
+// compactAddWithSharing#
+//   :: State# RealWorld
+//   -> Compact#
+//   -> a
+//   -> (# State# RealWorld, a #)
+//
+stg_compactAddWithSharingzh (P_ compact, P_ p)
+{
+    W_ hash;
+    ASSERT(StgCompactNFData_hash(compact) == NULL);
+    (hash) = ccall allocHashTable();
+    StgCompactNFData_hash(compact) = hash;
+
+    // Note [compactAddWorker result]
+    //
+    // compactAddWorker needs somewhere to store the result - this is
+    // so that it can be tail-recursive.  It must be an address that
+    // doesn't move during GC, so we can't use heap or stack.
+    // Therefore we have a special field in the StgCompactNFData
+    // object to hold the final result of compaction.
+    W_ pp;
+    pp = compact + SIZEOF_StgHeader + OFFSET_StgCompactNFData_result;
+    call stg_compactAddWorkerzh(compact, p, pp);
+    ccall freeHashTable(StgCompactNFData_hash(compact), NULL);
+    StgCompactNFData_hash(compact) = NULL;
+#ifdef DEBUG
+    ccall verifyCompact(compact);
+#endif
+    return (P_[pp]);
+}
+
+//
+// compactAdd#
+//   :: State# RealWorld
+//   -> Compact#
+//   -> a
+//   -> (# State# RealWorld, a #)
+//
+stg_compactAddzh (P_ compact, P_ p)
+{
+    ASSERT(StgCompactNFData_hash(compact) == NULL);
+
+    W_ pp; // See Note [compactAddWorker result]
+    pp = compact + SIZEOF_StgHeader + OFFSET_StgCompactNFData_result;
+    call stg_compactAddWorkerzh(compact, p, pp);
+#ifdef DEBUG
+    ccall verifyCompact(compact);
+#endif
+    return (P_[pp]);
+}
+
 stg_compactSizzezh (P_ compact)
 {
    return (StgCompactNFData_totalW(compact) * SIZEOF_W);



More information about the ghc-commits mailing list