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

commits at source.squeak.org commits at source.squeak.org
Wed Nov 24 03:34:59 UTC 2021


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

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

Name: VMMaker.oscog-eem.3111
Author: eem
Time: 23 November 2021, 7:34:50.330398 pm
UUID: 27fe97ff-bcae-4575-abf9-276901dda03e
Ancestors: VMMaker.oscog-eem.3110

Minor fixes for CoInterpreterMT

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

Item was changed:
  ----- Method: CoInterpreterMT>>bindProcess:toId: (in category 'process primitive support') -----
  bindProcess: aProcess toId: newId
  	"Change a Process's thread binding and answer 0, otherwise answer a suitable error code.
  	 Cases:
  		process is unbound & unaffined
  			id 0 nothing to do
  			id non-zero ensure thread and bind
  		process is affined (temporarily bound to a thread for the duration of a surrender of ownership)
  			id = affined index nothing to do
  			id = 0 nothing to do
  			id ~= 0 && id ~= affined index fail
  		process is bound (permanently bound to a thread)
  			id = bound index nothing to do
  			id ~= bound index set bound index"
  	| threadIdField ownerIndex affinedId |
  	processHasThreadId ifFalse:
  		[^PrimErrUnsupported].
  
  	threadIdField := self threadIdFieldOf: aProcess.
  	ownerIndex := self ownerIndexOfThreadId: threadIdField.
  
  	"If aProcess is affined (temporarily bound to) a thread then the operation can only
  	 succeed if the newId is the same as that aProcess is affined to, or is zero (is unbinding)."
  	(self isAffinedThreadId: threadIdField) ifTrue:
  		[affinedId := self affinedThreadId: threadIdField.
  		 (newId = 0
  		  or: [newId = affinedId]) ifTrue:
  			[self setThreadIdFieldOfProcess: aProcess to: newId << ThreadIdShift + affinedId.
+ 			 ^nil].
- 			 ^0].
  		^PrimErrInappropriate].
  
  	ownerIndex > 0 ifTrue:
  		[(self startThreadForThreadIndex: ownerIndex) ifFalse:
  			[^PrimErrLimitExceeded]].
  
  	self setThreadIdFieldOfProcess: aProcess to: newId << ThreadIdShift.
+ 	^nil!
- 	^0!

Item was changed:
  ----- Method: CoInterpreterMT>>primitiveProcessBindToThreadId (in category 'process primitives') -----
  primitiveProcessBindToThreadId
  	"Attempt to bind the receiver to the thread with the id of the argument or nil, where the receiver is a Process.
  	 If successful the VM will ensure that there are at least id many threads active."
  	| aProcess id |
  	<export: true>
- 	self break.
  	self cCode: [] inSmalltalk: [cogThreadManager isNil ifTrue: [^self primitiveFail]].
  	processHasThreadId ifFalse:
  		[^self primitiveFailFor: PrimErrUnsupported].
  	id := self stackTop.
  	aProcess := self stackValue: 1.
  	((id = objectMemory nilObject or: [(objectMemory isIntegerObject: id)
  										and: [id ~= (objectMemory integerObjectOf: 0)]])
  	and: [(objectMemory isPointers: aProcess)
  	and: [(objectMemory slotSizeOf: aProcess) >= (ThreadIdIndex + 1)]]) ifFalse:
  		[^self primitiveFailFor: PrimErrBadArgument].
  	id := id = objectMemory nilObject ifTrue: [0] ifFalse: [objectMemory integerValueOf: id].
  	id abs >= cogThreadManager maxNumThreads ifTrue:
  		[^self primitiveFailFor: PrimErrLimitExceeded].
  	(self bindProcess: aProcess toId: id) ifNotNil:
  		[:ec| ^self primitiveFailFor: ec].
  	id := self ownerIndexOfProcess: aProcess.
  	(aProcess = self activeProcess
  	and: [(activeProcessAffined := id ~= 0)
  	and: [(cogThreadManager vmOwnerIsCompatibleWith: id) not]]) ifTrue:
  		[(self quickFetchInteger: PriorityIndex ofObject: aProcess) < maxWaitingPriority ifTrue:
  			[maxWaitingPriority = self quickFetchInteger: PriorityIndex ofObject: aProcess].
  		 checkThreadActivation := true.
  		 self forceInterruptCheck].
  	self methodReturnReceiver!



More information about the Vm-dev mailing list