From fd7d8138a4ff5515f9b79c584a98d5c26d8ddb8a Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 2 Mar 2017 05:48:01 -0800 Subject: 3750 --- html/074deep_copy.cc.html | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'html/074deep_copy.cc.html') diff --git a/html/074deep_copy.cc.html b/html/074deep_copy.cc.html index 6ce251c7..a095aac9 100644 --- a/html/074deep_copy.cc.html +++ b/html/074deep_copy.cc.html @@ -257,15 +257,15 @@ if ('onhashchange' in window) { 195 :(before "End Primitive Recipe Checks") 196 case DEEP_COPY: { 197 if (SIZE(inst.ingredients) != 1) { -198 raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << inst.original_string << "'\n" << end(); +198 raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << inst.original_string << "'\n" << end(); 199 break; 200 } 201 if (SIZE(inst.products) != 1) { -202 raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << inst.original_string << "'\n" << end(); +202 raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << inst.original_string << "'\n" << end(); 203 break; 204 } 205 if (!types_strictly_match(inst.ingredients.at(0), inst.products.at(0))) { -206 raise << maybe(get(Recipe, r).name) << "'deep-copy' requires its ingredient and product to be the same type, but got '" << inst.original_string << "'\n" << end(); +206 raise << maybe(get(Recipe, r).name) << "'deep-copy' requires its ingredient and product to be the same type, but got '" << inst.original_string << "'\n" << end(); 207 break; 208 } 209 break; @@ -274,12 +274,12 @@ if ('onhashchange' in window) { 212 case DEEP_COPY: { 213 const reagent& input = current_instruction().ingredients.at(0); 214 // allocate a tiny bit of temporary space for deep_copy() -215 trace(9991, "run") << "deep-copy: allocating space for temporary" << end(); +215 trace(9991, "run") << "deep-copy: allocating space for temporary" << end(); 216 reagent tmp("tmp:address:number"); 217 tmp.set_value(allocate(1)); 218 products.push_back(deep_copy(input, tmp)); 219 // reclaim Mu memory allocated for tmp -220 trace(9991, "run") << "deep-copy: reclaiming temporary" << end(); +220 trace(9991, "run") << "deep-copy: reclaiming temporary" << end(); 221 abandon(tmp.value, payload_type(tmp.type), payload_size(tmp)); 222 // reclaim host memory allocated for tmp.type when tmp goes out of scope 223 break; @@ -305,29 +305,29 @@ if ('onhashchange' in window) { 243 int deep_copy_address(const reagent& canonized_in, map<int, int>& addresses_copied, const reagent& tmp) { 244 if (canonized_in.value == 0) return 0; 245 int in_address = payload_address(canonized_in); -246 trace(9991, "run") << "deep-copy: copying address " << in_address << end(); +246 trace(9991, "run") << "deep-copy: copying address " << in_address << end(); 247 if (contains_key(addresses_copied, in_address)) { 248 int out = get(addresses_copied, in_address); -249 trace(9991, "run") << "deep-copy: copy already exists: " << out << end(); +249 trace(9991, "run") << "deep-copy: copy already exists: " << out << end(); 250 return out; 251 } 252 int out = allocate(payload_size(canonized_in)); -253 trace(9991, "run") << "deep-copy: new address is " << out << end(); +253 trace(9991, "run") << "deep-copy: new address is " << out << end(); 254 put(addresses_copied, in_address, out); 255 reagent/*copy*/ payload = canonized_in; 256 payload.properties.push_back(pair<string, string_tree*>("lookup", NULL)); -257 trace(9991, "run") << "recursing on payload " << payload.value << ' ' << to_string(payload) << end(); +257 trace(9991, "run") << "recursing on payload " << payload.value << ' ' << to_string(payload) << end(); 258 vector<double> data = deep_copy(payload, addresses_copied, tmp); -259 trace(9991, "run") << "deep-copy: writing result " << out << ": " << to_string(data) << end(); +259 trace(9991, "run") << "deep-copy: writing result " << out << ": " << to_string(data) << end(); 260 // HACK: write_memory interface isn't ideal for this situation; we need 261 // a temporary location to help copy the payload. -262 trace(9991, "run") << "deep-copy: writing temporary " << tmp.value << ": " << out << end(); +262 trace(9991, "run") << "deep-copy: writing temporary " << tmp.value << ": " << out << end(); 263 put(Memory, tmp.value, out); 264 payload.set_value(tmp.value); // now modified for output 265 vector<double> old_data = read_memory(payload); -266 trace(9991, "run") << "deep-copy: really writing to " << payload.value << ' ' << to_string(payload) << " (old value " << to_string(old_data) << " new value " << to_string(data) << ")" << end(); +266 trace(9991, "run") << "deep-copy: really writing to " << payload.value << ' ' << to_string(payload) << " (old value " << to_string(old_data) << " new value " << to_string(data) << ")" << end(); 267 write_memory(payload, data); -268 trace(9991, "run") << "deep-copy: output is " << to_string(data) << end(); +268 trace(9991, "run") << "deep-copy: output is " << to_string(data) << end(); 269 return out; 270 } 271 @@ -335,13 +335,13 @@ if ('onhashchange' in window) { 273 void deep_copy(const reagent& canonized_in, map<int, int>& addresses_copied, const reagent& tmp, vector<double>& out) { 274 assert(!is_mu_address(canonized_in)); 275 vector<double> data = read_memory(canonized_in); -276 out.insert(out.end(), data.begin(), data.end()); +276 out.insert(out.end(), data.begin(), data.end()); 277 if (!contains_key(Container_metadata, canonized_in.type)) return; -278 trace(9991, "run") << "deep-copy: scanning for addresses in " << to_string(data) << end(); +278 trace(9991, "run") << "deep-copy: scanning for addresses in " << to_string(data) << end(); 279 const container_metadata& metadata = get(Container_metadata, canonized_in.type); -280 for (map<set<tag_condition_info>, set<address_element_info> >::const_iterator p = metadata.address.begin(); p != metadata.address.end(); ++p) { +280 for (map<set<tag_condition_info>, set<address_element_info> >::const_iterator p = metadata.address.begin(); p != metadata.address.end(); ++p) { 281 if (!all_match(data, p->first)) continue; -282 for (set<address_element_info>::const_iterator info = p->second.begin(); info != p->second.end(); ++info) { +282 for (set<address_element_info>::const_iterator info = p->second.begin(); info != p->second.end(); ++info) { 283 // construct a fake reagent that reads directly from the appropriate 284 // field of the container 285 reagent curr; @@ -351,7 +351,7 @@ if ('onhashchange' in window) { 289 curr.type = new type_tree(new type_tree("address"), new type_tree(*info->payload_type)); 290 curr.set_value(canonized_in.value + info->offset); 291 curr.properties.push_back(pair<string, string_tree*>("raw", NULL)); -292 trace(9991, "run") << "deep-copy: copying address " << curr.value << end(); +292 trace(9991, "run") << "deep-copy: copying address " << curr.value << end(); 293 out.at(info->offset) = deep_copy_address(curr, addresses_copied, tmp); 294 } 295 } -- cgit 1.4.1-2-gfad0