few questions about GHC RTS
Peter Hercek
phercek at gmail.com
Mon Sep 7 06:05:27 EDT 2009
Simon Marlow wrote:
> On 19/08/2009 10:18, Peter Hercek wrote:
>> Why is stg_nofoceIO_info added as last argument to IO actions in
>> unregistered mode? Do I still need to pass it in even when (I think) my
>> IO action does not need it? E.g. is it required for every IO action by
>> some stack walking code or something?
>
> The comment in Interpreter.c says
>
> // Note [unreg]: in unregisterised mode, the return
> // convention for IO is different. The
> // stg_noForceIO_info stack frame is necessary to
> // account for this difference.
>
> However, the return convention for IO is now the same under both
> registerised and unregisterised builds (I made the change becuase of
> the proliferation of obscure conditional RTS code like the above), so
> I'm guessing the stg_noforceIO_info hack, and the above comment, are
> now redundant. It needs testing though.
Just for your information. I was curious and tried to remove the
additional stg_noforceIO_info argument. Breakpoints stopped to be called
but otherwise ghci seemed to work fine. It was surprising. It looked
like the call to rts_breakpoint_io_action was somehow optimized away but
I would not expect any optimizations at this level. Maybe I did not do
it correctly. The patch I used is at the end of this email.
Thanks,
Peter.
hunk ./rts/Interpreter.c 879
// in a reasonable state for the GC and so that
// execution of this BCO can continue when we resume
ioAction = (StgClosure *) deRefStablePtr
(rts_breakpoint_io_action);
- Sp -= 9;
- Sp[8] = (W_)obj; $
- Sp[7] = (W_)&stg_apply_interp_info;
- Sp[6] = (W_)&stg_noforceIO_info; // see [unreg] below
+ Sp -= 8;
+ Sp[7] = (W_)obj; $
+ Sp[6] = (W_)&stg_apply_interp_info;
Sp[5] = (W_)new_aps; // the AP_STACK
Sp[4] = (W_)BCO_PTR(arg3_freeVars); // the info
about local vars of the breakpoint
Sp[3] = (W_)False_closure; // True <=> a
breakpoint
hunk ./rts/Interpreter.c 885
- Sp[2] = (W_)&stg_ap_pppv_info;
+ Sp[2] = (W_)&stg_ap_ppp_info;
Sp[1] = (W_)ioAction; // apply the IO
action to its two arguments above
Sp[0] = (W_)&stg_enter_info; // get ready to
run the IO action
hunk ./rts/Interpreter.c 888
- // Note [unreg]: in unregisterised mode, the return
- // convention for IO is different. The
- // stg_noForceIO_info stack frame is necessary to
- // account for this difference.
// set the flag in the TSO to say that we are now
// stopping at a breakpoint so that when we resume
More information about the Glasgow-haskell-users
mailing list