[m-dev.] Almost ready to merge the update_boehm branch

Paul Bone paul at bone.id.au
Thu Sep 24 19:58:40 AEST 2015


On Thu, Sep 24, 2015 at 05:54:00PM +1000, Peter Wang wrote:
> Hi Paul,
> 
> Here's a review of the diff.

I'll take a look at this in more detail tomorrow, most of it is
straight-forward.  For now:

> > diff --git a/library/thread.m b/library/thread.m
> > index 1e1748d..0177681 100644
> > --- a/library/thread.m
> > +++ b/library/thread.m
> > @@ -263,8 +263,9 @@ spawn_context_2(_, Res, "", !IO) :-
> >      /*
> >      ** Store Goal and ThreadId on the top of the new context's stack.
> >      */
> > -    ctxt->MR_ctxt_sp[0] = Goal;
> > -    ctxt->MR_ctxt_sp[-1] = (MR_Word) ThreadId;
> > +    ctxt->MR_ctxt_sp += 2;
> > +    ctxt->MR_ctxt_sp[0] = Goal;                 /* MR_stackvar(1) */
> > +    ctxt->MR_ctxt_sp[-1] = (MR_Word) ThreadId;  /* MR_stackvar(2) */
> >  
> >      MR_schedule_context(ctxt);
> >  
> > @@ -439,6 +440,7 @@ INIT mercury_sys_init_thread_modules
> >          /* Call the closure placed the top of the stack. */
> >          MR_r1 = MR_stackvar(1); /* Goal */
> >          MR_r2 = MR_stackvar(2); /* ThreadId */
> > +        MR_decr_sp(2);
> >          MR_noprof_call(MR_ENTRY(mercury__do_call_closure_1),
> >              MR_LABEL(mercury__thread__spawn_end_thread));
> >      }
> 
> Should this change be committed to master independent of the GC upgrade
> change?

I don't really see a reason why not to as it fixes what seems to be a
genuine memory error.  I think that this is your code, so if you don't know
or remember a reason for it being the way it is I can put it on master.

-- 
Paul Bone



More information about the developers mailing list