diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-10-29 12:09:23 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-10-29 12:09:23 -0700 |
commit | cdd6fd09673faa6ed72d1b7f52333c12100df049 (patch) | |
tree | 1b6355df38822a1daaf4e91df65dce556097d9bc | |
parent | d9025124a102fb7b421699e4e0463a3c62b261cb (diff) | |
download | mu-cdd6fd09673faa6ed72d1b7f52333c12100df049.tar.gz |
2313
-rw-r--r-- | 003trace.cc | 8 | ||||
-rw-r--r-- | 020run.cc | 4 | ||||
-rw-r--r-- | 024jump.cc | 10 | ||||
-rw-r--r-- | 029tools.cc | 4 | ||||
-rw-r--r-- | 030container.cc | 6 | ||||
-rw-r--r-- | 031address.cc | 2 | ||||
-rw-r--r-- | 032array.cc | 4 | ||||
-rw-r--r-- | 036call_reply.cc | 2 | ||||
-rw-r--r-- | 039wait.cc | 4 | ||||
-rw-r--r-- | 043new.cc | 10 | ||||
-rw-r--r-- | 050scenario.cc | 6 | ||||
-rw-r--r-- | 999spaces.cc | 7 |
12 files changed, 32 insertions, 35 deletions
diff --git a/003trace.cc b/003trace.cc index 2eab9017..4a563fc6 100644 --- a/003trace.cc +++ b/003trace.cc @@ -361,12 +361,10 @@ using std::ofstream; //: Errors will be depth 0. //: Warnings will be depth 1. //: Mu 'applications' will be able to use depths 2-100 as they like. -//: Primitive statements will occupy 101-9998 +//: Primitive statements will occupy 101-9989 const int Initial_callstack_depth = 101; -const int Max_callstack_depth = 9998; -//: Finally, details of primitive mu statements will occupy depth 9999 (more on that later as well) -:(before "End Globals") -const int Primitive_recipe_depth = 9999; +const int Max_callstack_depth = 9989; +//: Finally, details of primitive mu statements will occupy depth 9990-9999 (more on that later as well) //: //: This framework should help us hide some details at each level, mixing //: static ideas like layers with the dynamic notion of call-stack depth. diff --git a/020run.cc b/020run.cc index 4cccadef..b05836a4 100644 --- a/020run.cc +++ b/020run.cc @@ -258,7 +258,7 @@ vector<double> read_memory(reagent x) { long long int size = size_of(x); for (long long int offset = 0; offset < size; ++offset) { double val = Memory[base+offset]; - trace(Primitive_recipe_depth, "mem") << "location " << base+offset << " is " << no_scientific(val) << end(); + trace(9999, "mem") << "location " << base+offset << " is " << no_scientific(val) << end(); result.push_back(val); } return result; @@ -274,7 +274,7 @@ void write_memory(reagent x, vector<double> data) { } for (long long int offset = 0; offset < SIZE(data); ++offset) { if (base+offset == 0) continue; - trace(Primitive_recipe_depth, "mem") << "storing " << no_scientific(data.at(offset)) << " in location " << base+offset << end(); + trace(9999, "mem") << "storing " << no_scientific(data.at(offset)) << " in location " << base+offset << end(); Memory[base+offset] = data.at(offset); } } diff --git a/024jump.cc b/024jump.cc index 9e5c0838..30d5381f 100644 --- a/024jump.cc +++ b/024jump.cc @@ -29,7 +29,7 @@ case JUMP: { case JUMP: { assert(current_instruction().ingredients.at(0).initialized); current_step_index() += ingredients.at(0).at(0)+1; - trace(Primitive_recipe_depth, "run") << "jumping to instruction " << current_step_index() << end(); + trace(9998, "run") << "jumping to instruction " << current_step_index() << end(); continue; // skip rest of this instruction } @@ -72,11 +72,11 @@ case JUMP_IF: { case JUMP_IF: { assert(current_instruction().ingredients.at(1).initialized); if (!ingredients.at(0).at(0)) { - trace(Primitive_recipe_depth, "run") << "jump-if fell through" << end(); + trace(9998, "run") << "jump-if fell through" << end(); break; } current_step_index() += ingredients.at(1).at(0)+1; - trace(Primitive_recipe_depth, "run") << "jumping to instruction " << current_step_index() << end(); + trace(9998, "run") << "jumping to instruction " << current_step_index() << end(); continue; // skip rest of this instruction } @@ -124,11 +124,11 @@ case JUMP_UNLESS: { case JUMP_UNLESS: { assert(current_instruction().ingredients.at(1).initialized); if (ingredients.at(0).at(0)) { - trace(Primitive_recipe_depth, "run") << "jump-unless fell through" << end(); + trace(9998, "run") << "jump-unless fell through" << end(); break; } current_step_index() += ingredients.at(1).at(0)+1; - trace(Primitive_recipe_depth, "run") << "jumping to instruction " << current_step_index() << end(); + trace(9998, "run") << "jumping to instruction " << current_step_index() << end(); continue; // skip rest of this instruction } diff --git a/029tools.cc b/029tools.cc index fa1ae463..cb5eae0e 100644 --- a/029tools.cc +++ b/029tools.cc @@ -235,7 +235,7 @@ case _PRINT: { case _PRINT: { for (long long int i = 0; i < SIZE(ingredients); ++i) { if (is_literal(current_instruction().ingredients.at(i))) { - trace(Primitive_recipe_depth, "run") << "$print: " << current_instruction().ingredients.at(i).name << end(); + trace(9998, "run") << "$print: " << current_instruction().ingredients.at(i).name << end(); if (has_property(current_instruction().ingredients.at(i), "newline")) cout << '\n'; else @@ -243,7 +243,7 @@ case _PRINT: { } else { for (long long int j = 0; j < SIZE(ingredients.at(i)); ++j) { - trace(Primitive_recipe_depth, "run") << "$print: " << ingredients.at(i).at(j) << end(); + trace(9998, "run") << "$print: " << ingredients.at(i).at(j) << end(); if (j > 0) cout << " "; cout << no_scientific(ingredients.at(i).at(j)); } diff --git a/030container.cc b/030container.cc index 17e018f7..c7900b97 100644 --- a/030container.cc +++ b/030container.cc @@ -181,9 +181,9 @@ case GET: { // End GET field Cases src += size_of(Type[base_type].elements.at(i)); } - trace(Primitive_recipe_depth, "run") << "address to copy is " << src << end(); + trace(9998, "run") << "address to copy is " << src << end(); type_ordinal src_type = Type[base_type].elements.at(offset)->value; - trace(Primitive_recipe_depth, "run") << "its type is " << Type[src_type].name << end(); + trace(9998, "run") << "its type is " << Type[src_type].name << end(); reagent tmp; tmp.set_value(src); tmp.type = new type_tree(src_type); @@ -303,7 +303,7 @@ case GET_ADDRESS: { // End GET_ADDRESS field Cases result += size_of(Type[base_type].elements.at(i)); } - trace(Primitive_recipe_depth, "run") << "address to copy is " << result << end(); + trace(9998, "run") << "address to copy is " << result << end(); products.resize(1); products.at(0).push_back(result); break; diff --git a/031address.cc b/031address.cc index 27d7fb43..813f0464 100644 --- a/031address.cc +++ b/031address.cc @@ -55,7 +55,7 @@ void lookup_memory(reagent& x) { if (x.value == 0) { raise_error << maybe(current_recipe_name()) << "tried to /lookup 0\n" << end(); } - trace(Primitive_recipe_depth, "mem") << "location " << x.value << " is " << no_scientific(Memory[x.value]) << end(); + trace(9999, "mem") << "location " << x.value << " is " << no_scientific(Memory[x.value]) << end(); x.set_value(Memory[x.value]); drop_address_from_type(x); drop_one_lookup(x); diff --git a/032array.cc b/032array.cc index b9a8bc9a..38b333b5 100644 --- a/032array.cc +++ b/032array.cc @@ -184,8 +184,8 @@ case INDEX: { break; } long long int src = base_address + 1 + offset_val.at(0)*size_of(element_type); - trace(Primitive_recipe_depth, "run") << "address to copy is " << src << end(); - trace(Primitive_recipe_depth, "run") << "its type is " << Type[element_type->value].name << end(); + trace(9998, "run") << "address to copy is " << src << end(); + trace(9998, "run") << "its type is " << Type[element_type->value].name << end(); reagent tmp; tmp.set_value(src); tmp.type = new type_tree(*element_type); diff --git a/036call_reply.cc b/036call_reply.cc index 60261c7a..e43a704c 100644 --- a/036call_reply.cc +++ b/036call_reply.cc @@ -51,7 +51,7 @@ case REPLY: { // check that any reply ingredients with /same-as-ingredient connect up // the corresponding ingredient and product in the caller. for (long long int i = 0; i < SIZE(caller_instruction.products); ++i) { - trace(Primitive_recipe_depth, "run") << "result " << i << " is " << to_string(ingredients.at(i)) << end(); + trace(9998, "run") << "result " << i << " is " << to_string(ingredients.at(i)) << end(); if (has_property(reply_inst.ingredients.at(i), "same-as-ingredient")) { string_tree* tmp = property(reply_inst.ingredients.at(i), "same-as-ingredient"); if (!tmp || tmp->right) { diff --git a/039wait.cc b/039wait.cc index 081e28be..27412901 100644 --- a/039wait.cc +++ b/039wait.cc @@ -45,7 +45,7 @@ case WAIT_FOR_LOCATION: { Current_routine->state = WAITING; Current_routine->waiting_on_location = loc.value; Current_routine->old_value_of_waiting_location = Memory[loc.value]; - trace(Primitive_recipe_depth, "run") << "waiting for location " << loc.value << " to change from " << no_scientific(Memory[loc.value]) << end(); + trace(9998, "run") << "waiting for location " << loc.value << " to change from " << no_scientific(Memory[loc.value]) << end(); break; } @@ -113,7 +113,7 @@ case WAIT_FOR_ROUTINE: { } Current_routine->state = WAITING; Current_routine->waiting_on_routine = ingredients.at(0).at(0); - trace(Primitive_recipe_depth, "run") << "waiting for routine " << ingredients.at(0).at(0) << end(); + trace(9998, "run") << "waiting for routine " << ingredients.at(0).at(0) << end(); break; } diff --git a/043new.cc b/043new.cc index 05c64009..9c76adfb 100644 --- a/043new.cc +++ b/043new.cc @@ -22,7 +22,7 @@ long long int alloc, alloc_max; alloc = Memory_allocated_until; Memory_allocated_until += Initial_memory_per_routine; alloc_max = Memory_allocated_until; -trace(Primitive_recipe_depth, "new") << "routine allocated memory from " << alloc << " to " << alloc_max << end(); +trace(9999, "new") << "routine allocated memory from " << alloc << " to " << alloc_max << end(); //:: First handle 'type' operands. @@ -40,7 +40,7 @@ if (inst.operation == Recipe_ordinal["new"]) { if (Type_ordinal.find(inst.ingredients.at(0).name) == Type_ordinal.end()) raise_error << maybe(Recipe[r].name) << "unknown type " << inst.ingredients.at(0).name << '\n' << end(); inst.ingredients.at(0).set_value(Type_ordinal[inst.ingredients.at(0).name]); - trace(Primitive_recipe_depth, "new") << inst.ingredients.at(0).name << " -> " << inst.ingredients.at(0).name << end(); + trace(9999, "new") << inst.ingredients.at(0).name << " -> " << inst.ingredients.at(0).name << end(); end_new_transform:; } @@ -75,7 +75,7 @@ case NEW: { if (SIZE(current_instruction().ingredients) > 1) { // array array_length = ingredients.at(1).at(0); - trace(Primitive_recipe_depth, "mem") << "array size is " << array_length << end(); + trace(9999, "mem") << "array size is " << array_length << end(); size = array_length*size_of(type) + /*space for length*/1; } else { @@ -90,7 +90,7 @@ case NEW: { // really crappy at the moment ensure_space(size); const long long int result = Current_routine->alloc; - trace(Primitive_recipe_depth, "mem") << "new alloc: " << result << end(); + trace(9999, "mem") << "new alloc: " << result << end(); // save result products.resize(1); products.at(0).push_back(result); @@ -132,7 +132,7 @@ void ensure_space(long long int size) { Current_routine->alloc = Memory_allocated_until; Memory_allocated_until += Initial_memory_per_routine; Current_routine->alloc_max = Memory_allocated_until; - trace(Primitive_recipe_depth, "new") << "routine allocated memory from " << Current_routine->alloc << " to " << Current_routine->alloc_max << end(); + trace(9999, "new") << "routine allocated memory from " << Current_routine->alloc << " to " << Current_routine->alloc_max << end(); } } diff --git a/050scenario.cc b/050scenario.cc index f74abadc..31398ab8 100644 --- a/050scenario.cc +++ b/050scenario.cc @@ -283,7 +283,7 @@ void check_memory(const string& s) { double value = 0; in >> value; if (locations_checked.find(address) != locations_checked.end()) raise_error << "duplicate expectation for location " << address << '\n' << end(); - trace(Primitive_recipe_depth, "run") << "checking location " << address << end(); + trace(9999, "run") << "checking location " << address << end(); if (Memory[address] != value) { if (Current_scenario && !Scenario_testing_scenario) { // genuine test in a mu file @@ -323,7 +323,7 @@ void check_type(const string& lhs, istream& in) { } void check_string(long long int address, const string& literal) { - trace(Primitive_recipe_depth, "run") << "checking string length at " << address << end(); + trace(9999, "run") << "checking string length at " << address << end(); if (Memory[address] != SIZE(literal)) { if (Current_scenario && !Scenario_testing_scenario) raise_error << "\nF - " << Current_scenario->name << ": expected location " << address << " to contain length " << SIZE(literal) << " of string [" << literal << "] but saw " << no_scientific(Memory[address]) << '\n' << end(); @@ -337,7 +337,7 @@ void check_string(long long int address, const string& literal) { } ++address; // now skip length for (long long int i = 0; i < SIZE(literal); ++i) { - trace(Primitive_recipe_depth, "run") << "checking location " << address+i << end(); + trace(9999, "run") << "checking location " << address+i << end(); if (Memory[address+i] != literal.at(i)) { if (Current_scenario && !Scenario_testing_scenario) { // genuine test in a mu file diff --git a/999spaces.cc b/999spaces.cc index 5fe52b26..5b6ae7c8 100644 --- a/999spaces.cc +++ b/999spaces.cc @@ -27,8 +27,7 @@ assert(Next_recipe_ordinal == 1000); //: //: 0 - unused //: 1-100 - app-level trace statements in mu -//: 101-9998 - call-stack statements (mostly label run) +//: 101-9989 - call-stack statements (mostly label run) assert(Initial_callstack_depth == 101); -assert(Max_callstack_depth == 9998); -//: 9999 - intra-instruction lines (mostly label mem) -assert(Primitive_recipe_depth == 9999); +assert(Max_callstack_depth == 9989); +//: 9990-9999 - intra-instruction lines (mostly label mem) |