Ok, thanks. Norbert
|
In reply to this post by Clément Béra
Let's rewrite the method this way: attemptToAssign: value withIndex: index | process | "INSERT CODE HERE" process := Processor activeProcess. [ process suspendedContext: process suspendedContext sender ] fork. Processor yield. self error: 'should not be reached'. This way it's clear that execution flow never reaches the end of the method as the error message is never sent. For some reason in the previous code by increasing the priority of the process the end of the method could be reached, as Denis showed, which leaded to incorrect behavior. This is still hackish and we still need to provide a better way of performing such returns. Any code can be written at the "INSERT CODE HERE" position, including exception signals, etc. Normal methods ends with a return, for example, "^ self". When performed, "^ self" pushes "self" on the sender's stack and resumes execution in the sender. In this call-back, when reaching the end of the method, the sender's execution needs to be resumed, but no value needs to be pushed on its stack. That's why instead of a normal return I use: process := Processor activeProcess. [ process suspendedContext: process suspendedContext sender ] fork. Processor yield. I don't know how to explain it better. I understand that because it was bugged it was very hard to understand. I will put a slice on the bug tracker. On Thu, Jan 26, 2017 at 10:35 AM, Clément Bera <[hidden email]> wrote:
|
Hi Clement:
> On 26 Jan 2017, at 10:59, Clément Bera <[hidden email]> wrote: > > Let's rewrite the method this way: > > attemptToAssign: value withIndex: index > | process | > "INSERT CODE HERE" > process := Processor activeProcess. > [ process suspendedContext: process suspendedContext sender ] fork. > Processor yield. > self error: ‘should not be reached'. The PRocessorScheduler>>#yield does not guarantee that this process becomes never runnable again. It just puts the processes at the end of the runnable list. The fallback code of yield even explicitly forks another processes that’s signaling the old process again to make it runnable. Best regards Stefan -- Stefan Marr Johannes Kepler Universität Linz http://stefan-marr.de/research/ |
In reply to this post by Clément Béra
2017-01-26 10:59 GMT+01:00 Clément Bera <[hidden email]>:
Thank's Clement. Now I understand it. |
In reply to this post by Clément Béra
2017-01-26 10:59 GMT+01:00 Clément Bera <[hidden email]>:
I guess I found simplest solution to problem. Instead of process logic we can just use "thisContext sender jump". attemptToAssign: value withIndex: index | process | thisContext sender jump. self error: 'should not be reached'. In my tests it works correctly. I use this method:
So debugger is opened at halt. And #result var contains anObject. |
Denis' idea is good. There is one problem with the implementation of jump though. MyClass>>iv iv := 1. [ 2 ] value. 1halt. MyClass new beReadOnlyObject ; iv When reaching the halt we see there is an extra nil on stack. I think this is better than the process hack, at least until we add VM support for this case. On Thu, Jan 26, 2017 at 11:36 AM, Denis Kudriashov <[hidden email]> wrote:
|
In reply to this post by Clément Béra
Guess the method is wrong given the comment. Shouldn't it be [param anyMask: 1] instead of [param anyMask: 2] ? Phil On Wed, Jan 25, 2017 at 2:14 PM, Clément Bera <[hidden email]> wrote:
|
Now we have integrated case 19613 with VisualWorks names. But I propose better names 19614. It would be nice if you put some notes about it (at issue page). 2017-01-26 22:39 GMT+01:00 [hidden email] <[hidden email]>:
|
Free forum by Nabble | Edit this page |