about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-22 11:51:36 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-22 11:51:36 -0800
commit7136ddd5ac12d3aa4d516f719dea37a027a25b5a (patch)
treec11e4ba47269076b39a96905b9d03b0765f639c4
parentaff93bb2c1ea1a96fc110fad8b2dd84e0673f87f (diff)
downloadmu-7136ddd5ac12d3aa4d516f719dea37a027a25b5a.tar.gz
2473 - bad idea to use /raw with multiple intentions
/raw is to express absolute addresses
/unsafe is to sidestep type-checking in test setup
-rw-r--r--021check_instruction.cc10
-rw-r--r--030container.cc2
-rw-r--r--031address.cc8
-rw-r--r--032array.cc12
-rw-r--r--042name.cc4
-rw-r--r--044space.cc16
-rw-r--r--045space_surround.cc4
-rw-r--r--047global.cc4
-rw-r--r--056recipe_header.cc2
-rw-r--r--091run_interactive.cc2
10 files changed, 34 insertions, 30 deletions
diff --git a/021check_instruction.cc b/021check_instruction.cc
index 57757446..3d418dce 100644
--- a/021check_instruction.cc
+++ b/021check_instruction.cc
@@ -78,9 +78,9 @@ recipe main [
 bool types_match(reagent lhs, reagent rhs) {
   // '_' never raises type error
   if (is_dummy(lhs)) return true;
-  // to sidestep type-checking, use /raw in the source.
-  // this is unsafe, and will be highlighted in red inside vim. just for some tests.
-  if (is_raw(rhs)) return true;
+  // to sidestep type-checking, use /unsafe in the source.
+  // this will be highlighted in red inside vim. just for setting up some tests.
+  if (is_unsafe(rhs)) return true;
   if (is_literal(rhs)) return valid_type_for_literal(lhs, rhs) && size_of(rhs) == size_of(lhs);
   if (!lhs.type) return !rhs.type;
   return types_match(lhs.type, rhs.type);
@@ -125,6 +125,10 @@ bool is_raw(const reagent& r) {
   return has_property(r, "raw");
 }
 
+bool is_unsafe(const reagent& r) {
+  return has_property(r, "unsafe");
+}
+
 bool is_mu_array(reagent r) {
   if (!r.type) return false;
   if (is_literal(r)) return false;
diff --git a/030container.cc b/030container.cc
index 49655db5..346f0eed 100644
--- a/030container.cc
+++ b/030container.cc
@@ -516,7 +516,7 @@ recipe main [
 :(scenario run_allows_type_definition_after_use)
 % Hide_errors = true;
 recipe main [
-  1:bar <- copy 0/raw
+  1:bar <- copy 0/unsafe
 ]
 
 container bar [
diff --git a/031address.cc b/031address.cc
index ebbc4e95..4d012ad5 100644
--- a/031address.cc
+++ b/031address.cc
@@ -3,7 +3,7 @@
 
 :(scenario copy_indirect)
 recipe main [
-  1:address:number <- copy 2/raw
+  1:address:number <- copy 2/unsafe
   2:number <- copy 34
   # This loads location 1 as an address and looks up *that* location.
   3:number <- copy 1:address:number/lookup
@@ -17,7 +17,7 @@ canonize(x);
 //: 'lookup' property
 :(scenario store_indirect)
 recipe main [
-  1:address:number <- copy 2/raw
+  1:address:number <- copy 2/unsafe
   1:address:number/lookup <- copy 34
 ]
 +mem: storing 34 in location 2
@@ -126,7 +126,7 @@ recipe main [
   1:number <- copy 2
   2:number <- copy 34
   3:number <- copy 35
-  4:address:number <- copy 5/raw
+  4:address:number <- copy 5/unsafe
   *4:address:number <- get 1:address:point/lookup, 0:offset
 ]
 +mem: storing 34 in location 5
@@ -168,7 +168,7 @@ canonize(base);
 
 :(scenario lookup_abbreviation)
 recipe main [
-  1:address:number <- copy 2/raw
+  1:address:number <- copy 2/unsafe
   2:number <- copy 34
   3:number <- copy *1:address:number
 ]
diff --git a/032array.cc b/032array.cc
index ac883490..81bfbe18 100644
--- a/032array.cc
+++ b/032array.cc
@@ -85,7 +85,7 @@ recipe main [
   2:number <- copy 14
   3:number <- copy 15
   4:number <- copy 16
-  5:address:array:number <- copy 1/raw
+  5:address:array:number <- copy 1/unsafe
   6:array:number <- copy *5:address:array:number
 ]
 +mem: storing 3 in location 6
@@ -204,7 +204,7 @@ recipe main [
   2:number <- copy 14
   3:number <- copy 15
   4:number <- copy 16
-  5:address:array:number <- copy 1/raw
+  5:address:array:number <- copy 1/unsafe
   6:number <- index *5:address:array:number, 1
 ]
 +mem: storing 15 in location 6
@@ -234,7 +234,7 @@ recipe main [
   5:number <- copy 14
   6:number <- copy 15
   7:number <- copy 16
-  8:address:array:point <- copy 1/raw
+  8:address:array:point <- copy 1/unsafe
   index *8:address:array:point, -1
 ]
 +error: main: invalid index -1
@@ -249,7 +249,7 @@ recipe main [
   5:number <- copy 14
   6:number <- copy 15
   7:number <- copy 16
-  8:address:array:point <- copy 1/raw
+  8:address:array:point <- copy 1/unsafe
   9:number <- index *8:address:array:point, 0
 ]
 +error: main: 'index' on *8:address:array:point can't be saved in 9:number; type should be point
@@ -354,7 +354,7 @@ recipe main [
   5:number <- copy 14
   6:number <- copy 15
   7:number <- copy 16
-  8:address:array:point <- copy 1/raw
+  8:address:array:point <- copy 1/unsafe
   index-address *8:address:array:point, -1
 ]
 +error: main: invalid index -1
@@ -369,7 +369,7 @@ recipe main [
   5:number <- copy 14
   6:number <- copy 15
   7:number <- copy 16
-  8:address:array:point <- copy 1/raw
+  8:address:array:point <- copy 1/unsafe
   9:address:number <- index-address *8:address:array:point, 0
 ]
 +error: main: 'index' on *8:address:array:point can't be saved in 9:address:number; type should be <address : <point : <>>>
diff --git a/042name.cc b/042name.cc
index e9812624..8ef2f467 100644
--- a/042name.cc
+++ b/042name.cc
@@ -215,8 +215,8 @@ if (inst.name == "get" || inst.name == "get-address") {
 :(scenarios transform)
 :(scenario transform_names_handles_containers)
 recipe main [
-  a:point <- copy 0/raw
-  b:number <- copy 0/raw
+  a:point <- copy 0/unsafe
+  b:number <- copy 0/unsafe
 ]
 +name: assign a 1
 +name: assign b 3
diff --git a/044space.cc b/044space.cc
index 0031536d..4f57ebd5 100644
--- a/044space.cc
+++ b/044space.cc
@@ -7,7 +7,7 @@
 # then location 0 is really location 11, location 1 is really location 12, and so on.
 recipe main [
   10:number <- copy 5  # pretend array; in practice we'll use new
-  default-space:address:array:location <- copy 10/raw
+  default-space:address:array:location <- copy 10/unsafe
   1:number <- copy 23
 ]
 +mem: storing 23 in location 12
@@ -19,8 +19,8 @@ recipe main [
   # pretend array
   1000:number <- copy 5
   # actual start of this recipe
-  default-space:address:array:location <- copy 1000/raw
-  1:address:number <- copy 3/raw
+  default-space:address:array:location <- copy 1000/unsafe
+  1:address:number <- copy 3/unsafe
   8:number/raw <- copy *1:address:number
 ]
 +mem: storing 34 in location 8
@@ -70,8 +70,8 @@ recipe main [
   # pretend array
   1000:number <- copy 5
   # actual start of this recipe
-  default-space:address:array:location <- copy 1000/raw
-  1:address:point <- copy 12/raw
+  default-space:address:array:location <- copy 1000/unsafe
+  1:address:point <- copy 12/unsafe
   9:number/raw <- get *1:address:point, 1:offset
 ]
 +mem: storing 35 in location 9
@@ -90,8 +90,8 @@ recipe main [
   # pretend array
   1000:number <- copy 5
   # actual start of this recipe
-  default-space:address:array:location <- copy 1000/raw
-  1:address:array:number <- copy 12/raw
+  default-space:address:array:location <- copy 1000/unsafe
+  1:address:array:number <- copy 12/unsafe
   9:number/raw <- index *1:address:array:number, 1
 ]
 +mem: storing 35 in location 9
@@ -224,7 +224,7 @@ long long int address(long long int offset, long long int base) {
 
 :(scenario get_default_space)
 recipe main [
-  default-space:address:array:location <- copy 10/raw
+  default-space:address:array:location <- copy 10/unsafe
   1:address:array:location/raw <- copy default-space:address:array:location
 ]
 +mem: storing 10 in location 1
diff --git a/045space_surround.cc b/045space_surround.cc
index b55cbf5c..821066cc 100644
--- a/045space_surround.cc
+++ b/045space_surround.cc
@@ -9,8 +9,8 @@
 recipe main [
   10:number <- copy 5  # pretend array
   20:number <- copy 5  # pretend array
-  default-space:address:array:location <- copy 10/raw
-  0:address:array:location/names:dummy <- copy 20/raw  # later layers will explain the /names: property
+  default-space:address:array:location <- copy 10/unsafe
+  0:address:array:location/names:dummy <- copy 20/unsafe  # later layers will explain the /names: property
   1:number <- copy 32
   1:number/space:1 <- copy 33
 ]
diff --git a/047global.cc b/047global.cc
index c0e09ce4..bd433af7 100644
--- a/047global.cc
+++ b/047global.cc
@@ -9,8 +9,8 @@ recipe main [
   10:number <- copy 5
   20:number <- copy 5
   # actual start of this recipe
-  global-space:address:array:location <- copy 20/raw
-  default-space:address:array:location <- copy 10/raw
+  global-space:address:array:location <- copy 20/unsafe
+  default-space:address:array:location <- copy 10/unsafe
   1:number <- copy 23
   1:number/space:global <- copy 24
 ]
diff --git a/056recipe_header.cc b/056recipe_header.cc
index e918074d..78850c43 100644
--- a/056recipe_header.cc
+++ b/056recipe_header.cc
@@ -128,7 +128,7 @@ if (curr.name == "load-ingredients") {
 recipe add2 x:number, y:number -> z:number [
   local-scope
   load-ingredients
-  z:address:number <- copy 0/raw
+  z:address:number <- copy 0/unsafe
   reply z
 ]
 +error: add2: replied with the wrong type at 'reply z'
diff --git a/091run_interactive.cc b/091run_interactive.cc
index ec9e13d7..55fb92fe 100644
--- a/091run_interactive.cc
+++ b/091run_interactive.cc
@@ -12,7 +12,7 @@ recipe main [
 
 :(scenario run_interactive_empty)
 recipe main [
-  1:address:array:character <- copy 0/raw
+  1:address:array:character <- copy 0/unsafe
   2:address:array:character <- run-interactive 1:address:array:character
 ]
 # result is null
u/blame/011load.cc?h=hlt&id=1f7e3c056ce0ea71e1337579b24e8fd1ad26abac'>^
50e0065e ^
df40cb6e ^
1b76245c ^
df40cb6e ^
c4e143d6 ^
2caaa7f1 ^


795f5244 ^
b2ec0969 ^
a0b9fa55 ^
1b76245c ^
795f5244 ^
14274372 ^
70f70118 ^
50e0065e ^
8f0a9149 ^
795f5244 ^
14274372 ^

70f70118 ^
f5dfb7f7 ^
3c93ddcb ^
66b97b4d ^
9dcbec39 ^
3c93ddcb ^
36594a43 ^

8d72e565 ^
70f70118 ^
9f95c745 ^
8d72e565 ^
36594a43 ^




0a2026a6 ^
08cf048f ^
66abe7c1 ^
0a2026a6 ^

36594a43 ^

08cf048f ^
1f7e3c05 ^
08cf048f ^
66abe7c1 ^
0a2026a6 ^

0a2026a6 ^
66abe7c1 ^




36594a43 ^
1f7e3c05 ^
36594a43 ^
0a2026a6 ^
c4e143d6 ^
781f2462 ^
781f2462 ^
d3c120c1 ^
36594a43 ^
05d17773 ^
b2ec0969 ^
08cf048f ^
66abe7c1 ^
0a2026a6 ^


36594a43 ^



6c96a437 ^
36594a43 ^
36594a43 ^


35064671 ^
1b76245c ^
35064671 ^

95f2fe96 ^
49620728 ^
36594a43 ^
6c96a437 ^
36594a43 ^
36594a43 ^
b2ec0969 ^
5683823a ^
6c96a437 ^
9f95c745 ^
6c96a437 ^
9f95c745 ^
08cf048f ^
1b76245c ^
0a2026a6 ^

95f2fe96 ^
0a2026a6 ^
36594a43 ^

7d07cd1d ^
36594a43 ^
3c93ddcb ^
8619c618 ^

36594a43 ^
1f7e3c05 ^
d7314554 ^





d3c120c1 ^
07c594eb ^
4b424bb2 ^
d3c120c1 ^

d7314554 ^


36594a43 ^

5f05e954 ^
536a22c1 ^
5f05e954 ^
536a22c1 ^
36594a43 ^

08cf048f ^
36594a43 ^




536a22c1 ^
36594a43 ^






a316f1e4 ^

08cf048f ^
a316f1e4 ^
1f7e3c05 ^
a316f1e4 ^

7232de70 ^
36594a43 ^

3c93ddcb ^











100157d1 ^
08cf048f ^
100157d1 ^
08cf048f ^
100157d1 ^


d63cddea ^







100157d1 ^
518e6c5e ^
1ead3562 ^

518e6c5e ^
1ead3562 ^
bc643692 ^
100157d1 ^
35457609 ^
acc4792d ^

100157d1 ^

1ead3562 ^
100157d1 ^
bc643692 ^
100157d1 ^
35457609 ^
acc4792d ^

100157d1 ^
051c4738 ^
1ead3562 ^
100157d1 ^
bc643692 ^
100157d1 ^

35457609 ^
acc4792d ^

100157d1 ^
051c4738 ^
1ead3562 ^
bc643692 ^
100157d1 ^
bc643692 ^
100157d1 ^
35457609 ^
acc4792d ^

35457609 ^
acc4792d ^

100157d1 ^

1ead3562 ^
bc643692 ^
100157d1 ^
35457609 ^
acc4792d ^

100157d1 ^
96ac511e ^
1ead3562 ^
3a787ca7 ^
96ac511e ^
3a787ca7 ^
96ac511e ^
72c4fb2d ^
1ead3562 ^
72c4fb2d ^



a4ef18b1 ^
1ead3562 ^
bc643692 ^
a4ef18b1 ^
35457609 ^
acc4792d ^

a4ef18b1 ^
96ac511e ^
1ead3562 ^
bc643692 ^
96ac511e ^
35457609 ^
acc4792d ^


96ac511e ^

1ead3562 ^
bc643692 ^
96ac511e ^
35457609 ^
acc4792d ^



f02842a9 ^

1ead3562 ^
bc643692 ^
f02842a9 ^
35457609 ^
acc4792d ^



0060093e ^

1ead3562 ^
8a3d101e ^
0060093e ^
acc4792d ^
076f39b8 ^



076f39b8 ^





14274372 ^
faf521d9 ^






ee6a21ce ^




ec99eb7a ^
ee6a21ce ^






a0b9fa55 ^
5ed9bb13 ^
1ead3562 ^
14274372 ^

1ead3562 ^
14274372 ^

5ed9bb13 ^
14274372 ^
a0b9fa55 ^
1ead3562 ^
14274372 ^

1ead3562 ^
14274372 ^

5ed9bb13 ^

ee6a21ce ^










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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414