[commit: ghc] master: Revert "BC-breaking changes to C-- CLOSURE syntax." (a3860fc)

git at git.haskell.org git at git.haskell.org
Mon Oct 20 23:28:59 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/a3860fc4e253ecb4854e86aed78c56e72f318840/ghc

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

commit a3860fc4e253ecb4854e86aed78c56e72f318840
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Mon Oct 20 16:01:45 2014 -0700

    Revert "BC-breaking changes to C-- CLOSURE syntax."
    
    This reverts commit 3b5a840bba375c4c4c11ccfeb283f84c3a1ef22c.


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

a3860fc4e253ecb4854e86aed78c56e72f318840
 compiler/cmm/CLabel.hs  |  4 ++--
 compiler/cmm/CmmLex.x   |  2 --
 compiler/cmm/CmmParse.y | 17 ++++++++---------
 rts/StgMiscClosures.cmm | 20 ++++++++++----------
 4 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
index c5afa09..0f2c0ae 100644
--- a/compiler/cmm/CLabel.hs
+++ b/compiler/cmm/CLabel.hs
@@ -333,9 +333,9 @@ data CmmLabelInfo
   | CmmEntry                    -- ^ misc rts entry points,     suffix _entry
   | CmmRetInfo                  -- ^ misc rts ret info tables,  suffix _info
   | CmmRet                      -- ^ misc rts return points,    suffix _ret
-  | CmmData                     -- ^ misc rts data bits
+  | CmmData                     -- ^ misc rts data bits, eg CHARLIKE_closure
   | CmmCode                     -- ^ misc rts code
-  | CmmClosure                  -- ^ misc rts closures,         suffix _closure
+  | CmmClosure                  -- ^ closures eg CHARLIKE_closure
   | CmmPrimCall                 -- ^ a prim call to some hand written Cmm code
   deriving (Eq, Ord)
 
diff --git a/compiler/cmm/CmmLex.x b/compiler/cmm/CmmLex.x
index dfbb751..f56db7b 100644
--- a/compiler/cmm/CmmLex.x
+++ b/compiler/cmm/CmmLex.x
@@ -135,7 +135,6 @@ data CmmToken
   | CmmT_Ne
   | CmmT_BoolAnd
   | CmmT_BoolOr
-  | CmmT_ANONYMOUS_CLOSURE
   | CmmT_CLOSURE
   | CmmT_INFO_TABLE
   | CmmT_INFO_TABLE_RET
@@ -219,7 +218,6 @@ name span buf len =
 
 reservedWordsFM = listToUFM $
         map (\(x, y) -> (mkFastString x, y)) [
-        ( "ANONYMOUS_CLOSURE",  CmmT_ANONYMOUS_CLOSURE ),
         ( "CLOSURE",            CmmT_CLOSURE ),
         ( "INFO_TABLE",         CmmT_INFO_TABLE ),
         ( "INFO_TABLE_RET",     CmmT_INFO_TABLE_RET ),
diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y
index 3bd0053..db6cc49 100644
--- a/compiler/cmm/CmmParse.y
+++ b/compiler/cmm/CmmParse.y
@@ -300,7 +300,6 @@ import Data.Maybe
         '||'    { L _ (CmmT_BoolOr) }
 
         'CLOSURE'       { L _ (CmmT_CLOSURE) }
-        'ANONYMOUS_CLOSURE'{ L _ (CmmT_ANONYMOUS_CLOSURE) }
         'INFO_TABLE'    { L _ (CmmT_INFO_TABLE) }
         'INFO_TABLE_RET'{ L _ (CmmT_INFO_TABLE_RET) }
         'INFO_TABLE_FUN'{ L _ (CmmT_INFO_TABLE_FUN) }
@@ -370,10 +369,10 @@ cmmtop  :: { CmmParse () }
         : cmmproc                       { $1 }
         | cmmdata                       { $1 }
         | decl                          { $1 } 
-        | 'CLOSURE' '(' NAME lits ')' ';'  
+        | 'CLOSURE' '(' NAME ',' NAME lits ')' ';'  
                 {% withThisPackage $ \pkg -> 
-                   do lits <- sequence $4;
-                      staticClosure pkg $3 (map getLit lits) }
+                   do lits <- sequence $6;
+                      staticClosure pkg $3 $5 (map getLit lits) }
 
 -- The only static closures in the RTS are dummy closures like
 -- stg_END_TSO_QUEUE_closure and stg_dummy_ret.  We don't need
@@ -412,7 +411,7 @@ static  :: { CmmParse [CmmStatic] }
         | typenot8 '[' INT ']' ';'      { return [CmmUninitialised 
                                                 (widthInBytes (typeWidth $1) * 
                                                         fromIntegral $3)] }
