[Vm-dev] VM Maker: Cog-eem.231.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Dec 25 23:24:45 UTC 2014


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

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

Name: Cog-eem.231
Author: eem
Time: 25 December 2014, 3:24:27.566 pm
UUID: 05230b26-8846-4550-8343-40baaf79bffd
Ancestors: Cog-eem.230

Fix bug in 32-bit to 64-bit bootstrap that pinned
all objects.  Add pinning methods.

=============== Diff against Cog-eem.230 ===============

Item was changed:
  ----- Method: Spur32to64BitBootstrap>>clone: (in category 'bootstrap image') -----
  clone: obj32
  	| obj64 format numSlots numBytes hash |
  	format := heap32 formatOf: obj32.
  	numSlots := heap32 numSlotsOf: obj32.
  	format > heap32 lastPointerFormat ifTrue:
  		[format < heap32 firstByteFormat
  			ifTrue:
  				[format = heap32 firstLongFormat
  					ifTrue:
  						[numSlots := heap32 numSlotsOf: obj32.
  						 numSlots odd ifTrue:
  							[format := format + 1].
  						 numSlots := numSlots + 1 // 2]
  					ifFalse: [self error: 'bad format']]
  			ifFalse:
  				[numBytes := heap32 numBytesOf: obj32.
  				 format < heap32 firstCompiledMethodFormat
  					ifTrue:
  						[format := heap64 byteFormatForNumBytes: numBytes.
  						 numSlots := numSlots + 1 // 2]
  					ifFalse:
  						[numSlots := heap32 numPointerSlotsOf: obj32.
  						 numBytes := numBytes - (numSlots * heap32 bytesPerOop).
  						 format := (heap64 byteFormatForNumBytes: numBytes) + heap32 firstCompiledMethodFormat - heap32 firstByteFormat.
  						 numSlots := numSlots + (heap64 numSlotsForBytes: numBytes)]]].
  	obj64 := heap64
  				allocateSlots: numSlots
  				format: format
  				classIndex: (heap32 classIndexOf: obj32).
  	(hash := heap32 rawHashBitsOf: obj32) ~= 0 ifTrue:
  		[heap64 setHashBitsOf: obj64 to: hash].
+ 	(heap32 isImmutable: obj32) ifTrue:
- 	(heap32 isImmutable: obj32) ~= 0 ifTrue:
  		[heap64 setIsImmutableOf: obj64 to: true].
+ 	(heap32 isPinned: obj32) ifTrue:
- 	(heap32 isPinned: obj32) ~= 0 ifTrue:
  		[heap64 setIsPinnedOf: obj64 to: true].
  	self deny: (heap32 isRemembered: obj32).
  	self deny: (heap32 isMarked: obj32).
  	self deny: (heap32 isGrey: obj32).
  	reverseMap at: obj64 put: obj32.
  	^map at: obj32 put: obj64!

Item was changed:
  ----- Method: SpurBootstrap class>>categoryForClass:meta:selector: (in category 'method prototype categorization') -----
  categoryForClass: className meta: isMeta selector: selector 
  	^(isMeta
  			ifTrue: [{ className. #class. selector }]
  			ifFalse: [{ className. selector }])
  		caseOf: {
  			[#(Behavior allInstancesOrNil)]					-> [#enumerating].
  			[#(Behavior byteSizeOfInstance)]				-> [#'accessing instances and variables'].
  			[#(Behavior byteSizeOfInstanceOfSize:)]		-> [#'accessing instances and variables'].
  			[#(Behavior elementSize)]						-> [#'accessing instances and variables'].
  			[#(Behavior handleFailingBasicNew)]			-> [#private].
  			[#(Behavior handleFailingBasicNew:)]			-> [#private].
  			[#(Behavior handleFailingFailingBasicNew)]		-> [#private].
  			[#(Behavior handleFailingFailingBasicNew:)]		-> [#private].
  			[#(Behavior identityHash)]						-> [#comparing].
  			[#(Behavior isCompiledMethodClass)]			-> [#testing].
  			[#(Behavior isEphemeronClass)]				-> [#testing].
  			[#(Behavior isImmediateClass)]					-> [#testing].
  			[#(BoxedFloat64 class basicNew)]				-> [#'instance creation'].
  			[#(BoxedFloat64 class basicNew:)]				-> [#'instance creation'].
  			[#(Character identityHash)]						-> [#comparing].
  			[#(Character setValue:)]						-> [#accessing].
  			[#(Class immediateSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:)]
  															-> [#'subclass creation'].
  			[#(ClassBuilder superclass:immediateSubclass:instanceVariableNames:classVariableNames:poolDictionaries:category:)]
  															-> [#public].
  			[#(CompiledMethod bytecodeSetName)]		-> [#accessing].
  			[#(CompiledMethod class handleFailingFailingNewMethod:header:)]
  															-> [#private].
  			[#(CompiledMethod class handleFailingNewMethod:header:)]
  															-> [#private].
  			[#(CompiledMethod class headerFlagForEncoder:)]
  															-> [#'method encoding'].
  			[#(CompiledMethod class installPrimaryBytecodeSet:)]
  															-> [#'class initialization'].
  			[#(CompiledMethod class installSecondaryBytecodeSet:)]
  															-> [#'class initialization'].
  			[#(Context class allInstances)]					-> [#enumerating].
  			[#(Context class allInstancesDo:)]				-> [#enumerating].
  			[#(Context failPrimitiveWith:)]					-> [#'system simulation'].
  			[#(Context isPrimFailToken:)]					-> [#private].
  			[#(Context send:to:with:lookupIn:)]				-> [#controlling].
  			[#(ContextPart isPrimFailToken:)]				-> [#private].
  			[#(ContextPart send:to:with:lookupIn:)]			-> [#controlling].
  			[#(EncoderForV3 computeMethodHeaderForNumArgs:numTemps:numLits:primitive:)]
  															-> [#'method encoding'].
  			[#(EncoderForV3PlusClosures genCallPrimitive:)]
  															-> [#'bytecode generation'].
  			[#(EncoderForV3PlusClosures class callPrimitiveCode)]
  															-> [#'bytecode decoding'].
  			[#(MethodContext failPrimitiveWith:)]			-> [#'system simulation'].
  			[#(MethodContext class allInstances)]			-> [#enumerating].
  			[#(MethodContext class allInstancesDo:)]		-> [#enumerating].
+ 			[#(Object isPinned)]							-> [#'system primitives'].
+ 			[#(Object pin)]									-> [#'system primitives'].
+ 			[#(Object setPinned:)]							-> [#'system primitives'].
+ 			[#(Object unpin)]								-> [#'system primitives'].
  			[#(SmallFloat64 class basicNew)]				-> [#'instance creation'].
  			[#(SmallFloat64 class basicNew:)]				-> [#'instance creation'].
  			[#(SmallFloat64 clone)]							-> [#copying].
  			[#(SmallFloat64 copy)]							-> [#copying].
  			[#(SmallFloat64 deepCopy)]					-> [#copying].
+ 			[#(SmallFloat64 identityHash)]					-> [#comparing].
  			[#(SmallFloat64 shallowCopy)]					-> [#copying].
  			[#(SmallFloat64 veryDeepCopyWith:)]			-> [#copying].
  			[#(SmallInteger asCharacter)]					-> [#converting].
  			[#(SmalltalkImage growMemoryByAtLeast:)]	-> [#'memory space'].
  			[#(SmalltalkImage maxIdentityHash)]			-> [#'system attributes'].
  			[#(SystemDictionary growMemoryByAtLeast:)]	-> [#'memory space'].
  			[#(SystemDictionary maxIdentityHash)]			-> [#'system attributes'].
  			[#(SystemDictionary setGCParameters)]		-> [#'snapshot and quit'].
  			[#(SystemNavigation allObjects)]				-> [#query].
  			[#(SystemNavigation allObjectsOrNil)]			-> [#query].
  			 }
  		otherwise:
  			[Transcript nextPutAll: className.
  			 isMeta ifTrue: [Transcript nextPutAll: ' class'].
  			 Transcript nextPutAll: '>>'; store: selector; nextPutAll: ' is unclassified'; cr; flush.
  			 ^Categorizer default]!

Item was added:
+ ----- Method: SpurBootstrapPrototypes>>ObjectPROTOTYPEisPinned (in category 'method prototypes') -----
+ ObjectPROTOTYPEisPinned
+ 	"Answer if the receiver is pinned.  The VM's garbage collector routinely moves
+ 	 objects as it reclaims and compacts memory.  But it can also pin an object so
+ 	 that it will not be moved, which can make it easier to pass objects out through
+ 	 the FFI."
+ 	<primitive: 183 error: ec>
+ 	^self primitiveFailed!

Item was added:
+ ----- Method: SpurBootstrapPrototypes>>ObjectPROTOTYPEpin (in category 'method prototypes') -----
+ ObjectPROTOTYPEpin
+ 	"The VM's garbage collector routinely moves objects as it reclaims and compacts
+ 	 memory. But it can also pin an object so that it will not be moved, which can make
+ 	 it easier to pass objects out through the FFI.  Objects are unpinnned when created.
+ 	 This method ensures an object is pinned, and answers whether it was already pinned."
+ 	^self setPinned: true!

Item was added:
+ ----- Method: SpurBootstrapPrototypes>>ObjectPROTOTYPEsetPinned: (in category 'method prototypes') -----
+ ObjectPROTOTYPEsetPinned: aBoolean
+ 	"The VM's garbage collector routinely moves objects as it reclaims and compacts
+ 	 memory. But it can also pin an object so that it will not be moved, which can make
+ 	 it easier to pass objects out through the FFI.  Objects are unpinnned when created.
+ 	 This primitive either pins or unpins an object, and answers if it was already pinned."
+ 	<primitive: 184 error: ec>
+ 	^self primitiveFailed!

Item was added:
+ ----- Method: SpurBootstrapPrototypes>>ObjectPROTOTYPEunpin (in category 'method prototypes') -----
+ ObjectPROTOTYPEunpin
+ 	"The VM's garbage collector routinely moves objects as it reclaims and compacts
+ 	 memory. But it can also pin an object so that it will not be moved, which can make
+ 	 it easier to pass objects out through the FFI.  Objects are unpinnned when created.
+ 	 This method ensures an object is unpinned, and answers whether it was pinned."
+ 	^self setPinned: false!



More information about the Vm-dev mailing list