summaryrefslogtreecommitdiff
path: root/compiler/cmm/CmmParse.y
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@mit.edu>2013-08-26 14:52:37 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2014-10-01 22:26:38 -0700
commit3b5a840bba375c4c4c11ccfeb283f84c3a1ef22c (patch)
tree0463f156f7ae946744de0cdcda2fb9ffc58f93f3 /compiler/cmm/CmmParse.y
parentb23ba2a7d612c6b466521399b33fe9aacf5c4f75 (diff)
downloadhaskell-3b5a840bba375c4c4c11ccfeb283f84c3a1ef22c.tar.gz
BC-breaking changes to C-- CLOSURE syntax.
Summary: Previously, there were two variants of CLOSURE in C--: - Top-level CLOSURE(foo_closure, foo, lits...), which defines a new static closure and gives it a name, and - Array CLOSURE(foo, lits...), which was used for the static char and integer arrays. They used the same name, were confusing, and didn't even generate the correct internal label representation! So now, we have two new forms: - Top-level CLOSURE(foo, lits...) which automatically generates foo_closure (along with foo_info, which we were doing already) - Array ANONYMOUS_CLOSURE(foo, lits...) which doesn't generate a foo_closure identifier. Part of remove HEAP_ALLOCED patch set (#8199) Signed-off-by: Edward Z. Yang <ezyang@mit.edu> Test Plan: validate Reviewers: simonmar, austin Subscribers: simonmar, ezyang, carter, thomie Differential Revision: https://phabricator.haskell.org/D264 GHC Trac Issues: #8199
Diffstat (limited to 'compiler/cmm/CmmParse.y')
-rw-r--r--compiler/cmm/CmmParse.y17
1 files changed, 9 insertions, 8 deletions
diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y
index db6cc49927..3bd0053cfc 100644
--- a/compiler/cmm/CmmParse.y
+++ b/compiler/cmm/CmmParse.y
@@ -300,6 +300,7 @@ 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) }
@@ -369,10 +370,10 @@ cmmtop :: { CmmParse () }
: cmmproc { $1 }
| cmmdata { $1 }
| decl { $1 }
- | 'CLOSURE' '(' NAME ',' NAME lits ')' ';'
+ | 'CLOSURE' '(' NAME lits ')' ';'
{% withThisPackage $ \pkg ->
- do lits <- sequence $6;
- staticClosure pkg $3 $5 (map getLit lits) }
+ do lits <- sequence $4;
+ staticClosure pkg $3 (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
@@ -411,7 +412,7 @@ static :: { CmmParse [CmmStatic] }
| typenot8 '[' INT ']' ';' { return [CmmUninitialised
(widthInBytes (typeWidth $1) *
fromIntegral $3)] }
- | 'CLOSURE' '(' NAME lits ')'
+ | 'ANONYMOUS_CLOSURE' '(' NAME lits ')'
{ do { lits <- sequence $4
; dflags <- getDynFlags
; return $ map CmmStaticLit $
@@ -1101,11 +1102,11 @@ profilingInfo dflags desc_str ty_str
else ProfilingInfo (stringToWord8s desc_str)
(stringToWord8s ty_str)
-staticClosure :: PackageKey -> FastString -> FastString -> [CmmLit] -> CmmParse ()
-staticClosure pkg cl_label info payload
+staticClosure :: PackageKey -> FastString -> [CmmLit] -> CmmParse ()
+staticClosure pkg label payload
= do dflags <- getDynFlags
- let lits = mkStaticClosure dflags (mkCmmInfoLabel pkg info) dontCareCCS payload [] [] []
- code $ emitStaticClosure (mkCmmDataLabel pkg cl_label) lits
+ let lits = mkStaticClosure dflags (mkCmmInfoLabel pkg label) dontCareCCS payload [] [] []
+ code $ emitStaticClosure (mkCmmClosureLabel pkg label) lits
foreignCall
:: String