[Vm-dev] Where to get Monitor implementation based on primitives?

Ben Coman btc at openinworld.com
Mon Jan 11 16:47:39 UTC 2016


On Mon, Jan 11, 2016 at 9:58 PM, Denis Kudriashov <dionisiydk at gmail.com> wrote:
>
> Eliot I found that there are no methods for simulation code (if it right name for it). So stepping over new primitives failed (which is infinite recursion for Pharo case)
>
> Context>>doPrimitive: primitiveIndex method: meth receiver: aReceiver args: arguments
> ...
> "Mutex>>primitiveEnterCriticalSection
> Mutex>>primitiveTestAndSetOwnershipOfCriticalSection"
> (primitiveIndex = 186 or: [primitiveIndex = 187]) ifTrue:
> [| active effective |
> active := Processor activeProcess.
> effective := active effectiveProcess.
> "active == effective"
> value := primitiveIndex = 186
> ifTrue: [aReceiver primitiveEnterCriticalSectionOnBehalfOf: effective]
> ifFalse: [aReceiver primitiveTestAndSetOwnershipOfCriticalSectionOnBehalfOf: effective].
> ^(self isPrimFailToken: value)
> ifTrue: [value]
> ifFalse: [self push: value]].
>
> How this methods should be implemented?
>
> 2016-01-11 13:59 GMT+01:00 Denis Kudriashov <dionisiydk at gmail.com>:
>>
>> Hello.
>> I publish slice 17373.
>>
>> I introduce LockOwnership class which implements VM primitives as:
>> - acquire
>> - tryAcquire
>> - release
>> (It comment saves copyright from CriticalSection)

I don't think that is proper.  The code is the same, just some names
have changed.  I'll bet the primitives were funded by 3DICC too, so
credit where credit is due.
cheers -ben


More information about the Vm-dev mailing list