Commit Graph

5485 Commits

Author SHA1 Message Date
Kartik Agaram 6e1eeeebfb 5485 - promote SubX to top-level 2019-07-27 17:47:59 -07:00
Kartik Agaram 8846a7f85c 5484 2019-07-26 12:21:43 -07:00
Kartik Agaram 16fa6d17a9 5483 2019-07-26 12:16:02 -07:00
Kartik Agaram e355c69310 5482
Other phrasings considered:
  - "tractably automate arbitrary manual tests"
  - "make it possible to automate arbitrary manual tests"

Thanks Paul Biggar for the feedback.
2019-07-26 12:05:03 -07:00
Kartik Agaram 8acdca4858 5481 2019-07-26 11:31:21 -07:00
Kartik Agaram 18b0f13ecc 5480 2019-07-26 11:26:11 -07:00
Kartik Agaram 0c7f08cea0 5479 2019-07-25 22:55:21 -07:00
Kartik Agaram 68ccf4d324 5478 - disallow programs without 'data' segments
Now all known discrepancies between C++ and SubX translators are fixed.
If a SubX program builds with C++, it should also build fine with just
SubX.

(If it doesn't build with C++, all bets are off. The self-hosted SubX
translator has negligible error-detection or handling.)
2019-07-25 17:15:20 -07:00
Kartik Agaram 6dff1f28b4 5477 2019-07-25 17:13:28 -07:00
Kartik Agaram ecbdc925d4 5476
Fix CI. Also kill compiler version mismatch bugs once and for all.
2019-07-25 13:59:17 -07:00
Kartik Agaram 34e1828162 5475 - disallow programs using uppercase hex
This makes the C++ translator more consistent with the self-hosted
translator.
2019-07-25 11:57:02 -07:00
Kartik Agaram 08b2b92fd2 5474 2019-07-25 11:44:25 -07:00
Kartik Agaram b6d51014e7 5473 2019-07-25 11:19:56 -07:00
Kartik Agaram ef52bbf908 5472 - disallow programs without `Entry` labels
This makes the C++ translator more consistent with the self-hosted
translator.

We go through some contortions to continue supporting unit tests without
'Entry' labels. But we still want to throw good errors when translating
.subx files at the commandline.
2019-07-25 10:40:27 -07:00
Kartik Agaram 8bc6896724 5471
Purge all traces of the old assumption that segment 0 is code and
segment 1 is data.
2019-07-25 09:50:18 -07:00
Kartik Agaram dd92b23f53 5470 2019-07-25 09:42:20 -07:00
Kartik Agaram c8c2a66cd7 5469 2019-07-25 02:54:22 -07:00
Kartik Agaram 695f9bf8d0 5468 2019-07-25 00:10:56 -07:00
Kartik Agaram 51a20da6b3 5467
Fix CI by disabling non-native runs that run out of memory.
2019-07-24 18:37:42 -07:00
Kartik Agaram dccb5c6656 5466 - demo self-hosting in Readme 2019-07-24 17:05:22 -07:00
Kartik Agaram 29ec821cf7 5465
Include phases of self-hosted SubX translator in CI.
2019-07-24 16:54:18 -07:00
Kartik Agaram 04a5722edc 5464
Include simple apps in CI.
2019-07-24 16:44:24 -07:00
Kartik Agaram 6315936b64 5463 2019-07-24 14:32:44 -07:00
Kartik Agaram 070cac028c 5462 - What's next for Mu? Look here. 2019-07-24 01:17:46 -07:00
Kartik Agaram eea61cc12c 5461 - SubX is now self-hosting!
All extant SubX programs generate identical binaries using either the
C++ or the self-hosted SubX translators.
2019-07-24 00:25:03 -07:00
Kartik Agaram f04fdc8e57 5460
A little more resizing of buffers. apps/hex.subx is now building an
identical binary.

I'm now aborting on allocation failures. That requires disabling
a couple of tests. (I'm not quite confident enough of this decision to
delete them outright.) I want to treat all segfaults as bugs, and
machine code is no place to add boilerplate checks for return values of
standard library functions.
2019-07-24 00:18:21 -07:00
Kartik Agaram 43e6c3787d 5459 2019-07-23 08:35:02 -07:00
Kartik Agaram 70a0776031 5458
Ensure we don't create overly long lines. Now this works:

  $ ./diff_ntranslate 0*.subx apps/subx-common.subx
2019-07-22 23:54:15 -07:00
Kartik Agaram 9a12e45376 5457 2019-07-22 23:54:06 -07:00
Kartik Agaram 9f3175e090 5456
Fix CI.
2019-07-22 23:06:09 -07:00
Kartik Agaram 954fddc652 5455
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.
2019-07-22 21:31:02 -07:00
Kartik Agaram 4e8f5fa43b 5454
Bugfix fifteen -- on the C++ side.
2019-07-22 20:04:14 -07:00
Kartik Agaram c4ccc215cf 5453
All that debugging and it turns out the bug is on the C++ side!
2019-07-22 19:57:10 -07:00
Kartik Agaram 8c19b906e3 5452
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`.
2019-07-22 19:32:44 -07:00
Kartik Agaram 7397dc2ad3 5451
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.
2019-07-22 18:07:51 -07:00
Kartik Agaram 372ec29367 5450
A couple of scripts that help debug discrepancies in the self-hosted translator.
2019-07-22 17:40:10 -07:00
Kartik Agaram 4dc5dfa56f 5449
Stop rebuilding example programs just because subx_bin got recreated.
2019-07-22 17:36:28 -07:00
Kartik Agaram d353ec6097 5448
Make the output of the `pack` phase a little easier to read.
2019-07-22 17:34:30 -07:00
Kartik Agaram 075bdd9a40 5447
Fix a timeout in CI.
2019-07-22 09:55:54 -07:00
Kartik Agaram 75f2c1239d 5446
Really fix CI.
2019-07-22 08:09:33 -07:00
Kartik Agaram 133e8bcf26 5445
Fix CI.
2019-07-22 01:39:14 -07:00
Kartik Agaram 1421e4cf3e 5444 2019-07-22 01:37:48 -07:00
Kartik Agaram 37cf4e0581 5443 - standard library is now self-hosted
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.
2019-07-22 01:25:33 -07:00
Kartik Agaram f2d6349070 5442
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.
2019-07-22 01:12:45 -07:00
Kartik Agaram 490cc2021c 5441
Now our debug cycle passes through `translate` or `ntranslate`. Make
sure we rebuild phases whenever we need to.
2019-07-22 00:41:40 -07:00
Kartik Agaram e968d7733a 5440
Fix CI.
2019-07-22 00:26:14 -07:00
Kartik Agaram 9a7eaeb9fc 5439 2019-07-21 23:45:54 -07:00
Kartik Agaram 0d219f0a73 5438 - raise error on uppercase hex
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.
2019-07-21 23:29:38 -07:00
Kartik Agaram ac8a9396b9 5437
Break a dependency from `print-int32` to `from-hex-char`.
2019-07-21 22:23:20 -07:00
Kartik Agaram 8a1a3fb45f 5436 - support newlines in dquotes 2019-07-21 01:41:53 -07:00