[Vm-dev] inInterpreter assignment position

Ben Coman btc at openinworld.com
Thu May 19 12:01:38 UTC 2016


At the end of CoInterpreterPrimitives>>primitiveEnterCriticalSection we have...
  inInterpreter := instructionPointer >= objectMemory startOfMemory.
  self addLastLink: activeProc toList: criticalSection.
  self transferTo: self wakeHighestPriority from: CSEnterCriticalSection.
  self forProcessPrimitiveReturnToExecutivePostContextSwitch: inInterpreter

The natural place to assign inInterpreter would seem to be the line
before it is used, so my curiosity is piqued...  Is it important the
assignment to inInterpreter occurs where it does, before both
addLastLink:toList and transferTo:from:  ?  From looking at the call
to startOfMemory it seems that its not.

The reason I ask is (for example) the addLastLink line is identical to
InterpreterPrimitives>>primitiveEnterCriticalSection, so if that line
moved up, the two methods would be more alike, so when flipping
between the two implementations in "Implementors of", the differences
would be more pronounced.  Also its a chance to learn another small
part of the VM. Till now I just blindly copied that part for the
OwnedLock primitives,

cheers -ben


More information about the Vm-dev mailing list