[Vm-dev] VM Maker: VMMaker.oscog-eem.1293.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu May 7 23:46:29 UTC 2015
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1293.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1293
Author: eem
Time: 7 May 2015, 4:44:33.335 pm
UUID: ed2bc7a3-7765-48d2-ab78-08f4a0488693
Ancestors: VMMaker.oscog-eem.1292
Doh! The read-before-written initialization scheme
needs to exclude explicitly initialized variables too.
Thanks Esteban. Forgive my being dense.
=============== Diff against VMMaker.oscog-eem.1292 ===============
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 |
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: [(readBeforeAssigned := (self findReadBeforeAssignedIn: locals in: aCodeGen)) notEmpty]]) ifTrue:
[readBeforeAssigned := readBeforeAssigned reject:
+ [:v| | d | "don't initialize externs, arrays or the explicitly initialized."
- [:v| | d | "don't initialize externa and/or arrays"
d := self declarationAt: v.
+ (d beginsWith: 'extern') or: [(d includes: $[) or: [d includes: $=]]].
- (d beginsWith: 'extern') 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