[commit: ghc] master: Code generation: Always ask for result of newSpark (237159c)

David Terei davidterei at gmail.com
Tue Dec 6 08:16:15 CET 2011


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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/237159c2285b4073f300c3ea5cfb471529f185fb

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

commit 237159c2285b4073f300c3ea5cfb471529f185fb
Author: Peter Wortmann <scpmw at leeds.ac.uk>
Date:   Mon Dec 5 13:32:19 2011 -0800

    Code generation: Always ask for result of newSpark
    
    Otherwise the LLVM backend gets confused over whether its type should be
    "void (i8*, i8*)" or "i64 (i8*, i8*)".
    
    Signed-off-by: David Terei <davidterei at gmail.com>

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

 compiler/codeGen/CgPrimOp.hs   |    4 +++-
 compiler/codeGen/StgCmmPrim.hs |    3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/compiler/codeGen/CgPrimOp.hs b/compiler/codeGen/CgPrimOp.hs
index 43a570d..e912a08 100644
--- a/compiler/codeGen/CgPrimOp.hs
+++ b/compiler/codeGen/CgPrimOp.hs
@@ -145,7 +145,9 @@ emitPrimOp [res] SparkOp [arg] live = do
     stmtC (CmmAssign (CmmLocal tmp) arg)
 
     vols <- getVolatileRegs live
-    emitForeignCall' PlayRisky []
+    res' <- newTemp bWord
+    emitForeignCall' PlayRisky
+        [CmmHinted res' NoHint]
     	(CmmCallee newspark CCallConv) 
 	[   (CmmHinted (CmmReg (CmmGlobal BaseReg)) AddrHint)
           , (CmmHinted arg AddrHint)  ] 
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index a2337ae..1795b55 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -223,8 +223,9 @@ emitPrimOp [res] SparkOp [arg]
         -- refer to arg twice (once to pass to newSpark(), and once to
         -- assign to res), so put it in a temporary.
         tmp <- assignTemp arg
+        tmp2 <- newTemp bWord
         emitCCall
-            []
+            [(tmp2,NoHint)]
             (CmmLit (CmmLabel (mkCmmCodeLabel rtsPackageId (fsLit "newSpark"))))
             [(CmmReg (CmmGlobal BaseReg), AddrHint), ((CmmReg (CmmLocal tmp)), AddrHint)]
         emit (mkAssign (CmmLocal res) (CmmReg (CmmLocal tmp)))





More information about the Cvs-ghc mailing list