about summary refs log tree commit diff stats
path: root/038scheduler.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-07 10:40:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-07 12:47:13 -0700
commit8833d01ccf23a9348572d1cd3c34342b4ae2e6e3 (patch)
tree2b4e70fd7a1f324886ae45a982eb28b30e051f16 /038scheduler.cc
parent1179f0d456004bf0a7edd92fc083047ac8992801 (diff)
downloadmu-8833d01ccf23a9348572d1cd3c34342b4ae2e6e3.tar.gz
1296 - roll back 1295
Diffstat (limited to '038scheduler.cc')
-rw-r--r--038scheduler.cc34
1 files changed, 3 insertions, 31 deletions
diff --git a/038scheduler.cc b/038scheduler.cc
index 63d30f75..bc04d91c 100644
--- a/038scheduler.cc
+++ b/038scheduler.cc
@@ -50,7 +50,7 @@ void run(recipe_number r) {
 //?     cout << "scheduler: " << Current_routine_index << '\n'; //? 1
     assert(Current_routine);
     assert(Current_routine->state == RUNNING);
-    trace("schedule") << "switching to " << Current_routine->id << ": " << current_recipe_name();
+    trace("schedule") << current_recipe_name();
     run_current_routine(Scheduling_interval);
     if (Current_routine->completed())
       Current_routine->state = COMPLETED;
@@ -231,39 +231,11 @@ Recipe_number["routine-state"] = ROUTINE_STATE;
 :(before "End Primitive Recipe Implementations")
 case ROUTINE_STATE: {
   vector<long long int> result;
-  assert(!current_instruction().ingredients.empty());
-  assert(!read_memory(current_instruction().ingredients[0]).empty());
-  index_t target_id = read_memory(current_instruction().ingredients[0])[0];
-  cout << "routine-state: looking for " << target_id << '\n';
-  index_t target_index = 0;
-  for (index_t target_index = 0; target_index < Routines.size(); ++target_index) {
-    cout << "routine: " << Routines[target_index]->id << '\n';
-    if (Routines[target_index]->id == target_id) break;
-  }
-  if (target_index < Routines.size()) {
-    cout << "routine-state: " << Routines[target_index]->id << ": " << Routines[target_index]->state << '\n';
-    cout << "dest: " << current_instruction().products[0].to_string() << '\n';
-    cout << "before: " << Memory[current_instruction().products[0].value] << '\n';
-    result.push_back(Routines[target_index]->state);
-  }
-  else {
-    result.push_back(-1);
-  }
-  write_memory(current_instruction().products[0], result);
-  cout << "after: " << Memory[current_instruction().products[0].value] << '\n';
-  break;
-}
-
-:(before "End Primitive Recipe Declarations")
-RESTART,
-:(before "End Primitive Recipe Numbers")
-Recipe_number["restart"] = RESTART;
-:(before "End Primitive Recipe Implementations")
-case RESTART: {
   index_t id = read_memory(current_instruction().ingredients[0])[0];
   for (index_t i = 0; i < Routines.size(); ++i) {
     if (Routines[i]->id == id) {
-      Routines[i]->state = RUNNING;
+      result.push_back(Routines[i]->state);
+      write_memory(current_instruction().products[0], result);
       break;
     }
   }