From 2c678a4e1d7f97c862342ee19cf2d6ee6e901d85 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 29 May 2017 14:21:32 -0700 Subject: 3897 - various updates to documentation --- html/073wait.cc.html | 64 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'html/073wait.cc.html') diff --git a/html/073wait.cc.html b/html/073wait.cc.html index a9aa6847..8046c996 100644 --- a/html/073wait.cc.html +++ b/html/073wait.cc.html @@ -110,14 +110,14 @@ if ('onhashchange' in window) { 45 raise << "some routines died with errors\n" << end(); 46 :(code) 47 bool any_routines_waiting() { - 48 for (int i = 0; i < SIZE(Routines); ++i) { + 48 for (int i = 0; i < SIZE(Routines); ++i) { 49 ¦ if (Routines.at(i)->state == WAITING) 50 ¦ ¦ return true; 51 } 52 return false; 53 } 54 void dump_waiting_routines() { - 55 for (int i = 0; i < SIZE(Routines); ++i) { + 55 for (int i = 0; i < SIZE(Routines); ++i) { 56 ¦ if (Routines.at(i)->state == WAITING) 57 ¦ ¦ cerr << i << ": " << routine_label(Routines.at(i)) << '\n'; 58 } @@ -139,10 +139,10 @@ if ('onhashchange' in window) { 74 :(before "End Primitive Recipe Declarations") 75 WAIT_FOR_RESET_THEN_SET, 76 :(before "End Primitive Recipe Numbers") - 77 put(Recipe_ordinal, "wait-for-reset-then-set", WAIT_FOR_RESET_THEN_SET); + 77 put(Recipe_ordinal, "wait-for-reset-then-set", WAIT_FOR_RESET_THEN_SET); 78 :(before "End Primitive Recipe Checks") 79 case WAIT_FOR_RESET_THEN_SET: { - 80 if (SIZE(inst.ingredients) != 1) { + 80 if (SIZE(inst.ingredients) != 1) { 81 ¦ raise << maybe(get(Recipe, r).name) << "'wait-for-reset-then-set' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); 82 ¦ break; 83 } @@ -154,10 +154,10 @@ if ('onhashchange' in window) { 89 :(before "End Primitive Recipe Implementations") 90 case WAIT_FOR_RESET_THEN_SET: { 91 int loc = static_cast<int>(ingredients.at(0).at(0)); - 92 trace(9998, "run") << "wait: *" << loc << " = " << get_or_insert(Memory, loc) << end(); - 93 if (get_or_insert(Memory, loc) == 0) { + 92 trace(9998, "run") << "wait: *" << loc << " = " << get_or_insert(Memory, loc) << end(); + 93 if (get_or_insert(Memory, loc) == 0) { 94 ¦ trace(9998, "run") << "location " << loc << " is already 0; setting" << end(); - 95 ¦ put(Memory, loc, 1); + 95 ¦ put(Memory, loc, 1); 96 ¦ break; 97 } 98 trace(9998, "run") << "waiting for location " << loc << " to reset" << end(); @@ -170,10 +170,10 @@ if ('onhashchange' in window) { 105 :(before "End Primitive Recipe Declarations") 106 RESET, 107 :(before "End Primitive Recipe Numbers") -108 put(Recipe_ordinal, "reset", RESET); +108 put(Recipe_ordinal, "reset", RESET); 109 :(before "End Primitive Recipe Checks") 110 case RESET: { -111 if (SIZE(inst.ingredients) != 1) { +111 if (SIZE(inst.ingredients) != 1) { 112 ¦ raise << maybe(get(Recipe, r).name) << "'reset' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); 113 ¦ break; 114 } @@ -185,20 +185,20 @@ if ('onhashchange' in window) { 120 :(before "End Primitive Recipe Implementations") 121 case RESET: { 122 int loc = static_cast<int>(ingredients.at(0).at(0)); -123 put(Memory, loc, 0); -124 trace(9998, "run") << "reset: *" << loc << " = " << get_or_insert(Memory, loc) << end(); +123 put(Memory, loc, 0); +124 trace(9998, "run") << "reset: *" << loc << " = " << get_or_insert(Memory, loc) << end(); 125 break; 126 } 127 128 //: scheduler tweak to get routines out of that state 129 130 :(before "End Scheduler State Transitions") -131 for (int i = 0; i < SIZE(Routines); ++i) { +131 for (int i = 0; i < SIZE(Routines); ++i) { 132 if (Routines.at(i)->state != WAITING) continue; 133 int loc = Routines.at(i)->waiting_on_location; -134 if (loc && get_or_insert(Memory, loc) == 0) { +134 if (loc && get_or_insert(Memory, loc) == 0) { 135 ¦ trace(9999, "schedule") << "waking up routine " << Routines.at(i)->id << end(); -136 ¦ put(Memory, loc, 1); +136 ¦ put(Memory, loc, 1); 137 ¦ Routines.at(i)->state = RUNNING; 138 ¦ Routines.at(i)->waiting_on_location = 0; 139 } @@ -219,10 +219,10 @@ if ('onhashchange' in window) { 154 :(before "End Primitive Recipe Declarations") 155 GET_LOCATION, 156 :(before "End Primitive Recipe Numbers") -157 put(Recipe_ordinal, "get-location", GET_LOCATION); +157 put(Recipe_ordinal, "get-location", GET_LOCATION); 158 :(before "End Primitive Recipe Checks") 159 case GET_LOCATION: { -160 if (SIZE(inst.ingredients) != 2) { +160 if (SIZE(inst.ingredients) != 2) { 161 ¦ raise << maybe(get(Recipe, r).name) << "'get-location' expects exactly 2 ingredients in '" << to_original_string(inst) << "'\n" << end(); 162 ¦ break; 163 } @@ -247,7 +247,7 @@ if ('onhashchange' in window) { 182 //: later layers will permit non-integer offsets 183 if (is_integer(offset.name)) { 184 ¦ offset_value = to_integer(offset.name); -185 ¦ if (offset_value < 0 || offset_value >= SIZE(get(Type, base_type).elements)) { +185 ¦ if (offset_value < 0 || offset_value >= SIZE(get(Type, base_type).elements)) { 186 ¦ ¦ raise << maybe(get(Recipe, r).name) << "invalid offset " << offset_value << " for '" << get(Type, base_type).name << "'\n" << end(); 187 ¦ ¦ break; 188 ¦ } @@ -273,7 +273,7 @@ if ('onhashchange' in window) { 208 } 209 const type_tree* base_type = get_base_type(base.type); 210 int offset = ingredients.at(1).at(0); -211 if (offset < 0 || offset >= SIZE(get(Type, base_type->value).elements)) break; // copied from Check above +211 if (offset < 0 || offset >= SIZE(get(Type, base_type->value).elements)) break; // copied from Check above 212 int result = base_address; 213 for (int i = 0; i < offset; ++i) 214 ¦ result += size_of(element_type(base.type, i)); @@ -386,10 +386,10 @@ if ('onhashchange' in window) { 321 :(before "End Primitive Recipe Declarations") 322 WAIT_FOR_ROUTINE, 323 :(before "End Primitive Recipe Numbers") -324 put(Recipe_ordinal, "wait-for-routine", WAIT_FOR_ROUTINE); +324 put(Recipe_ordinal, "wait-for-routine", WAIT_FOR_ROUTINE); 325 :(before "End Primitive Recipe Checks") 326 case WAIT_FOR_ROUTINE: { -327 if (SIZE(inst.ingredients) != 1) { +327 if (SIZE(inst.ingredients) != 1) { 328 ¦ raise << maybe(get(Recipe, r).name) << "'wait-for-routine' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); 329 ¦ break; 330 } @@ -415,13 +415,13 @@ if ('onhashchange' in window) { 350 // Wake up any routines waiting for other routines to complete. 351 // Important: this must come after the scheduler loop above giving routines 352 // waiting for locations to change a chance to wake up. -353 for (int i = 0; i < SIZE(Routines); ++i) { +353 for (int i = 0; i < SIZE(Routines); ++i) { 354 if (Routines.at(i)->state != WAITING) continue; 355 routine* waiter = Routines.at(i); 356 if (!waiter->waiting_on_routine) continue; 357 int id = waiter->waiting_on_routine; 358 assert(id != waiter->id); // routine can't wait on itself -359 for (int j = 0; j < SIZE(Routines); ++j) { +359 for (int j = 0; j < SIZE(Routines); ++j) { 360 ¦ const routine* waitee = Routines.at(j); 361 ¦ if (waitee->id == id && waitee->state != RUNNING && waitee->state != WAITING) { 362 ¦ ¦ // routine is COMPLETED or DISCONTINUED @@ -437,7 +437,7 @@ if ('onhashchange' in window) { 372 :(before "End Primitive Recipe Declarations") 373 SWITCH, 374 :(before "End Primitive Recipe Numbers") -375 put(Recipe_ordinal, "switch", SWITCH); +375 put(Recipe_ordinal, "switch", SWITCH); 376 :(before "End Primitive Recipe Checks") 377 case SWITCH: { 378 break; @@ -485,7 +485,7 @@ if ('onhashchange' in window) { 420 :(before "End Primitive Recipe Declarations") 421 CURRENT_ROUTINE_IS_BLOCKED, 422 :(before "End Primitive Recipe Numbers") -423 put(Recipe_ordinal, "current-routine-is-blocked", CURRENT_ROUTINE_IS_BLOCKED); +423 put(Recipe_ordinal, "current-routine-is-blocked", CURRENT_ROUTINE_IS_BLOCKED); 424 :(before "End Primitive Recipe Checks") 425 case CURRENT_ROUTINE_IS_BLOCKED: { 426 if (!inst.ingredients.empty()) { @@ -503,7 +503,7 @@ if ('onhashchange' in window) { 438 :(before "End Primitive Recipe Declarations") 439 CURRENT_ROUTINE_IS_UNBLOCKED, 440 :(before "End Primitive Recipe Numbers") -441 put(Recipe_ordinal, "current-routine-is-unblocked", CURRENT_ROUTINE_IS_UNBLOCKED); +441 put(Recipe_ordinal, "current-routine-is-unblocked", CURRENT_ROUTINE_IS_UNBLOCKED); 442 :(before "End Primitive Recipe Checks") 443 case CURRENT_ROUTINE_IS_UNBLOCKED: { 444 if (!inst.ingredients.empty()) { @@ -548,10 +548,10 @@ if ('onhashchange' in window) { 483 :(before "End Primitive Recipe Declarations") 484 WAIT_FOR_ROUTINE_TO_BLOCK, 485 :(before "End Primitive Recipe Numbers") -486 put(Recipe_ordinal, "wait-for-routine-to-block", WAIT_FOR_ROUTINE_TO_BLOCK); +486 put(Recipe_ordinal, "wait-for-routine-to-block", WAIT_FOR_ROUTINE_TO_BLOCK); 487 :(before "End Primitive Recipe Checks") 488 case WAIT_FOR_ROUTINE_TO_BLOCK: { -489 if (SIZE(inst.ingredients) != 1) { +489 if (SIZE(inst.ingredients) != 1) { 490 ¦ raise << maybe(get(Recipe, r).name) << "'wait-for-routine-to-block' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); 491 ¦ break; 492 } @@ -575,13 +575,13 @@ if ('onhashchange' in window) { 510 511 :(before "End Scheduler State Transitions") 512 // Wake up any routines waiting for other routines to stop running. -513 for (int i = 0; i < SIZE(Routines); ++i) { +513 for (int i = 0; i < SIZE(Routines); ++i) { 514 if (Routines.at(i)->state != WAITING) continue; 515 routine* waiter = Routines.at(i); 516 if (!waiter->waiting_on_routine_to_block) continue; 517 int id = waiter->waiting_on_routine_to_block; 518 assert(id != waiter->id); // routine can't wait on itself -519 for (int j = 0; j < SIZE(Routines); ++j) { +519 for (int j = 0; j < SIZE(Routines); ++j) { 520 ¦ const routine* waitee = Routines.at(j); 521 ¦ if (waitee->id != id) continue; 522 ¦ if (waitee->state != RUNNING || waitee->blocked) { @@ -597,10 +597,10 @@ if ('onhashchange' in window) { 532 :(before "End Primitive Recipe Declarations") 533 RESTART, 534 :(before "End Primitive Recipe Numbers") -535 put(Recipe_ordinal, "restart", RESTART); +535 put(Recipe_ordinal, "restart", RESTART); 536 :(before "End Primitive Recipe Checks") 537 case RESTART: { -538 if (SIZE(inst.ingredients) != 1) { +538 if (SIZE(inst.ingredients) != 1) { 539 ¦ raise << maybe(get(Recipe, r).name) << "'restart' requires exactly one ingredient, but got '" << to_original_string(inst) << "'\n" << end(); 540 ¦ break; 541 } @@ -613,7 +613,7 @@ if ('onhashchange' in window) { 548 :(before "End Primitive Recipe Implementations") 549 case RESTART: { 550 int id = ingredients.at(0).at(0); -551 for (int i = 0; i < SIZE(Routines); ++i) { +551 for (int i = 0; i < SIZE(Routines); ++i) { 552 ¦ if (Routines.at(i)->id == id) { 553 ¦ ¦ if (Routines.at(i)->state == WAITING) 554 ¦ ¦ ¦ Routines.at(i)->state = RUNNING; -- cgit 1.4.1-2-gfad0