| 1 |
|
| 2 |
nomenclature: |
| 3 |
|
| 4 |
Unrolling follows that order of operations: |
| 5 |
|
| 6 |
* optimize one version of a loop, call it <preamble>. At the end of <preamble>, |
| 7 |
we gather virtual state by visiting the status of optimized boxes as |
| 8 |
presented in the arguments to JUMP. Virtual state then can produce |
| 9 |
a number of inputargs from a list |
| 10 |
|
| 11 |
* gather all the operations that can be produced in the short preamble. They're, |
| 12 |
as far as I can tell: |
| 13 |
|
| 14 |
- jump arguments, as generated from the virtual state |
| 15 |
|
| 16 |
- pure operations, including pure calls |
| 17 |
|
| 18 |
- call_loopinvariant |
| 19 |
|
| 20 |
- heap cache |
| 21 |
|
| 22 |
or the combination of the above. Note that some operations can be produced |
| 23 |
in more than one way. In those cases we keep both. |
| 24 |
|
| 25 |
* the optimizer state is influenced by replaying all the short boxes producing |
| 26 |
operations. This populates the heap cache and the pure operation cache. |
| 27 |
|
| 28 |
* import the values of the inputargs (so e.g. constantness, intbounds, etc.) |
| 29 |
|
| 30 |
* we optimize normally, using extra boxes from the optimizer state |
| 31 |
|
| 32 |
* we import all the boxes that were not generated during this optimization |
| 33 |
phase. This means, they have to: |
| 34 |
|
| 35 |
* be added to the start label |
| 36 |
|
| 37 |
* be added to the end jump |
| 38 |
|
| 39 |
* be added to the short preamble |
| 40 |
|
| 41 |
* we close the loop, which creates correct boxes in the jump (from virtualstate) |
| 42 |
|