summaryrefslogtreecommitdiff
path: root/utils/genapply
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-10-03 09:30:56 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-10-08 09:04:40 +0100
commita7c0387d20c1c9994d1100b14fbb8fb4e28a259e (patch)
treeb95d0a512f951a4a463f1aa5178b0cd5c4fdb410 /utils/genapply
parentaed37acd4d157791381800d5de960a2461bcbef3 (diff)
downloadhaskell-a7c0387d20c1c9994d1100b14fbb8fb4e28a259e.tar.gz
Produce new-style Cmm from the Cmm parser
The main change here is that the Cmm parser now allows high-level cmm code with argument-passing and function calls. For example: foo ( gcptr a, bits32 b ) { if (b > 0) { // we can make tail calls passing arguments: jump stg_ap_0_fast(a); } return (x,y); } More details on the new cmm syntax are in Note [Syntax of .cmm files] in CmmParse.y. The old syntax is still more-or-less supported for those occasional code fragments that really need to explicitly manipulate the stack. However there are a couple of differences: it is now obligatory to give a list of live GlobalRegs on every jump, e.g. jump %ENTRY_CODE(Sp(0)) [R1]; Again, more details in Note [Syntax of .cmm files]. I have rewritten most of the .cmm files in the RTS into the new syntax, except for AutoApply.cmm which is generated by the genapply program: this file could be generated in the new syntax instead and would probably be better off for it, but I ran out of enthusiasm. Some other changes in this batch: - The PrimOp calling convention is gone, primops now use the ordinary NativeNodeCall convention. This means that primops and "foreign import prim" code must be written in high-level cmm, but they can now take more than 10 arguments. - CmmSink now does constant-folding (should fix #7219) - .cmm files now go through the cmmPipeline, and as a result we generate better code in many cases. All the object files generated for the RTS .cmm files are now smaller. Performance should be better too, but I haven't measured it yet. - RET_DYN frames are removed from the RTS, lots of code goes away - we now have some more canned GC points to cover unboxed-tuples with 2-4 pointers, which will reduce code size a little.
Diffstat (limited to 'utils/genapply')
-rw-r--r--utils/genapply/GenApply.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/utils/genapply/GenApply.hs b/utils/genapply/GenApply.hs
index 18a2f85a12..e859184c59 100644
--- a/utils/genapply/GenApply.hs
+++ b/utils/genapply/GenApply.hs
@@ -232,7 +232,7 @@ genMkPAP regstatus macro jump ticker disamb
if is_fun_case then mb_tag_node arity else empty,
if overflow_regs
then text "jump_SAVE_CCCS" <> parens (text jump) <> semi
- else text "jump " <> text jump <> semi
+ else text "jump " <> text jump <+> text "[*]" <> semi
]) $$
text "}"
@@ -334,7 +334,7 @@ genMkPAP regstatus macro jump ticker disamb
then text "R2 = " <> fun_info_label <> semi
else empty,
if is_fun_case then mb_tag_node n_args else empty,
- text "jump " <> text jump <> semi
+ text "jump " <> text jump <+> text "[*]" <> semi
])
-- The LARGER ARITY cases:
@@ -416,7 +416,7 @@ enterFastPathHelper tag regstatus no_load_regs args_in_regs args =
reg_doc,
text " Sp_adj(" <> int sp' <> text ");",
-- enter, but adjust offset with tag
- text " jump " <> text "%GET_ENTRY(R1-" <> int tag <> text ");",
+ text " jump " <> text "%GET_ENTRY(R1-" <> int tag <> text ") [*];",
text "}"
]
-- I don't totally understand this code, I copied it from
@@ -478,7 +478,7 @@ genApply regstatus args =
in
vcat [
text "INFO_TABLE_RET(" <> mkApplyName args <> text ", " <>
- text "RET_SMALL, " <> (cat $ zipWith formalParam args [1..]) <>
+ text "RET_SMALL, W_ info_ptr, " <> (cat $ zipWith formalParam args [1..]) <>
text ")\n{",
nest 4 (vcat [
text "W_ info;",
@@ -701,7 +701,7 @@ genApplyFast regstatus args =
nest 4 (vcat [
text "Sp_adj" <> parens (int (-sp_offset)) <> semi,
saveRegOffs reg_locs,
- text "jump" <+> fun_ret_label <> semi
+ text "jump" <+> fun_ret_label <+> text "[*]" <> semi
]),
char '}'
]),
@@ -739,7 +739,7 @@ genStackApply regstatus args =
(assign_regs, sp') = loadRegArgs regstatus 0 args
body = vcat [assign_regs,
text "Sp_adj" <> parens (int sp') <> semi,
- text "jump %GET_ENTRY(UNTAG(R1));"
+ text "jump %GET_ENTRY(UNTAG(R1)) [*];"
]
-- -----------------------------------------------------------------------------
@@ -766,7 +766,7 @@ genStackSave regstatus args =
text "Sp(2) = R1;",
text "Sp(1) =" <+> int stk_args <> semi,
text "Sp(0) = stg_gc_fun_info;",
- text "jump stg_gc_noregs;"
+ text "jump stg_gc_noregs [];"
]
std_frame_size = 3 -- the std bits of the frame. See StgRetFun in Closures.h,