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

commits at source.squeak.org commits at source.squeak.org
Tue Sep 7 21:00:29 UTC 2021


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

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

Name: VMMaker.oscog-eem.3062
Author: eem
Time: 7 September 2021, 2:00:13.46964 pm
UUID: 7fa2d499-15d9-4799-94a9-030ab3615de8
Ancestors: VMMaker.oscog-eem.3061

Cogit: Split followForwardedLiteralsIn: into followForwardedLiteralsImplementationIn: to avoid unnecessary ensureWritableCodeZone/ensureExecutableCodeZone in followForwardedLiteralsInOpenPICList.

Spur: Update SMM's class comment. Better comment objectAfterMaybeSlimBridge:limit:.

Simulator: fix CArray>>#at:put: to mimic C's integer truncation so that the encryption primitives simulate without error.

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

Item was changed:
  ----- Method: CArray>>at:put: (in category 'accessing') -----
  at: offset put: val
  	| address |
  	address := unitSize * offset + self ptrAddress.
  	^unitSize <= 2
  		ifTrue:
  			[unitSize = 1
+ 				ifTrue: [interpreter byteAt: address put: (val bitAnd: 16rFF)]
+ 				ifFalse: [interpreter shortAt: address put: (val bitAnd: 16rFFFF)]]
- 				ifTrue: [interpreter byteAt: address put: val]
- 				ifFalse: [interpreter shortAt: address put: val]]
  		ifFalse:
  			[unitSize = 4
+ 				ifTrue: [interpreter long32At: address put: (val bitAnd: 16rFFFFFFFF)]
+ 				ifFalse: [interpreter long64At: address put: (val class == SmallInteger "this saves time..."
+ 																ifTrue: [val]
+ 																ifFalse: [val bitAnd: 16rFFFFFFFFFFFFFFFF])]]
+ 
+ "[1 to: 1024 * 1024 do: [:i| i <= SmallInteger maxVal ifTrue: [i] ifFalse: [i bitAnd: 16rFFFFFFFFFFFFFFFF]]] bench. '275 per second. 3.63 milliseconds per run. 0 % GC time.'.
+ [1 to: 1024 * 1024 do: [:i| i class == SmallInteger ifTrue: [i] ifFalse: [i bitAnd: 16rFFFFFFFFFFFFFFFF]]] bench. '355 per second. 2.82 milliseconds per run. 0 % GC time.' 
+ [1 to: 1024 * 1024 do: [:i| i bitAnd: 16rFFFFFFFFFFFFFFFF]] bench.  '14.1 per second. 70.9 milliseconds per run. 2.95811 % GC time.'"!
- 				ifTrue: [interpreter long32At: address put: val]
- 				ifFalse: [interpreter long64At: address put: val]]!

Item was changed:
  ----- Method: CogMethodZone>>followForwardedLiteralsInOpenPICList (in category 'jit - api') -----
  followForwardedLiteralsInOpenPICList
  	<option: #SpurObjectMemory>
  	| openPIC |
  	<var: #openPIC type: #'CogMethod *'>
  	openPIC := openPICList.
  	[openPIC notNil] whileTrue:
