Hi,
I've added Process>>#isSuspendedInCCall useful when you try to make the difference between a suspended process and a process to make a c-call which is reentrant. Cheers, Gwen _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk 0002-Add-Process-isSuspendedInCCall.patch (6K) Download Attachment |
On 12/04/2014 11:15, Gwenaël Casaccio wrote:
> Hi, > > I've added Process>>#isSuspendedInCCall useful when you try > to make the difference between a suspended process and a process > to make a c-call which is reentrant. > > Cheers, > Gwen > Don't apply it I've a better implementation not yet finished but here are the big lines: In the primitive I get the context (if it's a block I get the method context in the outer context) and I set or unset a bit in the flag. Now I'm not sure the it's not the current context that should be tagged and not the outer context but that requires more changes in the vm. Cheers, Gwen _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
On 14/04/2014 20:17, Gwenaël Casaccio wrote:
> On 12/04/2014 11:15, Gwenaël Casaccio wrote: >> Hi, >> >> I've added Process>>#isSuspendedInCCall useful when you try >> to make the difference between a suspended process and a process >> to make a c-call which is reentrant. >> >> Cheers, >> Gwen >> > > Don't apply it I've a better implementation not yet finished but here > are the big lines: > In the primitive I get the context (if it's a block I get the method > context in the outer context) > and I set or unset a bit in the flag. > > Now I'm not sure the it's not the current context that should be > tagged and not the outer context > but that requires more changes in the vm. > > Cheers, > Gwen > thisContext is tagged while being reentrant. And few primitives (compile, ccall) are extended to tag the context. Gwen _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk 0002-Add-Process-isSuspendedInCCall.patch (15K) Download Attachment |
On Tue, Apr 15, 2014 at 05:47:49PM +0200, Gwenaël Casaccio wrote:
Hi, sorry for the delay in reviewing. > Here is the patch: I've add one slot to ContextPart (ctxtFlags) and > thisContext is tagged while > being reentrant. And few primitives (compile, ccall) are extended to tag the > context. The C-Call/primitive will only be invoked from a method context in normal operation. What about just adding the ctxFlags to the methodContext then? > asyncCall [ > + <category: 'calling'> > + > "Perform the call-out for the function represented by the receiver. > The arguments (and the receiver if one of the arguments has type > #self or #selfSmalltalk) are taken from the parent context. > @@ -140,7 +142,7 @@ to perform the actual call-out to C routines.'> > ^self isValid > ifFalse: > [SystemExceptions.CInterfaceError signal: 'Invalid C call-out ' , self name] > - ifTrue: [self asyncCallNoRetryFrom: thisContext parentContext] > + ifTrue: [self asyncCallNoRetryFrom: thisContext parentContext ] > ] unrelated change just creating distraction. :) > @@ -522,6 +525,7 @@ _gst_interpret (OOP processOOP) > > monitor_byte_codes: > SET_EXCEPT_FLAG (false); > + finish_debugging_step = false; > > /* First, deal with any async signals. */ > if (async_queue_enabled) > @@ -540,6 +544,7 @@ monitor_byte_codes: > { > _gst_async_signal (single_step_semaphore); > single_step_semaphore = NULL; > + finish_debugging_step = true; > } are you mixing things here? The 'tagging' of a process being debugged might be good in a separate patch? We will also need to add this to the JIT. > +/* Anwser whether execution is going to be reentrant. */ > +#define MCF_IS_REENTRANT 2 What does this mean? > + this_context = (gst_method_context) OOP_TO_OBJ (_gst_this_context_oop); > + this_context->ctxtFlags |= MCF_IS_REENTRANT; > + > oop2 = POP_OOP (); > oop1 = POP_OOP (); > if (IS_CLASS (oop2, _gst_string_class)) > @@ -5231,6 +5235,8 @@ primitive VMpr_Behavior_primCompile [succeed] > > if (interrupted) > stop_execution (); > + else > + this_context->ctxtFlags &= ~MCF_IS_REENTRANT; this and most of the errors look unbalanced. So if the function is re-entered the first one to leave will unset this flag? Is this the intention? What does it buy us? _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
Free forum by Nabble | Edit this page |