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

commits at source.squeak.org commits at source.squeak.org
Fri Jan 9 19:17:05 UTC 2015


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

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

Name: VMMaker.oscog-eem.1010
Author: eem
Time: 6 January 2015, 10:52:02.447 am
UUID: 9065e685-b193-428f-9c7a-27ce1afe8c71
Ancestors: VMMaker.oscog-eem.1009

Be lenient w.r.t. unpinning married contexts.  Move
the check down into StackInterpreter's version.
This allows e.g.
    self allObjectsDo: [:o| o unpin]

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

Item was changed:
  ----- Method: InterpreterPrimitives>>primitivePin (in category 'memory space primitives') -----
  primitivePin
  	"Pin or unpin the receiver, i.e. make it immobile or mobile, based on the argument.
  	 Answer whether the object was already pinned. N.B. pinning does *not* prevent
  	 an object from being garbage collected."
  	| obj boolean wasPinned |
  	objectMemory hasSpurMemoryManagerAPI ifFalse:
  		[^self primitiveFailFor: PrimErrUnsupported].
  
  	obj := self stackValue: 1.
  	((objectMemory isImmediate: obj)
+ 	 or: [objectMemory isForwarded: obj]) ifTrue:
- 	 or: [(objectMemory isForwarded: obj)
- 	 or: [(objectMemory isContext: obj)
- 		and: [self isStillMarriedContext: obj]]]) ifTrue:
  		[^self primitiveFailFor: PrimErrBadReceiver].
+ 
  	boolean := self stackTop.
  	(boolean = objectMemory falseObject
  	 or: [boolean = objectMemory trueObject]) ifFalse:
  		[^self primitiveFailFor: PrimErrBadArgument].
  
  	(objectMemory isPinned: obj)
  		ifTrue:
  			[wasPinned := objectMemory trueObject.
+ 			 boolean ~= wasPinned ifTrue:
+ 				[objectMemory setIsPinnedOf: obj to: false]]
- 			 objectMemory setIsPinnedOf: obj to: boolean = objectMemory trueObject]
  		ifFalse:
  			[wasPinned := objectMemory falseObject.
  			 (boolean = objectMemory trueObject
  			  and: [(objectMemory pinObject: obj) = 0]) ifTrue:
  				[^self primitiveFailFor: PrimErrNoMemory]].
  	
  	self pop: argumentCount + 1 thenPush: wasPinned!

Item was added:
+ ----- Method: StackInterpreterPrimitives>>primitivePin (in category 'memory space primitives') -----
+ primitivePin
+ 	"Pin or unpin the receiver, i.e. make it immobile or mobile, based on the argument.
+ 	 Answer whether the object was already pinned. N.B. pinning does *not* prevent
+ 	 an object from being garbage collected."
+ 	| obj boolean wasPinned |
+ 	objectMemory hasSpurMemoryManagerAPI ifFalse:
+ 		[^self primitiveFailFor: PrimErrUnsupported].
+ 
+ 	obj := self stackValue: 1.
+ 	((objectMemory isImmediate: obj)
+ 	 or: [objectMemory isForwarded: obj]) ifTrue:
+ 		[^self primitiveFailFor: PrimErrBadReceiver].
+ 
+ 	boolean := self stackTop.
+ 	(boolean = objectMemory falseObject
+ 	 or: [boolean = objectMemory trueObject]) ifFalse:
+ 		[^self primitiveFailFor: PrimErrBadArgument].
+ 
+ 	(objectMemory isPinned: obj)
+ 		ifTrue:
+ 			[wasPinned := objectMemory trueObject.
+ 			 boolean ~= wasPinned ifTrue:
+ 				[objectMemory setIsPinnedOf: obj to: false]]
+ 		ifFalse:
+ 			[wasPinned := objectMemory falseObject.
+ 			 boolean = objectMemory trueObject ifTrue:
+ 				[((objectMemory isContext: obj)
+ 				  and: [self isStillMarriedContext: obj]) ifTrue:
+ 					[^self primitiveFailFor: PrimErrBadReceiver].
+ 				 (objectMemory pinObject: obj) = 0 ifTrue:
+ 					[^self primitiveFailFor: PrimErrNoMemory]]].
+ 	
+ 	self pop: argumentCount + 1 thenPush: wasPinned!



More information about the Vm-dev mailing list