[Vm-dev] VM Maker: VMMaker.oscog-eem.3096.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Oct 26 19:49:58 UTC 2021
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3096.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3096
Author: eem
Time: 26 October 2021, 12:49:38.474321 pm
UUID: 0bc94f9b-c941-4df4-976d-2f4cbef41379
Ancestors: VMMaker.oscog-eem.3095
Spur Slang: fix a bug in computing accessor depth chains. If a primitive contains different assignments to the same variable (e.g. a primitive which has different forms for var args such as PSharePlugin>>primitivePostKeyboardEvent as of 10/26/2021) then the simple test would consider an assignment to the same variable as an extension. Fixed with a simple filter, adding the unless: block to the anySatisfy: over expressions.
=============== Diff against VMMaker.oscog-eem.3095 ===============
Item was changed:
----- Method: CCodeGenerator>>transitiveClosureOfAccessorChainRoots:accessors:assignments: (in category 'spur primitive compilation') -----
transitiveClosureOfAccessorChainRoots: roots accessors: accessors assignments: assignments
"Compute the transitive closure of accessor and assignment expressions from the roots.
Start from the stack accesses (the roots)."
| chains chainSets expressions extended extendedChains |
chains := OrderedCollection new.
roots do:
[:root|
chains
addAll: (assignments
select: [:assignment| assignment expression isSameAs: root]
thenCollect: [:assignment| {assignment}]);
addAll: (accessors
select: [:accessor| accessor anySatisfy: [:subnode| subnode isSameAs: root]]
thenCollect: [:accessor| {accessor}])].
chains isEmpty ifTrue:
[^roots collect: [:root| {root}]].
"chainSets are the visited sets for each chain root. For example, in primiitveSpurStringReplace
objectMemory storeByte: i ofObject: array withValue: (objectMemory fetchByte: srcDelta + i ofObject: repl)
is reachable both from
array := self stackValue: 4
and from
repl := self stackValue: 1.
If there is only a single visited set we will compute only one of these paths."
chainSets := Dictionary new.
chains do:
[:tuple| chainSets at: tuple first put: (Set with: tuple first)].
(expressions := Set new)
addAll: accessors;
addAll: assignments.
[extended := false.
extendedChains := OrderedCollection new: chains size * 2.
chains do:
[:chain| | visited |
visited := chainSets at: chain first.
chain last isAssignment
ifTrue: "extend with any and all new references to the variable at the end of the chain."
[| tip |
tip := chain last variable.
+ (expressions select: [:expr|
+ (visited includes: expr) not
+ and: [expr
+ anySatisfy: [:node| tip isSameAs: node]
+ unless: [:node| node isAssignment and: [node variable isSameAs: tip]]]])
- (expressions select: [:expr| (visited includes: expr) not and: [expr anySatisfy: [:node| tip isSameAs: node]]])
ifEmpty: [extendedChains addLast: chain]
ifNotEmpty:
[:refs|
extendedChains addAll: ((visited addAll: refs) collect: [:ref| chain, {ref}]).
extended := true]]
ifFalse:
[extendedChains addLast: chain]].
extended] whileTrue:
[chains := extendedChains].
^extendedChains!
More information about the Vm-dev
mailing list