From c0f84b1ffa18eaf6f399aafe462f2a0f705dd009 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 7 Dec 2017 16:22:23 -0800 Subject: 4155 --- html/071deep_copy.cc.html | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'html/071deep_copy.cc.html') diff --git a/html/071deep_copy.cc.html b/html/071deep_copy.cc.html index 6a4b577e..0a7f6295 100644 --- a/html/071deep_copy.cc.html +++ b/html/071deep_copy.cc.html @@ -269,36 +269,36 @@ if ('onhashchange' in window) { 205 :(before "End Primitive Recipe Checks") 206 case DEEP_COPY: { 207 if (SIZE(inst.ingredients) != 1) { -208 ¦ raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end(); +208 ¦ raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end(); 209 ¦ break; 210 } 211 if (SIZE(inst.products) != 1) { -212 ¦ raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end(); +212 ¦ raise << maybe(get(Recipe, r).name) << "'deep-copy' takes exactly one ingredient rather than '" << to_original_string(inst) << "'\n" << end(); 213 ¦ break; 214 } 215 if (!types_strictly_match(inst.ingredients.at(0), inst.products.at(0))) { -216 ¦ raise << maybe(get(Recipe, r).name) << "'deep-copy' requires its ingredient and product to be the same type, but got '" << to_original_string(inst) << "'\n" << end(); +216 ¦ raise << maybe(get(Recipe, r).name) << "'deep-copy' requires its ingredient and product to be the same type, but got '" << to_original_string(inst) << "'\n" << end(); 217 ¦ break; 218 } 219 break; 220 } 221 :(before "End Primitive Recipe Implementations") 222 case DEEP_COPY: { -223 products.push_back(deep_copy(current_instruction().ingredients.at(0))); +223 products.push_back(deep_copy(current_instruction().ingredients.at(0))); 224 break; 225 } 226 227 :(code) 228 vector<double> deep_copy(const reagent& in) { 229 // allocate a tiny bit of temporary space for deep_copy() -230 trace(9991, "run") << "deep-copy: allocating space for temporary" << end(); +230 trace(9991, "run") << "deep-copy: allocating space for temporary" << end(); 231 reagent tmp("tmp:address:number"); 232 tmp.set_value(allocate(1)); 233 map<int, int> addresses_copied; 234 vector<double> result = deep_copy(in, addresses_copied, tmp); 235 // reclaim Mu memory allocated for tmp -236 trace(9991, "run") << "deep-copy: reclaiming temporary" << end(); -237 abandon(tmp.value, payload_type(tmp.type), payload_size(tmp)); +236 trace(9991, "run") << "deep-copy: reclaiming temporary" << end(); +237 abandon(tmp.value, payload_type(tmp.type), payload_size(tmp)); 238 // reclaim host memory allocated for tmp.type when tmp goes out of scope 239 return result; 240 } @@ -323,31 +323,31 @@ if ('onhashchange' in window) { 259 int deep_copy_address(const reagent& canonized_in, map<int, int>& addresses_copied, const reagent& tmp) { 260 if (address_value(canonized_in) == 0) return 0; 261 int in_address = payload_address(canonized_in); -262 trace(9991, "run") << "deep-copy: copying address " << in_address << end(); +262 trace(9991, "run") << "deep-copy: copying address " << in_address << end(); 263 if (contains_key(addresses_copied, in_address)) { 264 ¦ int out = get(addresses_copied, in_address); -265 ¦ trace(9991, "run") << "deep-copy: copy already exists: " << out << end(); +265 ¦ trace(9991, "run") << "deep-copy: copy already exists: " << out << end(); 266 ¦ assert(contains_key(Memory, out)); // refcount must already be incremented 267 ¦ ++get(Memory, out); 268 ¦ return out; 269 } -270 int out = allocate(payload_size(canonized_in)); -271 trace(9991, "run") << "deep-copy: new address is " << out << end(); +270 int out = allocate(payload_size(canonized_in)); +271 trace(9991, "run") << "deep-copy: new address is " << out << end(); 272 put(addresses_copied, in_address, out); 273 reagent/*copy*/ payload = canonized_in; 274 payload.properties.push_back(pair<string, string_tree*>("lookup", NULL)); -275 trace(9991, "run") << "recursing on payload " << payload.value << ' ' << to_string(payload) << end(); +275 trace(9991, "run") << "recursing on payload " << payload.value << ' ' << to_string(payload) << end(); 276 vector<double> data = deep_copy(payload, addresses_copied, tmp); -277 trace(9991, "run") << "deep-copy: writing result " << out << ": " << to_string(data) << end(); +277 trace(9991, "run") << "deep-copy: writing result " << out << ": " << to_string(data) << end(); 278 // HACK: write_memory interface isn't ideal for this situation; we need 279 // a temporary location to help copy the payload. -280 trace(9991, "run") << "deep-copy: writing temporary " << tmp.value << ": " << out << end(); +280 trace(9991, "run") << "deep-copy: writing temporary " << tmp.value << ": " << out << end(); 281 put(Memory, tmp.value, out); 282 payload.set_value(tmp.value); // now modified for output 283 vector<double> old_data = read_memory(payload); -284 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(); +284 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(); 285 write_memory(payload, data); -286 trace(9991, "run") << "deep-copy: output is " << to_string(data) << end(); +286 trace(9991, "run") << "deep-copy: output is " << to_string(data) << end(); 287 return out; 288 } 289 @@ -355,13 +355,13 @@ if ('onhashchange' in window) { 291 void deep_copy(const reagent& canonized_in, map<int, int>& addresses_copied, const reagent& tmp, vector<double>& out) { 292 assert(!is_mu_address(canonized_in)); 293 vector<double> data = read_memory(canonized_in); -294 out.insert(out.end(), data.begin(), data.end()); +294 out.insert(out.end(), data.begin(), data.end()); 295 if (!contains_key(Container_metadata, canonized_in.type)) return; -296 trace(9991, "run") << "deep-copy: scanning for addresses in " << to_string(data) << end(); +296 trace(9991, "run") << "deep-copy: scanning for addresses in " << to_string(data) << end(); 297 const container_metadata& metadata = get(Container_metadata, canonized_in.type); -298 for (map<set<tag_condition_info>, set<address_element_info> >::const_iterator p = metadata.address.begin(); p != metadata.address.end(); ++p) { +298 for (map<set<tag_condition_info>, set<address_element_info> >::const_iterator p = metadata.address.begin(); p != metadata.address.end(); ++p) { 299 ¦ if (!all_match(data, p->first)) continue; -300 ¦ for (set<address_element_info>::const_iterator info = p->second.begin(); info != p->second.end(); ++info) { +300 ¦ for (set<address_element_info>::const_iterator info = p->second.begin(); info != p->second.end(); ++info) { 301 ¦ ¦ // hack: skip primitive containers that do their own locking; they're designed to be shared between routines 302 ¦ ¦ if (!info->payload_type->atom && info->payload_type->left->name == "channel") 303 ¦ ¦ ¦ continue; @@ -376,7 +376,7 @@ if ('onhashchange' in window) { 312 ¦ ¦ ¦ curr.type = new type_tree(new type_tree("address"), new type_tree(*info->payload_type)); 313 ¦ ¦ curr.set_value(canonized_in.value + info->offset); 314 ¦ ¦ curr.properties.push_back(pair<string, string_tree*>("raw", NULL)); -315 ¦ ¦ trace(9991, "run") << "deep-copy: copying address " << curr.value << end(); +315 ¦ ¦ trace(9991, "run") << "deep-copy: copying address " << curr.value << end(); 316 ¦ ¦ out.at(info->offset) = deep_copy_address(curr, addresses_copied, tmp); 317 ¦ } 318 } -- cgit 1.4.1-2-gfad0