logo       

Related Msgs: audio.musicbrai...    enbd.general/20...    ietf.idr/2002-0...    java.ant-contri...    gnu.make.genera...    qplus.devel/200...    video.freevo.cv...    os.netbsd.ports...    yellowdog.gener...    xfree86.cvs/200...    search.nutch.us...    freedesktop.xse...    programming.swi...    capabilities.ge...    telephony.pbx.a...    mail.sylpheed.c...    db.firebase.por...    boot-loaders.u-...    recreation.radi...    netbsd.bugs/200...    web.zope.plone....    user-groups.lin...   

Yielding from the middle of a PrimOp: msg#00164

Subject: Yielding from the middle of a PrimOp
I'm in the progress of implementing my bound threads proposal,
and I'm stuck in the depths of the RTS...

I've added a PrimOp,

bindThread# :: (State# RealWorld -> (# State# RealWorld, a #))
     -> (State# RealWorld -> (# State# RealWorld, a #))

It even works... basically.
No under some circumstances, I have to return to the scheduler from the middle
of the primop.
I just pushed an info pointer onto the stack, and R1 points to the IO action argument. I want to execute the IO action argument and then continue with stg_unbindThreadzh_ret (that part works), but only after returning to the scheduler once (that I don't know how to do).

Could you give me a hint?

Cheers,

Wolfgang

P.S.: Here's a shortened version of the relevant code (inspired by blockAsyncExceptions#):

FN_(bindThreadzh_fast)
{
  FB_
    /* Args: R1 :: IO a */
    STK_CHK_GEN( 2/* worst case */, R1_PTR, bindThreadzh_fast);

    // ...

    Sp--;
    Sp[0] = (W_)&stg_unbindThreadzh_ret_info;

    if(...)
    {
      // here, I want to yield
    }
    else
    {
      // ...
    }
#endif
        
    Sp--;
    JMP_(stg_ap_v_ret);
  FE_
}

INFO_TABLE_RET( \
  stg_unbindThreadzh_ret_info, \
  stg_unbindThreadzh_ret_entry, \
  MK_SMALL_BITMAP(0/*framesize*/, 0/*bitmap*/), \
  0, 0, 0, RET_SMALL, , EF_, 0, 0 \
);

FN_(stg_unbindThreadzh_ret_entry)
{
  FB_
    //...
#ifdef REG_R1
    Sp++;
    JMP_(ENTRY_CODE(Sp[0]));
#else
    Sp[1] = Sp[0];
    Sp++;
    JMP_(ENTRY_CODE(Sp[1]));
#endif
  FE_
}



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo