[Vm-dev] VM Maker: VMMaker.oscog-eem.1313.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon May 18 00:50:06 UTC 2015
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1313.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1313
Author: eem
Time: 17 May 2015, 5:47:58.622 pm
UUID: f7251538-4676-49b4-bc2c-f2cfecd2a3ae
Ancestors: VMMaker.oscog-eem.1312
Fix edge case in read-before-written initializer.
=============== Diff against VMMaker.oscog-eem.1312 ===============
Item was changed:
----- Method: TMethod>>removeUnusedTempsAndNilIfRequiredIn: (in category 'utilities') -----
removeUnusedTempsAndNilIfRequiredIn: aCodeGen
"Remove all of the unused temps in this method. Answer a set of the references.
As a side-effect introduce explicit temp := nil statements for temps that are
tested for nil before necessarily being assigned."
+ | refs readBeforeAssigned simplyTypedLocals |
- | refs readBeforeAssigned |
refs := self removeUnusedTempsIn: aCodeGen.
"reset the locals to be only those still referred to"
locals := locals select: [:e| refs includes: e].
(locals notEmpty
and: [aCodeGen
pushScope: declarations
+ while: [simplyTypedLocals := locals select:
+ [:ea|
+ (self typeFor: ea in: aCodeGen)
+ ifNil: [false]
+ ifNotNil: [:type| aCodeGen isSimpleType: type]].
+ (readBeforeAssigned := (self findReadBeforeAssignedIn: simplyTypedLocals in: aCodeGen)) notEmpty]]) ifTrue:
- while: [(readBeforeAssigned := (self findReadBeforeAssignedIn: (locals select: [:ea| aCodeGen isSimpleType: (self typeFor: ea in: aCodeGen)])
- in: aCodeGen)) notEmpty]]) ifTrue:
[readBeforeAssigned := readBeforeAssigned reject:
[:v| | d | "don't initialize externs, arrays or the explicitly initialized."
d := self declarationAt: v.
(d beginsWith: 'extern') or: [(d includes: $[) or: [d includes: $=]]].
parseTree statements addAllFirst:
(readBeforeAssigned asSortedCollection collect:
[:var|
TAssignmentNode new
setVariable: (TVariableNode new setName: var; yourself)
expression: (TConstantNode new setValue: 0; yourself)])].
^refs!
More information about the Vm-dev
mailing list