about summary refs log tree commit diff stats
path: root/subx
Commit message (Collapse)AuthorAgeFilesLines
* 5456Kartik Agaram2019-07-221-0/+0
| | | | Fix CI.
* 5455Kartik Agaram2019-07-226-247/+130
| | | | | Clean up. All apps now translating correctly except for the phases of the self-hosted translator. Next step: SubX-in-SubX in SubX-in-SubX.
* 5454Kartik Agaram2019-07-228-1/+1
| | | | Bugfix fifteen -- on the C++ side.
* 5453Kartik Agaram2019-07-222-13/+107
| | | | All that debugging and it turns out the bug is on the C++ side!
* 5452Kartik Agaram2019-07-222-120/+161
| | | | | | | | | | | | | | Snapshot while debugging survey.subx by print. I can see the error in 1 minute with this command: subx run apps/survey < a.pack (where a.pack is obtained from `ntranslate 049*.subx 05[0-8]*.subx`) By contrast, using the trace requires 4.5 minutes: subx --trace run apps/survey < a.pack It generates a trace of 4.4GB with almost 83M lines. The trace takes 2 minutes to load.. oops, I forgot to load labels with `--debug`.
* 5451Kartik Agaram2019-07-222-1/+99
| | | | | | | | | | | | | | Even though the standard library is building and passing tests, the binaries it generates aren't exactly bit for bit identical with the originals. Comparing using `diff_ntranslate`, it looks like the data segment starting address isn't computed right in survey.subx (`compute-addresses`) when I start translating layer 058. Deleting some tests brings the code segment to a p_offset where bits 8-11 (the lowest 4 bits excluding the lowermost byte) are cleared and everything works. However, if bits 8-11 are set, then they don't make it to p_vaddr and p_paddr. Tried reproducing with a unit test, but the unit test passes fine.
* 5450Kartik Agaram2019-07-222-0/+12
| | | | A couple of scripts that help debug discrepancies in the self-hosted translator.
* 5449Kartik Agaram2019-07-221-1/+4
| | | | Stop rebuilding example programs just because subx_bin got recreated.
* 5448Kartik Agaram2019-07-222-6/+14
| | | | Make the output of the `pack` phase a little easier to read.
* 5447Kartik Agaram2019-07-221-4/+8
| | | | Fix a timeout in CI.
* 5446Kartik Agaram2019-07-221-4/+4
| | | | Really fix CI.
* 5445Kartik Agaram2019-07-221-23/+28
| | | | Fix CI.
* 5444Kartik Agaram2019-07-221-0/+0
|
* 5443 - standard library is now self-hostedKartik Agaram2019-07-228-5/+17
| | | | | | | Translates 5k lines of input in 26 seconds. I'm not sure why I need to grow the label table. It was already 512 entries long, and I'm only using 373 so far.
* 5442Kartik Agaram2019-07-228-2/+74
| | | | | | | | | We can now translate layers 49-72 using the self-hosted translator. The translator has now demonstrated translation over 4k lines. Most verbose phase output is 325KB, even if the final binary is 15KB. Emulation is too slow now, so I'm back to debug by print on a Linux machine.
* 5441Kartik Agaram2019-07-221-0/+24
| | | | | Now our debug cycle passes through `translate` or `ntranslate`. Make sure we rebuild phases whenever we need to.
* 5440Kartik Agaram2019-07-222-18/+18
| | | | Fix CI.
* 5439Kartik Agaram2019-07-211-9/+0
|
* 5438 - raise error on uppercase hexKartik Agaram2019-07-2112-7/+72
| | | | | | | | | | | | | | | | | | We can now translate layers 49-56 using the self-hosted translator (`translate` and `ntranslate`). As a follow-up to commit 5404, the self-hosted translator is a little more strict than the C++ translator in 3 places: a) All .subx files must define a data segment. b) All .subx files must define an `Entry` label. c) All numbers must be in *lowercase* hex. In all cases, where programs work with the C++ translator but violate the self-hosted translator's assumptions, we must make sure we raise errors rather than silently emit bad code.
* 5437Kartik Agaram2019-07-2113-13/+13
| | | | Break a dependency from `print-int32` to `from-hex-char`.
* 5436 - support newlines in dquotesKartik Agaram2019-07-214-8/+85
|
* 5435 - redo 5426Kartik Agaram2019-07-214-6/+99
| | | | | We can now translate layers 49-55 using translate and ntranslate. Next step is to support '\n' in dquotes.subx.
* 5434Kartik Agaram2019-07-216-2/+18
|
* 5433Kartik Agaram2019-07-216-2/+2
|
* 5432Kartik Agaram2019-07-211-0/+0
|
* 5431 - starting to translate std libKartik Agaram2019-07-201-0/+33
| | | | | | | | | | Currently failing at layer 54: ``` $ time ./translate 049memory_layout.subx 05[0-4]*.subx; ./subx run a.elf test leaky-get-or-insert-slice: too many segments ``` Emulation is also damn slow. But running in native mode is fast.
* 5430 - all examples passingKartik Agaram2019-07-206-41/+333
| | | | | We now have a new pass called 'tests' which code-generates a new function called 'run-tests', just like the C++ layer `tests.cc`.
* 5429Kartik Agaram2019-07-209-0/+0
| | | | Fix CI.
* 5428Kartik Agaram2019-07-201-10/+22
|
* 5427Kartik Agaram2019-07-202-18/+1
|
* 5426Kartik Agaram2019-07-208-19/+23
|
* 5425Kartik Agaram2019-07-202-0/+14
|
* 5424Kartik Agaram2019-07-191-12/+12
|
* 5423Kartik Agaram2019-07-191-1/+1
|
* 5422Kartik Agaram2019-07-196-12/+52
| | | | | Various buffer sizes needed to be grown for ex11. But the next bottleneck is that we need to code-generate run-tests.
* 5421Kartik Agaram2019-07-191-0/+24
|
* 5420Kartik Agaram2019-07-191-0/+29
|
* 5419Kartik Agaram2019-07-193-40/+552
| | | | | | | | | | | Bugfix fourteen: we need different address computation logic for code vs data labels. It's really about different categories of instructions having different address computation logic. This subtle distinction will make good error messages hard. But that's a problem for later. Now there's just one example program not translating.
* 5418 - vim tweaksKartik Agaram2019-07-191-1/+12
| | | | | When running a single test, stop always opening the trace. Instead create a separate affordance for that, and also have it reuse windows.
* 5417Kartik Agaram2019-07-183-9/+8
| | | | Clean up.
* 5416Kartik Agaram2019-07-183-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Figured out what's going in with bug fourteen: displacement operands aren't always used relative to the PC. Does this mean I need to track instruction boundaries past pack? :'( No, I just need different logic for labels in code vs data segments. This was an interesting bug for reminding me of the difference between the emulator-level trace and the application-level trace. The former has 1.5 million lines, while the latter has a dozen. Luckily, just dumping the latter immediately made obvious what the issue was. Though this experience does suggest some further ideas for debugging tools: slice trace by line and phase slice trace by start and end label debug UI for SubX translator 2D layout: rows = lines of code; columns = translator phases each 'cell' in this layout contains a list of log lines shows what came in, what was emitted easily collapse any cell These are domain-specific tools. Special-cased to the SubX translator phases.
* 5415Kartik Agaram2019-07-174-8/+56
| | | | | | | | Bugfix thirteen: displacement calculations were wrong because current offset was not being updated properly as words were being read and emitted. Now 10/12 example programs are translated correctly.
* 5414Kartik Agaram2019-07-171-4/+4
|
* 5413Kartik Agaram2019-07-173-6/+104
| | | | | | | Bugfix twelve: ModR/M was being incorrectly computed. This is one of two problems with subx/examples/ex3, so no new passing examples.
* 5412Kartik Agaram2019-07-171-3/+3
| | | | Fix CI.
* 5411Kartik Agaram2019-07-171-1/+1
| | | | Fix CI.
* 5410 - 4 examples passingKartik Agaram2019-07-1718-13/+72
| | | | | Clean up other examples as well to satisfy the requirements in commit 5404.
* 5409Kartik Agaram2019-07-173-4/+16
| | | | | Bugfix eleven: segment flags were incorrectly computed. examples/ex1 now verified! Added to CI.
* 5408Kartik Agaram2019-07-1613-64/+418
| | | | | | | | | | | | Bugfix ten: type error in `convert`. I was calling `rewind-stream` on a `buffered-file`. examples/ex1 is now just one nibble off the canonical. I *have* found one missing feature in the self-hosted translator, though: dquotes doesn't support newlines in strings, even though the C++ version does. dquotes parses them right, but the value initialized in the data segment is wrong.
* 5407Kartik Agaram2019-07-152-0/+7
| | | | | | | Bugfix nine: flush(out) after translation is done. Still one remaining bug from comparing ELF binaries: emit-segments prints nothing for some reason.
094 ^
60e03094 ^
a21ab6d4 ^
60e03094 ^

