From 2f015a00457d134124d1522316ae13b95b0b4f47 Mon Sep 17 00:00:00 2001 From: sof Date: Sat, 2 Mar 2002 17:40:24 +0000 Subject: [PATCH] [project @ 2002-03-02 17:40:24 by sof] - gcdIntegerIntzh_fast: another primop with mismatched return convention. - tidy up PerformTake() for non-REG_R1 case. - forkzh_fast and myThreadIdzh_fast: I mistakenly had ThreadId#s down as something unboxed; they're not, but unpointed. Update primops to use the RET_P() macro upon return instead. --- ghc/rts/PrimOps.hc | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ghc/rts/PrimOps.hc b/ghc/rts/PrimOps.hc index ef07664..b948f1f 100644 --- a/ghc/rts/PrimOps.hc +++ b/ghc/rts/PrimOps.hc @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: PrimOps.hc,v 1.93 2002/02/28 18:44:29 sof Exp $ + * $Id: PrimOps.hc,v 1.94 2002/03/02 17:40:24 sof Exp $ * * (c) The GHC Team, 1998-2000 * @@ -791,7 +791,10 @@ FN_(gcdIntegerIntzh_fast) I_ r; FB_ r = RET_STGCALL3(StgInt,mpn_gcd_1,(mp_limb_t *)(BYTE_ARR_CTS(R2.p)), R1.i, R3.i); - RET_N(r); + + R1.i = r; + /* Result parked in R1, return via info-pointer at TOS */ + JMP_(ENTRY_CODE(Sp[0])); FE_ } @@ -1002,7 +1005,7 @@ FN_(forkzh_fast) /* switch at the earliest opportunity */ context_switch = 1; - RET_N(R1.t); + RET_P(R1.t); FE_ } @@ -1017,7 +1020,7 @@ FN_(myThreadIdzh_fast) { /* no args. */ FB_ - RET_N((P_)CurrentTSO); + RET_P((P_)CurrentTSO); FE_ } @@ -1089,10 +1092,19 @@ FN_(newMVarzh_fast) FE_ } -#define PerformTake(tso, value) ({ \ - (tso)->sp[1] = (W_)value; \ +/* If R1 isn't available, pass it on the stack */ +#ifdef REG_R1 +#define PerformTake(tso, value) ({ \ + (tso)->sp[1] = (W_)value; \ (tso)->sp[0] = (W_)&stg_gc_unpt_r1_info; \ }) +#else +#define PerformTake(tso, value) ({ \ + (tso)->sp[1] = (W_)value; \ + (tso)->sp[0] = (W_)&stg_ut_1_0_unreg_info; \ + }) +#endif + #define PerformPut(tso) ({ \ StgClosure *val = (StgClosure *)(tso)->sp[2]; \ -- 1.7.10.4