From 615f4a970a2fa5c91766ee585a7d531b083f4bff Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 23 Sep 2017 19:30:00 -0700 Subject: 4003 --- html/043space.cc.html | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'html/043space.cc.html') diff --git a/html/043space.cc.html b/html/043space.cc.html index a513bd29..589bd60d 100644 --- a/html/043space.cc.html +++ b/html/043space.cc.html @@ -78,7 +78,7 @@ if ('onhashchange' in window) { 12 # if default-space is 10, and if an array of 5 locals lies from location 12 to 16 (inclusive), 13 # then local 0 is really location 12, local 1 is really location 13, and so on. 14 def main [ - 15 # pretend address:array:location; in practice we'll use new + 15 # pretend address:array:location; in practice we'll use 'new' 16 10:num <- copy 0 # refcount 17 11:num <- copy 5 # length 18 default-space:space <- copy 10/unsafe @@ -90,7 +90,7 @@ if ('onhashchange' in window) { 24 def main [ 25 # pretend pointer from outside (2000 reserved for refcount) 26 2001:num <- copy 34 - 27 # pretend address:array:location; in practice we'll use new + 27 # pretend address:array:location; in practice we'll use 'new" 28 1000:num <- copy 0 # refcount 29 1001:num <- copy 5 # length 30 # actual start of this recipe @@ -122,14 +122,14 @@ if ('onhashchange' in window) { 56 default_space = 0; 57 58 :(before "End canonize(x) Special-cases") - 59 absolutize(x); + 59 absolutize(x); 60 :(code) - 61 void absolutize(reagent& x) { + 61 void absolutize(reagent& x) { 62 if (is_raw(x) || is_dummy(x)) return; 63 if (x.name == "default-space") return; 64 if (!x.initialized) 65 ¦ raise << to_original_string(current_instruction()) << ": reagent not initialized: '" << x.original_string << "'\n" << end(); - 66 x.set_value(address(x.value, space_base(x))); + 66 x.set_value(address(x.value, space_base(x))); 67 x.properties.push_back(pair<string, string_tree*>("raw", NULL)); 68 assert(is_raw(x)); 69 } @@ -139,7 +139,7 @@ if ('onhashchange' in window) { 73 return current_call().default_space ? (current_call().default_space+/*skip refcount*/1) : 0; 74 } 75 - 76 int address(int offset, int base) { + 76 int address(int offset, int base) { 77 assert(offset >= 0); 78 if (base == 0) return offset; // raw 79 int size = get_or_insert(Memory, base); @@ -156,12 +156,12 @@ if ('onhashchange' in window) { 90 :(after "Begin Preprocess write_memory(x, data)") 91 if (x.name == "default-space") { 92 if (!scalar(data) || !is_space(x)) - 93 ¦ raise << maybe(current_recipe_name()) << "'default-space' should be of type address:array:location, but is " << to_string(x.type) << '\n' << end(); + 93 ¦ raise << maybe(current_recipe_name()) << "'default-space' should be of type address:array:location, but is " << to_string(x.type) << '\n' << end(); 94 current_call().default_space = data.at(0); 95 return; 96 } 97 :(code) - 98 bool is_space(const reagent& r) { + 98 bool is_space(const reagent& r) { 99 return is_address_of_array_of_numbers(r); 100 } 101 @@ -186,7 +186,7 @@ if ('onhashchange' in window) { 120 # pretend pointer to container from outside (2000 reserved for refcount) 121 2001:num <- copy 34 122 2002:num <- copy 35 -123 # pretend address:array:location; in practice we'll use new +123 # pretend address:array:location; in practice we'll use 'new' 124 1000:num <- copy 0 # refcount 125 1001:num <- copy 5 # length 126 # actual start of this recipe @@ -207,7 +207,7 @@ if ('onhashchange' in window) { 141 2001:num <- copy 2 # length 142 2002:num <- copy 34 143 2003:num <- copy 35 -144 # pretend address:array:location; in practice we'll use new +144 # pretend address:array:location; in practice we'll use 'new' 145 1000:num <- copy 0 # refcount 146 1001:num <- copy 5 # length 147 # actual start of this recipe @@ -245,7 +245,7 @@ if ('onhashchange' in window) { 179 // ``` 180 // where number-of-locals is Name[recipe][""] 181 if (curr.name == "new-default-space") { -182 rewrite_default_space_instruction(curr); +182 rewrite_default_space_instruction(curr); 183 } 184 :(after "Begin Preprocess read_memory(x)") 185 if (x.name == "number-of-locals") { @@ -287,17 +287,17 @@ if ('onhashchange' in window) { 221 222 :(before "End Rewrite Instruction(curr, recipe result)") 223 if (curr.name == "local-scope") { -224 rewrite_default_space_instruction(curr); +224 rewrite_default_space_instruction(curr); 225 } 226 227 //: todo: do this in a transform, rather than magically in the 'return' instruction 228 :(after "Falling Through End Of Recipe") -229 try_reclaim_locals(); +229 try_reclaim_locals(); 230 :(after "Starting Reply") -231 try_reclaim_locals(); +231 try_reclaim_locals(); 232 233 :(code) -234 void try_reclaim_locals() { +234 void try_reclaim_locals() { 235 if (!Reclaim_memory) return; 236 // only reclaim routines starting with 'local-scope' 237 const recipe_ordinal r = get(Recipe_ordinal, current_recipe_name()); @@ -314,7 +314,7 @@ if ('onhashchange' in window) { 248 ¦ ¦ // local variables only 249 ¦ ¦ if (has_property(product, "lookup")) continue; 250 ¦ ¦ if (has_property(product, "raw")) continue; // tests often want to check such locations after they run -251 ¦ ¦ if (escaping(product)) continue; +251 ¦ ¦ if (escaping(product)) continue; 252 ¦ ¦ // End Checks For Reclaiming Locals 253 ¦ ¦ trace(9999, "mem") << "clearing " << product.original_string << end(); 254 ¦ ¦ zeros.resize(size_of(product)); @@ -339,13 +339,13 @@ if ('onhashchange' in window) { 273 :(code) 274 // is this reagent one of the values returned by the current (return) instruction? 275 // is the corresponding ingredient saved in the caller? -276 bool escaping(const reagent& r) { +276 bool escaping(const reagent& r) { 277 assert(Current_routine); // run-time only 278 // nothing escapes when you fall through past end of recipe 279 if (current_step_index() >= SIZE(Current_routine->steps())) return false; 280 for (long long i = 0; i < SIZE(current_instruction().ingredients); ++i) { 281 ¦ if (r == current_instruction().ingredients.at(i)) { -282 ¦ ¦ if (caller_uses_product(i)) +282 ¦ ¦ if (caller_uses_product(i)) 283 ¦ ¦ ¦ return true; 284 ¦ } 285 } @@ -367,7 +367,7 @@ if ('onhashchange' in window) { 301 } 302 303 :(code) -304 bool caller_uses_product(int product_index) { +304 bool caller_uses_product(int product_index) { 305 assert(Current_routine); // run-time only 306 assert(!Current_routine->calls.empty()); 307 if (Current_routine->calls.size() == 1) return false; @@ -377,7 +377,7 @@ if ('onhashchange' in window) { 311 return !is_dummy(caller_inst.products.at(product_index)); 312 } 313 -314 void rewrite_default_space_instruction(instruction& curr) { +314 void rewrite_default_space_instruction(instruction& curr) { 315 if (!curr.ingredients.empty()) 316 ¦ raise << "'" << to_original_string(curr) << "' can't take any ingredients\n" << end(); 317 curr.name = "new"; -- cgit 1.4.1-2-gfad0