[squeak-dev] Re: [Vm-dev] re: "callback failed to own the VM"

Eliot Miranda eliot.miranda at gmail.com
Fri Oct 9 00:28:47 UTC 2015


Hi Craig,

On Thu, Oct 8, 2015 at 4:59 PM, Craig Latta <craig at netjam.org> wrote:

>
>
> > If you want to make progress on this you'll need to
> >
> > a) build a simulator image (instructions on the blog)
> > b) set-up a test case in the simulator to exercise the
> > cedeToHigherPriorityThreads logic and replicate the bug
> > c) have a go at rewriting cedeToHigherPriorityThreads and/or
> > threadSwitchIfNecessary:from: to do the right thing.
>
>      Hm, I have no idea how to set up such a test case meaningfully.
> This seems like one of those situations where you'd use a "plugin
> simulator" (like the one for BitBlt) that relies on the behavior you're
> debugging already working properly as simulation support in the
> simulation host.
>

All you'd do is simulate a callback occurring while the VM is doing
something.  So...


a) write a scratch primitive called e.g. primitiveFakeAForeignCallback
which forks (at a higher priority?, or at least does a yield?), and calls
the relevant machinery with faked up callback data (so you can avoid all
the stuff in thinkProcess which is written in C)
b) use the reader image to run this primitive via a doit containing the
primitiveFakeAForeignCallback followed by some time consuming computation
like 0 tinyBenchmarks.

So you start up the reader image, and type in the DoIt (followed by a !)
into the dialog that stands in for reading from stdin.  From your DoIt the
foreign callback will start its processing in
primitiveFakeAForeignCallback, and get blocked trying to take ownership of
the vm.  primitiveFakeAForeignCallback will return and the time-consuming
computation will start and soon enough get interrupted, so the VM will
enter checkForEventsMayContextSwitch: and you can step through the system
to see the foreign callback attempt to get control of the VM.


BTW, this is /monstrously/ cool of you!

-C
>
> --
> Craig Latta
> netjam.org
> +31 6 2757 7177 (SMS ok)
> + 1 415 287 3547 (no SMS)
>

_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20151008/ab7cf4e1/attachment.htm


More information about the Squeak-dev mailing list