nodeMustPointToIt

Wolfgang Thaller wolfgang.thaller at gmx.net
Wed Feb 11 11:23:23 EST 2004


It seems to me that in CgHeapery.hpStkCheck, the result of 
nodeMustPointToIt is interpreted the wrong way round.
Also, the names of the stg_gc_* functions don't quite agree with what 
is currently defined in the RTS (stg_gc_fun and stg_gc_enter_1 ought to 
be __stg_gc_fun and __stg_gc_enter_1).
With the attached patch (and a dummy definition for ImpossibleBranch in 
the RTS), I am now able to compile and link a simple Haskell program 
(main = return ()). Of course, it crashes.

Cheers,

Wolfgang

-- cut here --

Index: compiler/codeGen/CgHeapery.lhs
===================================================================
RCS file: /home/cvs/root/fptools/ghc/compiler/codeGen/CgHeapery.lhs,v
retrieving revision 1.39.4.14
diff -c -r1.39.4.14 CgHeapery.lhs
*** compiler/codeGen/CgHeapery.lhs	5 Feb 2004 10:44:22 -0000	1.39.4.14
--- compiler/codeGen/CgHeapery.lhs	11 Feb 2004 09:52:16 -0000
***************
*** 270,284 ****
     where
       node_asst
   	| nodeMustPointToIt (closureLFInfo cl_info)
- 	= oneStmt (CmmAssign nodeReg (CmmLit (CmmLabel closure_lbl)))
- 	| otherwise
   	= noStmts
       closure_lbl = closureLabelFromCI cl_info

       full_save_code = node_asst `plusStmts` reg_save_code

!     rts_label | is_fun    = mkRtsCodeLabel SLIT( "stg_gc_fun")	-- 
Function entry point
! 	      | otherwise = mkRtsCodeLabel SLIT( "stg_gc_enter_1")	-- Thunk 
or case return
   	-- In the thunk/case-return case, R1 points to a closure
   	-- which should be (re)-entered after GC
   \end{code}
--- 270,284 ----
     where
       node_asst
   	| nodeMustPointToIt (closureLFInfo cl_info)
   	= noStmts
+ 	| otherwise
+ 	= oneStmt (CmmAssign nodeReg (CmmLit (CmmLabel closure_lbl)))
       closure_lbl = closureLabelFromCI cl_info

       full_save_code = node_asst `plusStmts` reg_save_code

!     rts_label | is_fun    = mkRtsCodeLabel SLIT( "__stg_gc_fun")	-- 
Function entry point
! 	      | otherwise = mkRtsCodeLabel SLIT( "__stg_gc_enter_1")	-- 
Thunk or case return
   	-- In the thunk/case-return case, R1 points to a closure
   	-- which should be (re)-entered after GC
   \end{code}
***************
*** 324,330 ****
   	--
   	-- However R1 is guaranteed to be a pointer

!     rts_label (AlgAlt tc) = mkRtsCodeLabel SLIT( "stg_gc_enter_1")
   	-- Enter R1 after the heap check; it's a pointer
    	
       rts_label (PrimAlt tc)
--- 324,330 ----
   	--
   	-- However R1 is guaranteed to be a pointer

!     rts_label (AlgAlt tc) = mkRtsCodeLabel SLIT( "__stg_gc_enter_1")
   	-- Enter R1 after the heap check; it's a pointer
    	
       rts_label (PrimAlt tc)



More information about the Cvs-ghc mailing list