+ 		[cogit followForwardedLiteralsImplementationIn: openPIC.
- 		[cogit followForwardedLiteralsIn: openPIC.
  		 openPIC := self cCoerceSimple: openPIC nextOpenPIC to: #'CogMethod *'].
  	self pruneYoungReferrers!

Item was added:
+ ----- Method: Cogit>>followForwardedLiteralsImplementationIn: (in category 'garbage collection') -----
+ followForwardedLiteralsImplementationIn: cogMethod
+ 	<option: #SpurObjectMemory>
+ 	<var: #cogMethod type: #'CogMethod *'>
+ 	| writableCogMethod hasYoungObj hasYoungObjPtr |
+ 	self assert: (cogMethod cmType ~= CMMethod or: [(objectMemory isForwarded: cogMethod methodObject) not]).
+ 	writableCogMethod := self writableMethodFor: cogMethod.
+ 	hasYoungObj := objectMemory isYoung: cogMethod methodObject.
+ 	(objectMemory shouldRemapOop: cogMethod selector) ifTrue:
+ 		[writableCogMethod selector: (objectMemory remapObj: cogMethod selector).
+ 		 (objectMemory isYoung: cogMethod selector) ifTrue:
+ 			[hasYoungObj := true]].
+ 	hasYoungObjPtr := (self addressOf: hasYoungObj put: [:val| hasYoungObj := val]) asInteger.
+ 	self mapFor: cogMethod
+ 		performUntil: #remapIfObjectRef:pc:hasYoung:
+ 		arg: hasYoungObjPtr asVoidPointer.
+ 	hasYoungObj
+ 		ifTrue: [methodZone ensureInYoungReferrers: cogMethod]
+ 		ifFalse: [writableCogMethod cmRefersToYoung: false]!

Item was changed:
  ----- Method: Cogit>>followForwardedLiteralsIn: (in category 'garbage collection') -----
  followForwardedLiteralsIn: cogMethod
  	<api>
  	<option: #SpurObjectMemory>
  	<var: #cogMethod type: #'CogMethod *'>
- 	| writableCogMethod hasYoungObj hasYoungObjPtr |
- 	self assert: (cogMethod cmType ~= CMMethod or: [(objectMemory isForwarded: cogMethod methodObject) not]).
- 	writableCogMethod := self writableMethodFor: cogMethod.
  	self ensureWritableCodeZone.
+ 	self followForwardedLiteralsImplementationIn: cogMethod.
- 	hasYoungObj := objectMemory isYoung: cogMethod methodObject.
- 	(objectMemory shouldRemapOop: cogMethod selector) ifTrue:
- 		[writableCogMethod selector: (objectMemory remapObj: cogMethod selector).
- 		 (objectMemory isYoung: cogMethod selector) ifTrue:
- 			[hasYoungObj := true]].
- 	hasYoungObjPtr := (self addressOf: hasYoungObj put: [:val| hasYoungObj := val]) asInteger.
- 	self mapFor: cogMethod
- 		performUntil: #remapIfObjectRef:pc:hasYoung:
- 		arg: hasYoungObjPtr asVoidPointer.
- 	hasYoungObj
- 		ifTrue: [methodZone ensureInYoungReferrers: cogMethod]
- 		ifFalse: [writableCogMethod cmRefersToYoung: false].
  	self ensureExecutableCodeZone!

Item was changed:
  ----- Method: Spur32BitMemoryManager>>objectAfterMaybeSlimBridge:limit: (in category 'object enumeration-private') -----
  objectAfterMaybeSlimBridge: objOop limit: limit
  	"Object parsing.
  	1. all objects have at least a word following the header, for a forwarding pointer.
  	2. objects with an overflow size have a preceding word with a saturated numSlots.  If the word
  	   following an object doesn't have a saturated numSlots field it must be a single-header object.
  	   If the word following does have a saturated numSlots it must be the overflow size word.
+ 
  	This variation on objectAfter:limit: allows for a single (64-bit) word bridge which may be needed
  	to bridge from an almost full pastSpace to eden.  It is only used in the flat enumerators that use
  	startAddressForBridgedHeapEnumeration and enumerate over pastSpace, eden and oldSpace
  	in that order.  Note that the order for allObjects, and allInstances enumerates over oldSpace first.
  
  	This hack is cheap.  It increases the size of the objectAfter code, but saves two extra copies of
  	the inner loop, since the inner loop now enumerates over all of pastSpace, eden and oldSpace.
  	The test for a slim bridge is only performed if applied to an overflow header, and typically only
  	1 in 400 objects have overflow headers in 32-bits, 1 in 500 in 64-bits.  The complication is that
  	image segment loading evaporates the word array by setting the overflow slots to 1, and this
  	is ambiguous with a slimbridge.  The resolution is that if the segmentArray has an overflow header,
+ 	and is in new space, then its slot size can be zeroed and its overflow header changed to a slimbridge.
+ 
+ 	At some point we should allow slimbridges (slivers?) throughout object memory, and use them to
+ 	provide object alignment by slimbridges (slivers?) padding up to the following (aligned) object."
- 	and is in new space, then it slot size can be zeroed and its overflow header changed to a slimbridge."
  	<inline: true>
  	| followingWordAddress followingWord |
  	followingWordAddress := self addressAfter: objOop.
  	(self oop: followingWordAddress isGreaterThanOrEqualTo: limit) ifTrue:
  		[^limit].
  	self flag: #endianness.
  	followingWord := self longAt: followingWordAddress + 4.
  	^followingWord >> self numSlotsHalfShift = self numSlotsMask
  		ifTrue: [((self oop: objOop isLessThan: oldSpaceStart)
  				 and: [1 = (self longAt: followingWordAddress)]) "i.e. the raw overflow slots in the overflow word"
  					ifTrue: [followingWordAddress + self baseHeaderSize + self baseHeaderSize] "skip the one word slimbridge"
  					ifFalse: [followingWordAddress + self baseHeaderSize]]
  		ifFalse: [followingWordAddress]!

Item was changed:
  ----- Method: Spur64BitMemoryManager>>objectAfterMaybeSlimBridge:limit: (in category 'object enumeration-private') -----
  objectAfterMaybeSlimBridge: objOop limit: limit
  	"Object parsing.
  	1. all objects have at least a word following the header, for a forwarding pointer.
  	2. objects with an overflow size have a preceding word with a saturated numSlots.  If the word
  	   following an object doesn't have a saturated numSlots field it must be a single-header object.
  	   If the word following does have a saturated numSlots it must be the overflow size word.
+ 
  	This variation on objectAfter:limit: allows for a single (64-bit) word bridge which may be needed
  	to bridge from an almost full pastSpace to eden.  It is only used in the flat enumerators that use
  	startAddressForBridgedHeapEnumeration and enumerate over pastSpace, eden and oldSpace
  	in that order.  Note that the order for allObjects, and allInstances enumerates over oldSpace first.
  
  	This hack is cheap.  It increases the size of the objectAfter code, but saves two extra copies of
  	the inner loop, since the inner loop now enumerates over all of pastSpace, eden and oldSpace.
  	The test for a slim bridge is only performed if applied to an overflow header, and typically only
  	1 in 400 objects have overflow headers in 32-bits, 1 in 500 in 64-bits.  The complication is that
  	image segment loading evaporates the word array by setting the overflow slots to 1, and this
  	is ambiguous with a slimbridge.  The resolution is that if the segmentArray has an overflow header,
+ 	and is in new space, then its slot size can be zeroed and its overflow header changed to a slimbridge.
+ 
+ 	At some point we should allow slimbridges (slivers?) throughout object memory, and use them to
+ 	provide object alignment by slimbridges (slivers?) padding up to the following (aligned) object."
+ 
- 	and is in new space, then it slot size can be zeroed and its overflow header changed to a slimbridge."
  	<inline: true>
  	| followingWordAddress followingWord |
  	followingWordAddress := self addressAfter: objOop.
  	(self oop: followingWordAddress isGreaterThanOrEqualTo: limit) ifTrue:
  		[^limit].
  	self flag: #endianness.
  	followingWord := self longAt: followingWordAddress.
  	^followingWord >> self numSlotsFullShift = self numSlotsMask
  		ifTrue:
  			[((self oop: objOop isLessThan: oldSpaceStart)
  			 and: [(followingWord bitAnd: 16rFFFFFFFFFFFFFF) = 1])
  				ifTrue: [followingWordAddress + self baseHeaderSize + self baseHeaderSize] "skip the one word slimbridge"
  				ifFalse: [followingWordAddress + self baseHeaderSize]]
  		ifFalse: [followingWordAddress]!

Item was changed:
  CogClass subclass: #SpurMemoryManager
(excessive size, no diff calculated)



More information about the Vm-dev mailing list