[project @ 2002-05-01 13:16:04 by simonmar]
authorsimonmar <unknown>
Wed, 1 May 2002 13:16:04 +0000 (13:16 +0000)
committersimonmar <unknown>
Wed, 1 May 2002 13:16:04 +0000 (13:16 +0000)
Re-add reallyUnsafePtrEquality# (hey, it's really easy to add primops
these days!).

ghc/compiler/absCSyn/AbsCUtils.lhs
ghc/compiler/prelude/primops.txt.pp

index 90988cd..1a3fcf8 100644 (file)
@@ -31,8 +31,8 @@ import Unique         ( Unique{-instance Eq-} )
 import UniqSupply      ( uniqFromSupply, uniqsFromSupply, splitUniqSupply, 
                          UniqSupply )
 import CmdLineOpts      ( opt_EmitCExternDecls, opt_Unregisterised )
-import ForeignCall     ( ForeignCall(..), CCallSpec(..), CCallTarget(..), Safety(..),
-                         isDynamicTarget, isCasmTarget, defaultCCallConv )
+import ForeignCall     ( ForeignCall(..), CCallSpec(..),
+                         isDynamicTarget, isCasmTarget )
 import StgSyn          ( StgOp(..) )
 import SMRep           ( arrPtrsHdrSize, arrWordsHdrSize, fixedHdrSize )
 import Outputable
@@ -896,6 +896,14 @@ dscCOpStmt [res] EqStableNameOp [arg1,arg2] vols
         CMachOpStmt res MO_Nat_Eq [sn1,sn2] Nothing
      ]
 
+dscCOpStmt [res] ReallyUnsafePtrEqualityOp [arg1,arg2] vols
+   = mkTemps [WordRep, WordRep]        `thenFlt` \ [w1,w2] ->
+     (returnFlt . CSequential) [
+       CMachOpStmt w1 MO_NatP_to_NatU [arg1] Nothing,
+       CMachOpStmt w2 MO_NatP_to_NatU [arg2] Nothing,
+        CMachOpStmt res MO_Nat_Eq [w1,w2] Nothing{- because it's inline? -}
+     ]
+
 -- #define addrToHValuezh(r,a) r=(P_)a
 dscCOpStmt [res] AddrToHValueOp [arg] vols
    = returnFlt 
index 2a58a75..fc134c0 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------
--- $Id: primops.txt.pp,v 1.18 2002/04/10 11:43:43 stolz Exp $
+-- $Id: primops.txt.pp,v 1.19 2002/05/01 13:16:04 simonmar Exp $
 --
 -- Primitive Operations
 --
@@ -1521,6 +1521,16 @@ primop  StableNameToIntOp "stableNameToInt#" GenPrimOp
    usage = { mangle StableNameToIntOp [mkP] mkR }
 
 ------------------------------------------------------------------------
+section "Unsafe pointer equality"
+--  (#1 Bad Guy: Alistair Reid :)   
+------------------------------------------------------------------------
+
+primop  ReallyUnsafePtrEqualityOp "reallyUnsafePtrEquality#" GenPrimOp
+   a -> a -> Int#
+   with
+   usage = { mangle ReallyUnsafePtrEqualityOp [mkZ, mkZ] mkR }
+
+------------------------------------------------------------------------
 section "Parallelism"
 ------------------------------------------------------------------------