about summary refs log tree commit diff stats
path: root/082scenario_screen.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-01-20 20:47:54 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-01-20 20:47:54 -0800
commit263e6b2a9f35d977d8e2ca883432c6743a4b7711 (patch)
tree5a25feb442f38d5fd0588ac2e1058cf8749aee66 /082scenario_screen.cc
parentbd6134610c2ab2742f2fc4159b6e9a99e85d183f (diff)
downloadmu-263e6b2a9f35d977d8e2ca883432c6743a4b7711.tar.gz
2581 - make space for the refcount in address:shared
We don't yet actually maintain the refcount. That's next.

Hardest part of this was debugging the assume-console scenarios in layer
85. That took some detailed manual diffing of traces (because the output
of diff was no good).

New tracing added in this commit add 8% to .traces LoC. Commented out
trace() calls (used during debugging) make that 45%.
Diffstat (limited to '082scenario_screen.cc')
-rw-r--r--082scenario_screen.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/082scenario_screen.cc b/082scenario_screen.cc
index 362c73f1..89562f6a 100644
--- a/082scenario_screen.cc
+++ b/082scenario_screen.cc
@@ -207,18 +207,18 @@ struct raw_string_stream {
 :(code)
 void check_screen(const string& expected_contents, const int color) {
   assert(!current_call().default_space);  // not supported
-  long long int screen_location = get_or_insert(Memory, SCREEN);
+  long long int screen_location = get_or_insert(Memory, SCREEN)+/*skip refcount*/1;
   int data_offset = find_element_name(get(Type_ordinal, "screen"), "data", "");
   assert(data_offset >= 0);
   long long int screen_data_location = screen_location+data_offset;  // type: address:shared:array:character
-  long long int screen_data_start = get_or_insert(Memory, screen_data_location);  // type: array:character
+  long long int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1;  // type: array:character
   int width_offset = find_element_name(get(Type_ordinal, "screen"), "num-columns", "");
   long long int screen_width = get_or_insert(Memory, screen_location+width_offset);
   int height_offset = find_element_name(get(Type_ordinal, "screen"), "num-rows", "");
   long long int screen_height = get_or_insert(Memory, screen_location+height_offset);
   raw_string_stream cursor(expected_contents);
   // todo: too-long expected_contents should fail
-  long long int addr = screen_data_start+1;  // skip length
+  long long int addr = screen_data_start+/*skip length*/1;
   for (long long int row = 0; row < screen_height; ++row) {
     cursor.skip_whitespace_and_comments();
     if (cursor.at_end()) break;
@@ -342,7 +342,7 @@ case _DUMP_SCREEN: {
 :(code)
 void dump_screen() {
   assert(!current_call().default_space);  // not supported
-  long long int screen_location = get_or_insert(Memory, SCREEN);
+  long long int screen_location = get_or_insert(Memory, SCREEN) + /*skip refcount*/1;
   int width_offset = find_element_name(get(Type_ordinal, "screen"), "num-columns", "");
   long long int screen_width = get_or_insert(Memory, screen_location+width_offset);
   int height_offset = find_element_name(get(Type_ordinal, "screen"), "num-rows", "");
@@ -350,7 +350,7 @@ void dump_screen() {
   int data_offset = find_element_name(get(Type_ordinal, "screen"), "data", "");
   assert(data_offset >= 0);
   long long int screen_data_location = screen_location+data_offset;  // type: address:shared:array:character
-  long long int screen_data_start = get_or_insert(Memory, screen_data_location);  // type: array:character
+  long long int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1;  // type: array:character
   assert(get_or_insert(Memory, screen_data_start) == screen_width*screen_height);
   long long int curr = screen_data_start+1;  // skip length
   for (long long int row = 0; row < screen_height; ++row) {