about summary refs log tree commit diff stats
path: root/033exclusive_container.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-05-28 14:28:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-05-28 23:00:47 -0700
commit5987486862b8c989452bc62d359168a5686b462e (patch)
tree4b8aa541eb7bbf614619d49723ddea6198163689 /033exclusive_container.cc
parentec7c8c8b7434f498098c6b3417bb9c47d5b12881 (diff)
downloadmu-5987486862b8c989452bc62d359168a5686b462e.tar.gz
3887 - clean up early exits in interpreter loop
It's always confusing when `break` refers to a `switch` but `continue`
refers to the loop around the `switch`. But we've done ugly things like
this and `goto` for expedience. However, we're starting to run into cases
where we now need to insert code at every `continue` or `continue`-mimicking
`goto` inside the core interpreter loop. Better to make the loop single-entry-single-exit.
Common things to run after every instruction will now happen inside the
`finish_instruction` function rather than at the `finish_instruction` label.
Diffstat (limited to '033exclusive_container.cc')
-rw-r--r--033exclusive_container.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/033exclusive_container.cc b/033exclusive_container.cc
index eee16643..86dc1c8a 100644
--- a/033exclusive_container.cc
+++ b/033exclusive_container.cc
@@ -160,6 +160,7 @@ case MAYBE_CONVERT: {
   reagent/*copy*/ status = current_instruction().products.at(1);
   // Update MAYBE_CONVERT status in Run
   // optimization: directly write results to only update first product when necessary
+  write_products = false;
   if (tag == static_cast<int>(get_or_insert(Memory, base_address))) {
     const reagent& variant = variant_type(base, tag);
     trace(9999, "mem") << "storing 1 in location " << status.value << end();
@@ -177,7 +178,7 @@ case MAYBE_CONVERT: {
     trace(9999, "mem") << "storing 0 in location " << status.value << end();
     put(Memory, status.value, 0);
   }
-  goto finish_instruction;
+  break;
 }
 
 :(code)