summaryrefslogtreecommitdiff
path: root/rts/HeapStackCheck.cmm
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2013-09-17 21:48:39 +0100
committerSimon Marlow <marlowsd@gmail.com>2013-10-01 11:10:08 +0100
commit11b5ce550d1a9bc84dd97629e1cca0b356054898 (patch)
tree5446e455f6165f50291c8877fdead17b74cae13f /rts/HeapStackCheck.cmm
parent56084d76eb1b57ad96a9e1c55f3d3e2d134f98d5 (diff)
downloadhaskell-11b5ce550d1a9bc84dd97629e1cca0b356054898.tar.gz
Remove use of R9, and fix associated bugs
We were passing the function address to stg_gc_prim_p in R9, which was wrong because the call was a high-level call and didn't declare R9 as a parameter. Passing R9 as an argument is the right way, but unfortunately that exposed another bug: we were using the same macro in some low-level Cmm, where it is illegal to call functions with arguments (see Note [syntax of cmm files]). So we now have low-level variants of STK_CHK() and STK_CHK_P() for use in low-level Cmm code.
Diffstat (limited to 'rts/HeapStackCheck.cmm')
-rw-r--r--rts/HeapStackCheck.cmm40
1 files changed, 28 insertions, 12 deletions
diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm
index e130cb3660..d826529aef 100644
--- a/rts/HeapStackCheck.cmm
+++ b/rts/HeapStackCheck.cmm
@@ -172,38 +172,54 @@ __stg_gc_enter_1 (P_ node)
code in a few common cases.
-------------------------------------------------------------------------- */
-stg_gc_prim ()
+stg_gc_prim (W_ fun)
{
- W_ fun;
- fun = R9;
call stg_gc_noregs ();
jump fun();
}
-stg_gc_prim_p (P_ arg)
+stg_gc_prim_p (P_ arg, W_ fun)
{
- W_ fun;
- fun = R9;
call stg_gc_noregs ();
jump fun(arg);
}
-stg_gc_prim_pp (P_ arg1, P_ arg2)
+stg_gc_prim_pp (P_ arg1, P_ arg2, W_ fun)
{
- W_ fun;
- fun = R9;
call stg_gc_noregs ();
jump fun(arg1,arg2);
}
-stg_gc_prim_n (W_ arg)
+stg_gc_prim_n (W_ arg, W_ fun)
{
- W_ fun;
- fun = R9;
call stg_gc_noregs ();
jump fun(arg);
}
+stg_gc_prim_p_ll_ret
+{
+ W_ fun;
+ P_ arg;
+ fun = Sp(2);
+ arg = Sp(1);
+ Sp_adj(3);
+ R1 = arg;
+ jump fun [R1];
+}
+
+stg_gc_prim_p_ll
+{
+ W_ fun;
+ P_ arg;
+ fun = R2;
+ arg = R1;
+ Sp_adj(-3);
+ Sp(2) = fun;
+ Sp(1) = arg;
+ Sp(0) = stg_gc_prim_p_ll_ret;
+ jump stg_gc_noregs [];
+}
+
/* -----------------------------------------------------------------------------
stg_enter_checkbh is just like stg_enter, except that we also call
checkBlockingQueues(). The point of this is that the GC can