-        | 'ANONYMOUS_CLOSURE' '(' NAME lits ')'
+        | 'CLOSURE' '(' NAME lits ')'
                 { do { lits <- sequence $4
                 ; dflags <- getDynFlags
                      ; return $ map CmmStaticLit $
@@ -1102,11 +1101,11 @@ profilingInfo dflags desc_str ty_str
     else ProfilingInfo (stringToWord8s desc_str)
                        (stringToWord8s ty_str)
 
-staticClosure :: PackageKey -> FastString -> [CmmLit] -> CmmParse ()
-staticClosure pkg label payload
+staticClosure :: PackageKey -> FastString -> FastString -> [CmmLit] -> CmmParse ()
+staticClosure pkg cl_label info payload
   = do dflags <- getDynFlags
-       let lits = mkStaticClosure dflags (mkCmmInfoLabel pkg label) dontCareCCS payload [] [] []
-       code $ emitStaticClosure (mkCmmClosureLabel pkg label) lits
+       let lits = mkStaticClosure dflags (mkCmmInfoLabel pkg info) dontCareCCS payload [] [] []
+       code $ emitStaticClosure (mkCmmDataLabel pkg cl_label) lits
 
 foreignCall
         :: String
diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm
index 85ecb5e..42ef39e 100644
--- a/rts/StgMiscClosures.cmm
+++ b/rts/StgMiscClosures.cmm
@@ -457,7 +457,7 @@ INFO_TABLE_CONSTR(stg_C_FINALIZER_LIST,1,4,0,CONSTR,"C_FINALIZER_LIST","C_FINALI
 INFO_TABLE_CONSTR(stg_NO_FINALIZER,0,0,0,CONSTR_NOCAF_STATIC,"NO_FINALIZER","NO_FINALIZER")
 { foreign "C" barf("NO_FINALIZER object entered!") never returns; }
 
-CLOSURE(stg_NO_FINALIZER);
+CLOSURE(stg_NO_FINALIZER_closure,stg_NO_FINALIZER);
 
 /* ----------------------------------------------------------------------------
    Stable Names are unlifted too.
@@ -516,13 +516,13 @@ INFO_TABLE_CONSTR(stg_END_STM_CHUNK_LIST,0,0,0,CONSTR_NOCAF_STATIC,"END_STM_CHUN
 INFO_TABLE_CONSTR(stg_NO_TREC,0,0,0,CONSTR_NOCAF_STATIC,"NO_TREC","NO_TREC")
 { foreign "C" barf("NO_TREC object entered!") never returns; }
 
-CLOSURE(stg_END_STM_WATCH_QUEUE);
+CLOSURE(stg_END_STM_WATCH_QUEUE_closure,stg_END_STM_WATCH_QUEUE);
 
-CLOSURE(stg_END_INVARIANT_CHECK_QUEUE);
+CLOSURE(stg_END_INVARIANT_CHECK_QUEUE_closure,stg_END_INVARIANT_CHECK_QUEUE);
 
-CLOSURE(stg_END_STM_CHUNK_LIST);
+CLOSURE(stg_END_STM_CHUNK_LIST_closure,stg_END_STM_CHUNK_LIST);
 
-CLOSURE(stg_NO_TREC);
+CLOSURE(stg_NO_TREC_closure,stg_NO_TREC);
 
 /* ----------------------------------------------------------------------------
    Messages
@@ -553,7 +553,7 @@ INFO_TABLE_CONSTR(stg_MSG_NULL,1,0,0,PRIM,"MSG_NULL","MSG_NULL")
 INFO_TABLE_CONSTR(stg_END_TSO_QUEUE,0,0,0,CONSTR_NOCAF_STATIC,"END_TSO_QUEUE","END_TSO_QUEUE")
 { foreign "C" barf("END_TSO_QUEUE object entered!") never returns; }
 
-CLOSURE(stg_END_TSO_QUEUE);
+CLOSURE(stg_END_TSO_QUEUE_closure,stg_END_TSO_QUEUE);
 
 /* ----------------------------------------------------------------------------
    GCD_CAF
@@ -572,7 +572,7 @@ INFO_TABLE_CONSTR(stg_GCD_CAF,0,0,0,CONSTR_NOCAF_STATIC,"GCD_CAF","GCD_CAF")
 INFO_TABLE_CONSTR(stg_STM_AWOKEN,0,0,0,CONSTR_NOCAF_STATIC,"STM_AWOKEN","STM_AWOKEN")
 { foreign "C" barf("STM_AWOKEN object entered!") never returns; }
 
-CLOSURE(stg_STM_AWOKEN);
+CLOSURE(stg_STM_AWOKEN_closure,stg_STM_AWOKEN);
 
 /* ----------------------------------------------------------------------------
    Arrays
@@ -638,7 +638,7 @@ INFO_TABLE( stg_dummy_ret, 0, 0, CONSTR_NOCAF_STATIC, "DUMMY_RET", "DUMMY_RET")
 {
     return ();
 }
-CLOSURE(stg_dummy_ret);
+CLOSURE(stg_dummy_ret_closure,stg_dummy_ret);
 
 /* ----------------------------------------------------------------------------
    MVAR_TSO_QUEUE
@@ -673,8 +673,8 @@ INFO_TABLE_CONSTR(stg_MVAR_TSO_QUEUE,2,0,0,PRIM,"MVAR_TSO_QUEUE","MVAR_TSO_QUEUE
 #endif
 
 
-#define CHARLIKE_HDR(n)  ANONYMOUS_CLOSURE(Char_hash_static_info, n)
-#define INTLIKE_HDR(n)   ANONYMOUS_CLOSURE(Int_hash_static_info, n)
+#define CHARLIKE_HDR(n)  CLOSURE(Char_hash_static_info, n)
+#define INTLIKE_HDR(n)   CLOSURE(Int_hash_static_info, n)
 
 /* put these in the *data* section, since the garbage collector relies
  * on the fact that static closures live in the data section.



More information about the ghc-commits mailing list