Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.
|Comment:||Fix some Markdown typos|
|Timelines:||family | ancestors | descendants | both | kbk-refactor-callframe|
|Files:||files | file ages | folders|
|User & Date:||kbk 2019-02-16 21:43:03|
|21:48||Fix some Markdown typos check-in: bdd91a03bf user: kbk tags: kbk-refactor-callframe|
|21:43||Fix some Markdown typos check-in: a0fc4f2102 user: kbk tags: kbk-refactor-callframe|
|21:40||Start writing discussion of callframe management check-in: 50af9aa069 user: kbk tags: kbk-refactor-callframe|
Changes to doc/20190216callframe/callframe.md.
28 28 29 29 One general strategy has been overwhelmingly successful in other areas 30 30 of quadcode manipulation. Rather than attempting to add operations 31 31 that handle the awkward cases when they are detected, it has been much 32 32 easier to generate code for the worst case always, and then optimize 33 33 it away. The code for variable accesses, for instance, is truly 34 34 horrific when initially generated: 35 + 35 36 + test that a variable exists, and throw an error otherwise 37 + 36 38 + test that the variable is not an array, and throw an error 37 39 otherwise. 40 + 38 41 + test that the value is of an admissible type for the operation 39 42 that will use it, and throw an error otherwise. 43 + 40 44 + downcast the value to an instance of the correct type. 45 + 41 46 + if the value is used in an arithmetic operation, purify the value, 42 47 that is, extract the machine-native representation. 43 48 44 49 Nevertheless, all of these tests become redundant if a second access 45 50 to the variable is dominated by the first. In that case, partial 46 51 redundancy elimination will eliminate all five of these steps and 47 52 simply use the pure value in the arithmetic operation. The partial 48 53 redundancy elimination is based largely on the value-based algorithms 49 -developed in (LT Simpson's PhD 50 -thesis)[https://www.clear.rice.edu/comp512/Lectures/Papers/SimpsonThesis.pdf]. 54 +developed in [LT Simpson's PhD 55 +thesis][SIMP96] 51 56 52 57 We therefore assume here that we will take the brutally simple 53 58 approach of generating code that: 59 + 54 60 + whenever a local variable (whether potentially aliased or not) is 55 61 loaded, generate a `moveFromCallFrame` instruction transferring a 56 62 Tcl value into an SSA value. 63 + 57 64 + whenever a local variable (whether potientially aliased or not) is 58 65 stored, generate a `moveToCallFrame` instruction transferring an 59 66 SSA value into a Tcl value. 67 + 60 68 + whenever an operation (an invocation, a direct operation, etc.) 61 69 may potentially refer to a local variable or an alias 62 70 thereof. make sure that it has the callframe as one of its inputs. 71 + 63 72 + whenever an operation (an invocation, a direct operation, etc.) 64 73 may potentially modify a local variable or an alias thereof, 65 74 make sure that it has the callframe as both an input and an 66 75 output. 76 + 67 77 + upon procedure exit (normal or abnormal) make sure that any 68 78 potentially aliased local variables are actually returned to the 69 79 callframe. 70 80 71 81 The last three items in the list ensure that we can track 72 82 antidependencies correctly; they become dependencies on the callframe 73 83 value. This, in turn, will require that we modify the `directSet`, ................................................................................ 86 96 operation may not be hoisted above a LOAD operation that might refer 87 97 to the same memory). His technique also does not contemplate downward 88 98 code motion, where a STORE operation that does not affect a loop's 89 99 operation might be moved to after the loop exit. To address these 90 100 deficiencies, it falls to us to develop a better theory of Tcl 91 101 variable accesses. 92 102 103 +## References 104 + 105 +[SIMP96]: <https://www.clear.rice.edu/comp512/Lectures/Papers/SimpsonThesis.pdf>. 106 +