419f37fe ^

60e03094 ^

419f37fe ^
81190251 ^
60e03094 ^


60e03094 ^
e048b319 ^


e048b319 ^

419f37fe ^

e048b319 ^

81190251 ^
e048b319 ^
e048b319 ^
4eac5c0d ^
d1d80fc2 ^

d1d80fc2 ^

419f37fe ^

880d5c62 ^
d1d80fc2 ^
81190251 ^
d1d80fc2 ^
d1d80fc2 ^


























4eac5c0d ^

4eac5c0d ^

6af10696 ^
6640a089 ^
4eac5c0d ^
419f37fe ^





4eac5c0d ^
419f37fe ^
4eac5c0d ^
81190251 ^
4eac5c0d ^
4eac5c0d ^
6e58d954 ^

























18e0884f ^

18e0884f ^
18e0884f ^
419f37fe ^



18e0884f ^
81190251 ^
18e0884f ^
18e0884f ^

82ad0cd3 ^


82ad0cd3 ^
82ad0cd3 ^


419f37fe ^




82ad0cd3 ^
81190251 ^
82ad0cd3 ^


82ad0cd3 ^

a25714b6 ^

4afec6ab ^
4afec6ab ^
2215a379 ^

4afec6ab ^
419f37fe ^
419f37fe ^

