[Vm-dev] VM Maker: VMMaker.oscog-eem.2960.mcz

commits at source.squeak.org commits at source.squeak.org
Thu May 20 22:39:47 UTC 2021


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2960.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.2960
Author: eem
Time: 20 May 2021, 3:39:38.287864 pm
UUID: 9f7e6567-73d5-4991-83e1-e1958fd55611
Ancestors: VMMaker.oscog-eem.2958

InterpreterPrimitives>>primitiveResume should also follow the SuspendedContextIndex field of a process on Spur, as does the CoInterpreterPrimitives version.  Update the comment re not checking myList.  See VMMaker.oscog-eem.2959 in VMMakerInbox for a version that does check and is being considered for inclusion.

=============== Diff against VMMaker.oscog-eem.2958 ===============

Item was changed:
  ----- Method: CoInterpreterPrimitives>>primitiveResume (in category 'process primitives') -----
  primitiveResume
  	"Put this process on the scheduler's lists thus allowing it to proceed next time there is
  	 a chance for processes of it's priority level.  It must go to the back of its run queue so
  	 as not to preempt any already running processes at this level.  If the process's priority
  	 is higher than the current process, preempt the current process."
  	| proc inInterpreter |
  	proc := self stackTop.  "rcvr"
  	(objectMemory isContext: (objectMemory followField: SuspendedContextIndex ofObject: proc)) ifFalse:
  		[^self primitiveFail].
  	"We're about to switch process, either to an interpreted frame or a
  	 machine code frame. To know whether to return or enter machine code
  	 we have to know from whence we came.  We could have come from the
  	 interpreter, either directly or via a machine code primitive.  We could have
  	 come from machine code.  The instructionPointer tells us where from:"
  	inInterpreter := instructionPointer >= objectMemory startOfMemory.
  	(self resume: proc preemptedYieldingIf: preemptionYields from: CSResume) ifTrue:
  		[self forProcessPrimitiveReturnToExecutivePostContextSwitch: inInterpreter]
  
  	"Personally I would like to check MyList, which should not be one of the elements of the scheduler lists.
  	 But there are awful race conditions in things like should:notTakeMoreThan: that mean we can't.
+ 	 eem 9/27/2010 23:08, updated eem 5/20/2021 15:36. e.g.
- 	 eem 9/27/2010 23:08. e.g.
  
+ 	| proc |
+ 	proc := self stackTop.  ''rcvr''
+ 	''We only have to check for myList being nil.  If it is nil then this is either the active process or
+ 	 a process suspended with primitiveSuspend (and if it is the activeProcess suspendedContext will
+ 	 be nil and the isContext: test will fail).  If it is not nil then either the process is waiting on some
+ 	 semaphore-like list or on one of the scheduler's lists. If it is on some semaphore-like list it should
+ 	 not resume.  If it is on one of the scheduler's lists it is runnable (already resumed).''
+ 	objectMemory nilObject = (objectMemory followField: MyListIndex ofObject: proc) ifFalse:
+ 		[^self primitiveFailFor: PrimErrInappropriate].
+ 	(objectMemory isContext: (objectMemory followField: SuspendedContextIndex ofObject: proc)) ifFalse:
+ 		[^self primitiveFailFor: PrimErrBadReceiver].
- 	| proc myList classLinkedList |
- 	proc := self stackTop.
- 	myList := objectMemory fetchPointer: MyListIndex ofObject: proc.
- 	classLinkedList := self superclassOf: (objectMemory splObj: ClassSemaphore).
- 	((self fetchClassOfNonInt: myList) ~= classLinkedList
- 	and: [objectMemory isContext: (objectMemory fetchPointer: SuspendedContextIndex ofObject: proc)]) ifFalse:
- 		[^self primitiveFail].
  	''We're about to switch process, either to an interpreted frame or a
  	 machine code frame. To know whether to return or enter machine code
  	 we have to know from whence we came.  We could have come from the
  	 interpreter, either directly or via a machine code primitive.  We could have
  	 come from machine code.  The instructionPointer tells us where from:''
  	inInterpreter := instructionPointer >= objectMemory startOfMemory.
+ 	(self resume: proc preemptedYieldingIf: preemptionYields from: CSResume) ifTrue:
- 	(self resume: proc  preemptedYieldingIf: preemptionYields from: CSResume) ifTrue:
  		[self forProcessPrimitiveReturnToExecutivePostContextSwitch: inInterpreter]"!

Item was changed:
  ----- Method: InterpreterPrimitives>>primitiveResume (in category 'process primitives') -----
  primitiveResume
  	"Put this process on the scheduler's lists thus allowing it to proceed next time there is
  	 a chance for processes of it's priority level.  It must go to the back of its run queue so
  	 as not to preempt any already running processes at this level.  If the process's priority
  	 is higher than the current process, preempt the current process."
  	| proc |
  	proc := self stackTop.  "rcvr"
+ 	(objectMemory isContext: (objectMemory followField: SuspendedContextIndex ofObject: proc)) ifFalse:
- 	(objectMemory isContext: (objectMemory fetchPointer: SuspendedContextIndex ofObject: proc)) ifFalse:
  		[^self primitiveFail].
  	self resume: proc preemptedYieldingIf: preemptionYields
  
  	"Personally I would like to check MyList, which should not be one of the elements of the scheduler lists.
  	 But there are awful race conditions in things like should:notTakeMoreThan: that mean we can't.
+ 	 eem 9/27/2010 23:08, updated eem 5/20/2021 15:36. e.g.
- 	 eem 9/27/2010 23:08. e.g.
  
+ 	| proc |
+ 	proc := self stackTop.  ''rcvr''
+ 	''We only have to check for myList being nil.  If it is nil then this is either the active process or
+ 	 a process suspended with primitiveSuspend (and if it is the activeProcess suspendedContext will
+ 	 be nil and the isContext: test will fail).  If it is not nil then either the process is waiting on some
+ 	 semaphore-like list or on one of the scheduler's lists. If it is on some semaphore-like list it should
+ 	 not resume.  If it is on one of the scheduler's lists it is runnable (already resumed).''
+ 	objectMemory nilObject = (objectMemory followField: MyListIndex ofObject: proc) ifFalse:
+ 		[^self primitiveFailFor: PrimErrInappropriate].
+ 	(objectMemory isContext: (objectMemory followField: SuspendedContextIndex ofObject: proc)) ifFalse:
+ 		[^self primitiveFailFor: PrimErrBadReceiver].
- 	| proc myList classLinkedList |
- 	proc := self stackTop.
- 	myList := objectMemory fetchPointer: MyListIndex ofObject: proc.
- 	classLinkedList := self superclassOf: (objectMemory splObj: ClassSemaphore).
- 	((self fetchClassOfNonInt: myList) ~= classLinkedList
- 	and: [objectMemory isContext: (objectMemory fetchPointer: SuspendedContextIndex ofObject: proc)]) ifFalse:
- 		[^self primitiveFail].
  	self resume: proc preemptedYieldingIf: preemptionYields"!



More information about the Vm-dev mailing list