From e7693760c38d6524bb98f386e0da67f2f707c81e Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 1 May 2002 13:16:04 +0000 Subject: [PATCH] [project @ 2002-05-01 13:16:04 by simonmar] Re-add reallyUnsafePtrEquality# (hey, it's really easy to add primops these days!). --- ghc/compiler/absCSyn/AbsCUtils.lhs | 12 ++++++++++-- ghc/compiler/prelude/primops.txt.pp | 12 +++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ghc/compiler/absCSyn/AbsCUtils.lhs b/ghc/compiler/absCSyn/AbsCUtils.lhs index 90988cd..1a3fcf8 100644 --- a/ghc/compiler/absCSyn/AbsCUtils.lhs +++ b/ghc/compiler/absCSyn/AbsCUtils.lhs @@ -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 diff --git a/ghc/compiler/prelude/primops.txt.pp b/ghc/compiler/prelude/primops.txt.pp index 2a58a75..fc134c0 100644 --- a/ghc/compiler/prelude/primops.txt.pp +++ b/ghc/compiler/prelude/primops.txt.pp @@ -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" ------------------------------------------------------------------------ -- 1.7.10.4