4afec6ab ^
81190251 ^
4afec6ab ^
81190251 ^
4afec6ab ^

a25714b6 ^














b4b46399 ^

b4b46399 ^
e00a03f9 ^
2215a379 ^

e00a03f9 ^


b4722632 ^

b4b46399 ^
419f37fe ^
fb0e0659 ^
419f37fe ^
b4b46399 ^
81190251 ^
b4b46399 ^
81190251 ^
b4b46399 ^

037ca818 ^



037ca818 ^
6097a5ba ^
037ca818 ^

e00a03f9 ^
2215a379 ^

e00a03f9 ^



b4722632 ^

6097a5ba ^
419f37fe ^
419f37fe ^
e00a03f9 ^
419f37fe ^


037ca818 ^
81190251 ^
037ca818 ^


037ca818 ^

1f78d5b5 ^


1f78d5b5 ^
2215a379 ^

1f78d5b5 ^
419f37fe ^
419f37fe ^

1f78d5b5 ^
81190251 ^
1f78d5b5 ^
1f78d5b5 ^
















d25245a2 ^

fb0e0659 ^
d25245a2 ^
d25245a2 ^
419f37fe ^
fb0e0659 ^
e00a03f9 ^





b4722632 ^

419f37fe ^

d25245a2 ^
81190251 ^
d25245a2 ^
d25245a2 ^

da058359 ^

fb0e0659 ^
da058359 ^
da058359 ^
419f37fe ^
419f37fe ^

e00a03f9 ^





b4722632 ^

fb0e0659 ^
419f37fe ^
da058359 ^
81190251 ^
da058359 ^
da058359 ^

c0037608 ^




c0037608 ^
e00a03f9 ^
2215a379 ^

e00a03f9 ^



b4722632 ^

6097a5ba ^
419f37fe ^
419f37fe ^

c0037608 ^
e45afd5c ^

c0037608 ^
81190251 ^
c0037608 ^
c0037608 ^

62953362 ^


62953362 ^



81190251 ^
62953362 ^
62953362 ^

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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479