equal
deleted
inserted
replaced
3 Object subclass:#PPCNode |
3 Object subclass:#PPCNode |
4 instanceVariableNames:'contextFree name' |
4 instanceVariableNames:'contextFree name' |
5 classVariableNames:'' |
5 classVariableNames:'' |
6 poolDictionaries:'' |
6 poolDictionaries:'' |
7 category:'PetitCompiler-Nodes' |
7 category:'PetitCompiler-Nodes' |
8 ! |
|
9 |
|
10 PPCNode comment:'' |
|
11 ! |
8 ! |
12 |
9 |
13 !PPCNode methodsFor:'accessing'! |
10 !PPCNode methodsFor:'accessing'! |
14 |
11 |
15 children |
12 children |
187 |
184 |
188 ^ parameters |
185 ^ parameters |
189 ! |
186 ! |
190 |
187 |
191 doOptimizationLoop: params status: changeStatus |
188 doOptimizationLoop: params status: changeStatus |
192 | mapping optimized root | |
189 | mapping optimized root | |
193 mapping := IdentityDictionary new. |
190 mapping := IdentityDictionary new. |
194 self allNodes do: [ :node | |
191 self allNodes do: [ :node | |
195 optimized := (node optimize: params status: changeStatus). |
192 optimized := (node optimize: params status: changeStatus). |
196 (optimized ~= node) ifTrue: [ |
193 (optimized ~= node) ifTrue: [ |
197 mapping at: node put: optimized. |
194 mapping at: node put: optimized. |
198 ]. |
195 ]. |
199 ]. |
196 ]. |
200 |
197 |
201 root := mapping at: self ifAbsent: [ self ]. |
198 root := mapping at: self ifAbsent: [ self ]. |
202 [ | changed | |
199 [ | changed | |
203 changed := false. |
200 changed := false. |
204 root allNodes do: [ :node | |
201 root allNodes do: [ :node | |
205 node children do: [ :child | |
202 node children do: [ :child | |
206 mapping at: child ifPresent: [:newChild | |
203 mapping at: child ifPresent: [:newChild | |
207 node replace: child with: newChild. |
204 node replace: child with: newChild. |
208 changed := true ] |
205 changed := true. |
209 ]]. |
206 changeStatus change] |
210 changed |
207 ]]. |
211 ] whileTrue. |
208 changed |
212 ^ root |
209 ] whileTrue. |
|
210 ^ root |
|
211 |
|
212 "Modified: / 26-10-2014 / 01:14:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
213 ! |
213 ! |
214 |
214 |
215 inline: changeStatus |
215 inline: changeStatus |
216 "nothing to do" |
216 "nothing to do" |
217 ! |
217 ! |