summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@mit.edu>2013-08-26 15:23:15 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2014-10-01 22:26:39 -0700
commit35672072b4091d6f0031417bc160c568f22d0469 (patch)
tree243925bae6f8869cca1df8595c17c0467b9d5998 /compiler
parent178eb9060f369b216f3f401196e28eab4af5624d (diff)
downloadhaskell-35672072b4091d6f0031417bc160c568f22d0469.tar.gz
Rename _closure to _static_closure, apply naming consistently.
Summary: In preparation for indirecting all references to closures, we rename _closure to _static_closure to ensure any old code will get an undefined symbol error. In order to reference a closure foobar_closure (which is now undefined), you should instead use STATIC_CLOSURE(foobar). For convenience, a number of these old identifiers are macro'd. Across C-- and C (Windows and otherwise), there were differing conventions on whether or not foobar_closure or &foobar_closure was the address of the closure. Now, all foobar_closure references are addresses, and no & is necessary. CHARLIKE/INTLIKE were not changed, simply alpha-renamed. Part of remove HEAP_ALLOCED patch set (#8199) Depends on D265 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/D267 GHC Trac Issues: #8199
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cmm/CLabel.hs4
-rw-r--r--compiler/deSugar/DsForeign.lhs6
-rw-r--r--compiler/ghci/ByteCodeLink.lhs4
-rw-r--r--compiler/main/DriverPipeline.hs4
4 files changed, 9 insertions, 9 deletions
diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
index c5afa09d75..ed2f477bc3 100644
--- a/compiler/cmm/CLabel.hs
+++ b/compiler/cmm/CLabel.hs
@@ -1084,7 +1084,7 @@ pprCLbl (CmmLabel _ fs CmmRet)
= ftext fs <> ptext (sLit "_ret")
pprCLbl (CmmLabel _ fs CmmClosure)
- = ftext fs <> ptext (sLit "_closure")
+ = ftext fs <> ptext (sLit "_static_closure")
pprCLbl (RtsLabel (RtsPrimOp primop))
= ptext (sLit "stg_") <> ppr primop
@@ -1114,7 +1114,7 @@ pprCLbl (DeadStripPreventer {}) = panic "pprCLbl DeadStripPreventer"
ppIdFlavor :: IdLabelInfo -> SDoc
ppIdFlavor x = pp_cSEP <>
(case x of
- Closure -> ptext (sLit "closure")
+ Closure -> ptext (sLit "static_closure")
SRT -> ptext (sLit "srt")
InfoTable -> ptext (sLit "info")
LocalInfoTable -> ptext (sLit "info")
diff --git a/compiler/deSugar/DsForeign.lhs b/compiler/deSugar/DsForeign.lhs
index c60e9146bc..94ae779751 100644
--- a/compiler/deSugar/DsForeign.lhs
+++ b/compiler/deSugar/DsForeign.lhs
@@ -598,7 +598,7 @@ mkFExportCBits dflags c_nm maybe_target arg_htys res_hty is_IO_res_ty cc
the_cfun
= case maybe_target of
Nothing -> text "(StgClosure*)deRefStablePtr(the_stableptr)"
- Just hs_fn -> char '&' <> ppr hs_fn <> text "_closure"
+ Just hs_fn -> text "STATIC_CLOSURE(" <> ppr hs_fn <> text ")"
cap = text "cap" <> comma
@@ -623,7 +623,7 @@ mkFExportCBits dflags c_nm maybe_target arg_htys res_hty is_IO_res_ty cc
extern_decl
= case maybe_target of
Nothing -> empty
- Just hs_fn -> text "extern StgClosure " <> ppr hs_fn <> text "_closure" <> semi
+ Just hs_fn -> text "extern StgClosure " <> ppr hs_fn <> text "_static_closure" <> semi
-- finally, the whole darn thing
@@ -679,7 +679,7 @@ foreignExportInitialiser hs_fn =
<> text "() __attribute__((constructor));"
, text "static void stginit_export_" <> ppr hs_fn <> text "()"
, braces (text "foreignExportStablePtr"
- <> parens (text "(StgPtr) &" <> ppr hs_fn <> text "_closure")
+ <> parens (text "(StgPtr) &" <> ppr hs_fn <> text "_static_closure")
<> semi)
]
diff --git a/compiler/ghci/ByteCodeLink.lhs b/compiler/ghci/ByteCodeLink.lhs
index cbedb717fe..af31dc19e7 100644
--- a/compiler/ghci/ByteCodeLink.lhs
+++ b/compiler/ghci/ByteCodeLink.lhs
@@ -203,7 +203,7 @@ lookupStaticPtr addr_of_label_string
lookupPrimOp :: PrimOp -> IO HValue
lookupPrimOp primop
- = do let sym_to_find = primopToCLabel primop "closure"
+ = do let sym_to_find = primopToCLabel primop "static_closure"
m <- lookupSymbol sym_to_find
case m of
Just (Ptr addr) -> case addrToAny# addr of
@@ -216,7 +216,7 @@ lookupName ce nm
Just (_,aa) -> return aa
Nothing
-> ASSERT2(isExternalName nm, ppr nm)
- do let sym_to_find = nameToCLabel nm "closure"
+ do let sym_to_find = nameToCLabel nm "static_closure"
m <- lookupSymbol sym_to_find
case m of
Just (Ptr addr) -> case addrToAny# addr of
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 0e17793e07..ca720070c0 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1596,7 +1596,7 @@ mkExtraObjToLinkIntoBinary dflags = do
| gopt Opt_NoHsMain dflags = Outputable.empty
| otherwise = vcat [
ptext (sLit "#include \"Rts.h\""),
- ptext (sLit "extern StgClosure ZCMain_main_closure;"),
+ ptext (sLit "extern StgClosure ZCMain_main_static_closure;"),
ptext (sLit "int main(int argc, char *argv[])"),
char '{',
ptext (sLit " RtsConfig __conf = defaultRtsConfig;"),
@@ -1607,7 +1607,7 @@ mkExtraObjToLinkIntoBinary dflags = do
Just opts -> ptext (sLit " __conf.rts_opts= ") <>
text (show opts) <> semi,
ptext (sLit " __conf.rts_hs_main = rtsTrue;"),
- ptext (sLit " return hs_main(argc, argv, &ZCMain_main_closure,__conf);"),
+ ptext (sLit " return hs_main(argc, argv, &ZCMain_main_static_closure,__conf);"),
char '}',
char '\n' -- final newline, to keep gcc happy
]