From e4ac3c9e6e5464a0fc0f8fd3763a572e0e180c04 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 1 Dec 2018 14:13:33 -0800 Subject: 4814 --- html/035lookup.cc.html | 69 ++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 33 deletions(-) (limited to 'html/035lookup.cc.html') diff --git a/html/035lookup.cc.html b/html/035lookup.cc.html index 97957855..cd8f9007 100644 --- a/html/035lookup.cc.html +++ b/html/035lookup.cc.html @@ -11,23 +11,25 @@ @@ -62,6 +64,7 @@ if ('onhashchange' in window) { +https://github.com/akkartik/mu/blob/master/035lookup.cc
   1 //: Go from an address to the payload it points at using /lookup.
   2 //:
@@ -136,14 +139,14 @@ if ('onhashchange' in window) {
  71 }
  72 
  73 void lookup_memory(reagent& x) {
- 74   if (!x.type || x.type->atom || x.type->left->value != Address_type_ordinal) {
- 75     raise << maybe(current_recipe_name()) << "tried to lookup '" << x.original_string << "' but it isn't an address\n" << end();
+ 74   if (!x.type || x.type->atom || x.type->left->value != Address_type_ordinal) {
+ 75     raise << maybe(current_recipe_name()) << "tried to lookup '" << x.original_string << "' but it isn't an address\n" << end();
  76     dump_callstack();
  77     return;
  78   }
  79   // compute value
  80   if (x.value == 0) {
- 81     raise << maybe(current_recipe_name()) << "tried to lookup 0\n" << end();
+ 81     raise << maybe(current_recipe_name()) << "tried to lookup 0\n" << end();
  82     dump_callstack();
  83     return;
  84   }
@@ -152,24 +155,24 @@ if ('onhashchange' in window) {
  87 
  88 void lookup_memory_core(reagent& x, bool check_for_null) {
  89   double address = x.value + /*skip alloc id in address*/1;
- 90   double new_value = get_or_insert(Memory, address);
+ 90   double new_value = get_or_insert(Memory, address);
  91   trace("mem") << "location " << address << " contains " << no_scientific(new_value) << end();
  92   // check for null
  93   if (check_for_null && new_value == 0) {
- 94     if (Current_routine) {
- 95       raise << maybe(current_recipe_name()) << "tried to lookup 0 in '" << to_original_string(current_instruction()) << "'\n" << end();
+ 94     if (Current_routine) {
+ 95       raise << maybe(current_recipe_name()) << "tried to lookup 0 in '" << to_original_string(current_instruction()) << "'\n" << end();
  96       dump_callstack();
  97     }
  98     else {
- 99       raise << "tried to lookup 0\n" << end();
+ 99       raise << "tried to lookup 0\n" << end();
 100     }
 101   }
 102   // validate alloc-id
-103   double alloc_id_in_address = get_or_insert(Memory, x.value);
-104   double alloc_id_in_payload = get_or_insert(Memory, new_value);
+103   double alloc_id_in_address = get_or_insert(Memory, x.value);
+104   double alloc_id_in_payload = get_or_insert(Memory, new_value);
 105 //?   cerr << x.value << ": " << alloc_id_in_address << " vs " << new_value << ": " << alloc_id_in_payload << '\n';
 106   if (alloc_id_in_address != alloc_id_in_payload) {
-107       raise << maybe(current_recipe_name()) << "address is already abandoned in '" << to_original_string(current_instruction()) << "'\n" << end();
+107       raise << maybe(current_recipe_name()) << "address is already abandoned in '" << to_original_string(current_instruction()) << "'\n" << end();
 108       dump_callstack();
 109   }
 110   // all well; complete the lookup
@@ -215,7 +218,7 @@ if ('onhashchange' in window) {
 150 :(code)
 151 bool canonize_type(reagent& r) {
 152   while (has_property(r, "lookup")) {
-153     if (!r.type || r.type->atom || !r.type->left || !r.type->left->atom || r.type->left->value != Address_type_ordinal) {
+153     if (!r.type || r.type->atom || !r.type->left || !r.type->left->atom || r.type->left->value != Address_type_ordinal) {
 154       raise << "cannot perform lookup on '" << r.name << "' because it has non-address type " << to_string(r.type) << '\n' << end();
 155       return false;
 156     }
@@ -317,7 +320,7 @@ if ('onhashchange' in window) {
 252 reagent/*copy*/ i = inst.ingredients.at(0);
 253 if (!canonize_type(i)) break;  // error raised elsewhere
 254 if (!types_strictly_match(p, i)) {
-255   raise << maybe(get(Recipe, r).name) << "product of 'put' must be first ingredient '" << inst.ingredients.at(0).original_string << "', but got '" << inst.products.at(0).original_string << "'\n" << end();
+255   raise << maybe(get(Recipe, r).name) << "product of 'put' must be first ingredient '" << inst.ingredients.at(0).original_string << "', but got '" << inst.products.at(0).original_string << "'\n" << end();
 256   break;
 257 }
 258 
@@ -432,7 +435,7 @@ if ('onhashchange' in window) {
 367 reagent/*copy*/ i = inst.ingredients.at(0);
 368 if (!canonize_type(i)) break;  // error raised elsewhere
 369 if (!types_strictly_match(p, i)) {
-370   raise << maybe(get(Recipe, r).name) << "product of 'put-index' must be first ingredient '" << inst.ingredients.at(0).original_string << "', but got '" << inst.products.at(0).original_string << "'\n" << end();
+370   raise << maybe(get(Recipe, r).name) << "product of 'put-index' must be first ingredient '" << inst.ingredients.at(0).original_string << "', but got '" << inst.products.at(0).original_string << "'\n" << end();
 371   break;
 372 }
 373 
@@ -561,7 +564,7 @@ if ('onhashchange' in window) {
 496     properties.push_back(pair<string, string_tree*>("lookup", NULL));
 497   }
 498   if (name.empty())
-499     raise << "illegal name '" << original_string << "'\n" << end();
+499     raise << "illegal name '" << original_string << "'\n" << end();
 500 }
 501 
 502 //:: helpers for debugging
@@ -569,33 +572,33 @@ if ('onhashchange' in window) {
 504 :(before "End Primitive Recipe Declarations")
 505 _DUMP,
 506 :(before "End Primitive Recipe Numbers")
-507 put(Recipe_ordinal, "$dump", _DUMP);
+507 put(Recipe_ordinal, "$dump", _DUMP);
 508 :(before "End Primitive Recipe Implementations")
 509 case _DUMP: {
 510   reagent/*copy*/ after_canonize = current_instruction().ingredients.at(0);
 511   canonize(after_canonize);
-512   cerr << maybe(current_recipe_name()) << current_instruction().ingredients.at(0).name << ' ' << no_scientific(current_instruction().ingredients.at(0).value) << " => " << no_scientific(after_canonize.value) << " => " << no_scientific(get_or_insert(Memory, after_canonize.value)) << '\n';
+512   cerr << maybe(current_recipe_name()) << current_instruction().ingredients.at(0).name << ' ' << no_scientific(current_instruction().ingredients.at(0).value) << " => " << no_scientific(after_canonize.value) << " => " << no_scientific(get_or_insert(Memory, after_canonize.value)) << '\n';
 513   break;
 514 }
 515 
 516 //: grab an address, and then dump its value at intervals
 517 //: useful for tracking down memory corruption (writing to an out-of-bounds address)
 518 :(before "End Globals")
-519 int Bar = -1;
+519 int Bar = -1;
 520 :(before "End Primitive Recipe Declarations")
 521 _BAR,
 522 :(before "End Primitive Recipe Numbers")
-523 put(Recipe_ordinal, "$bar", _BAR);
+523 put(Recipe_ordinal, "$bar", _BAR);
 524 :(before "End Primitive Recipe Implementations")
 525 case _BAR: {
 526   if (current_instruction().ingredients.empty()) {
-527     if (Bar != -1) cerr << Bar << ": " << no_scientific(get_or_insert(Memory, Bar)) << '\n';
+527     if (Bar != -1) cerr << Bar << ": " << no_scientific(get_or_insert(Memory, Bar)) << '\n';
 528     else cerr << '\n';
 529   }
 530   else {
 531     reagent/*copy*/ tmp = current_instruction().ingredients.at(0);
 532     canonize(tmp);
-533     Bar = tmp.value;
+533     Bar = tmp.value;
 534   }
 535   break;
 536 }
-- 
cgit 1.4.1-2-gfad0

k/mu/blame/027call_ingredient.cc?h=main&id=5203ba0c5e806ac8e118362d5e2db952a5433e34'>^
75aa3a98 ^
0487a30e ^
75aa3a98 ^
2d29369f ^
0487a30e ^
4be9a93b ^
69f04c3f ^

717ab659 ^
5f98a10c ^

1ead3562 ^
3e849f11 ^

1ead3562 ^
192d59d3 ^
3e849f11 ^
192d59d3 ^
3e849f11 ^
88be3dbc ^
1ead3562 ^
bc643692 ^
717ab659 ^
1ead3562 ^
192d59d3 ^
d52406cc ^
717ab659 ^
d52406cc ^
717ab659 ^








795f5244 ^
166e3c0d ^



717ab659 ^

67573caf ^
717ab659 ^


88be3dbc ^
1ead3562 ^
bc643692 ^
717ab659 ^
1ead3562 ^
192d59d3 ^
d52406cc ^
717ab659 ^






795f5244 ^
166e3c0d ^
717ab659 ^
166e3c0d ^
8d72e565 ^
e4630643 ^

5f98a10c ^
9dcbec39 ^
e4630643 ^

166e3c0d ^



b24eb476 ^
67573caf ^
0487a30e ^
67573caf ^
ac0e9db5 ^
827898fc ^
67573caf ^
717ab659 ^

ac0e9db5 ^
0487a30e ^

827898fc ^
717ab659 ^



c9a5a7ba ^
78c50205 ^
c9a5a7ba ^
78c50205 ^

c9a5a7ba ^
af023b32 ^







93d4cc93 ^


c9a5a7ba ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188