Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2701.mcz==================== Summary ====================
Name: VMMaker.oscog-eem.2701
Author: eem
Time: 3 February 2020, 4:34:10.823106 pm
UUID: 1a142e3b-1246-43e2-b1ec-4d20f7edc92d
Ancestors: VMMaker.oscog-eem.2700
Slang: Fix segregateByGroupingSizeAndVisibility: for plugins (sizeof: #sqInt = 6).
=============== Diff against VMMaker.oscog-eem.2700 ===============
Item was changed:
----- Method: CCodeGenerator>>segregateByGroupingSizeAndVisibility: (in category 'utilities') -----
segregateByGroupingSizeAndVisibility: variables
"Sort variables by grouping (clusteredVariables first), by size (pointer & integer
vars sorted from defaultWordSize to bytes), and finally by size, public last. The
intent is to group smaller variables together for better locality (because we can)."
| clusteredVariableNames streams defaultStream defaultWordSize groupedBySize privateStream publicStream |
+ defaultWordSize := vmClass ifNotNil: [vmClass objectMemoryClass wordSize] ifNil: 8. "We now live in a 64-bit"
clusteredVariableNames := ([vmClass clusteredVariableNames]
on: MessageNotUnderstood
do: [:ex| #()]).
streams := (1 to: 8) collect: [:i| i isPowerOfTwo ifTrue: [(Array new: variables size // 2) writeStream]].
+ streams at: 6 put: (streams at: defaultWordSize). "In plugin land sqInt has size 6..."
defaultStream := (Array new: variables size // 2) writeStream.
- defaultWordSize := vmClass ifNotNil: [vmClass objectMemoryClass wordSize] ifNil: 8. "We now live in a 64-bit"
variables do:
[:varName| | type |
(clusteredVariableNames includes: varName) ifFalse:
[type := variableDeclarations
at: varName
ifPresent: [:decl| self extractTypeFor: varName fromDeclaration: decl]
ifAbsent: [#sqInt].
((self isSimpleType: type)
ifTrue: [streams at: ((self isPointerCType: type)
ifTrue: [defaultWordSize]
ifFalse: [self sizeOfIntegralCType: type])]
ifFalse: [defaultStream])
nextPut: varName]].
groupedBySize := Array new: variables size streamContents:
[:varStream|
varStream
nextPutAll: clusteredVariableNames;
nextPutAll: (streams at: defaultWordSize) contents;
nextPutAll: (streams at: (defaultWordSize = 8 ifTrue: [4] ifFalse: [8])) contents;
nextPutAll: (streams at: 2) contents;
nextPutAll: (streams at: 1) contents;
nextPutAll: defaultStream contents].
publicStream := (Array new: variables size // 2) writeStream.
privateStream := (Array new: variables size // 2) writeStream.
groupedBySize do:
[:varName|
(((self mustBeGlobal: varName) or: [clusteredVariableNames includes: varName])
ifTrue: [publicStream]
ifFalse: [privateStream]) nextPut: varName].
^privateStream contents, publicStream contents!