Commit c4808602 authored by Sergei Trofimovich's avatar Sergei Trofimovich

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: default avatarSergei Trofimovich <siarheit@google.com>
parent a6657bd0
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment