[squeak-dev] The Inbox: Compiler-mt.456.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Tue Feb 2 13:32:54 UTC 2021


> Yet, I cannot do that in a test. :-)

Hypothetically, you could use a mock environment and subclass ProcessorScheduler. But this would get too complex for a single test ...
Do we have a good framework for such mocking experiments in Squeak? :-)

self mock: #Processor with: MockProcessorWithoutYield new during: [
    self doYourTestLogic].

or also:

self
    mock: Processor class >> #yield
    with: (Processor class >> #yield) decompile withoutPrimitiveNode generate
    during: [
        ...].

Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Dienstag, 2. Februar 2021 14:22:34
An: squeak-dev
Betreff: Re: [squeak-dev] The Inbox: Compiler-mt.456.mcz

>  Try to remove the primitive from #yield and then it works ok

Yes, removing the primitive form #yield will introduce one (or more) suspension points because of the (rather complex) fallback implementation. Yet, I cannot do that in a test. :-)

Best,
Marcel

Am 02.02.2021 14:14:14 schrieb jaromir <m at jaromir.net>:

> However, I have no idea why the following happens:
>
> x := 0.
> [ [ x := 1 ] forkAt: 41 ] valueUnpreemptively.
> y := x == 1. "false :-("
>
>
> Or this:
>
> x := 0.
> [ [ x := 1 ] forkAt: 41 ] valueUnpreemptively.
> Transcript showln: 'foo'.
> y := x == 1. "false :-("

The reason is the #yield primitive 167 - it doesn't reflect the change of
priority as done in #valueUnpreemptively... Try to remove the primitive from
#yield and then it works ok
Regards,
Jaromir



--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210202/84aeb14b/attachment.html>


More information about the Squeak-dev mailing list