| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
| |
Standardize name for 'end of file' sentinel. `eof` seems like an ordinary
variable, and `EOF` looks too much like a register (particularly in code
like `if (EAX == EOF)`), so we'll go with `Eof`. Consistent capitalization
for globals, and constants are globals too.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Considering how much trouble a merge phase would be (commit 4978), it seems
simpler to just add the extra syntax for controlling the entry point of
the generated ELF binary.
But I wouldn't have noticed this if I hadn't taken the time to write out
the commit messages of 4976 and 4978.
Even if we happened to already have linked list primitives built, this
may still be a good idea considering that I'm saving quite a lot of code
in duplicated entrypoints.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Phase 1: coalesce different instances/fragments for each segment, correctly
prepending later fragments.
Phase 2: pack bitfields into bytes.
Phase 3: compute addresses for labels, compute the ELF header.
Phase 4: convert hex bytes to binary.
But ugh, phase 1 involves linked lists and I'll have to go down a rabbit
hole building up more standard library functions.
|
|
|
|
|
|
| |
So far I've been assuming that I'd just statelessly convert each line in
a .subx file. But over the past week or so of constant interruptions I
gradually realized that code and data need different parsers.
|
|
|
|
|
| |
Support immediate operands in the data segment in all the ways we support
them in the code segment.
|
| |
|
| |
|
|
|
|
| |
Standardize how we show register allocation decisions.
|
| |
|
| |
|
|
|
|
|
| |
I think I don't need to special-case packing for different segments. That
should massively cut down on the number of tests.
|
| |
|
|
|
|
| |
Starting to build up Phase 2 (apps/pack) out of recently designed primitives.
|
| |
|
| |
|
|
|
|
| |
Cleaner way to compare streams in tests.
|
| |
|
|
|
|
|
| |
This seems like the final helper we need for Phase 2. Now to build the
business logic itself.
|
|
|
|
|
|
|
|
| |
Bugfix: has-metadata? was corrupting registers
Seems uneconomic to write tests for stuff like this. Assembly is just not
the right layer to try to come up with a general solution or process. Keep
running your code and wait to find signs of breakage.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Clean up primitives for converting from/to hex chars.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
We want slice-equal? for length-prefixed strings, not null-terminated "kernel"
strings.
|
| |
|
|
|
|
|
| |
In the process of building slice primitives I found an out-of-bounds access
in write-byte.
|
|
|
|
|
|
| |
In the process of building next-token I finally added some support for a
debugging situation I've found myself in a couple of times: wondering "what
changed this memory location"?
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Fix CI.
a) Update canonical binaries.
b) Fix an out-of-bounds access in `clear-stream`. This also required supporting
a new instruction in `subx run` to load an imm8 into rm8.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The lines within '{}' can now be turned into a macro like `E_X = deref(E_X)`,
parameterizing the register being modified.
Assumes the input is in a register but also saved elsewhere, so it's safe
to clobber and replace with the result.
Compare commit 4894. Used to take 9 instructions, 8 of them making loads/stores.
Now it's 6 instructions, 4 of them loads/stores (the one non-local load
is unchanged, of course). Key is to not consume more registers so we don't
have to push/pop them.
|
| |
|
|
|
|
| |
I've agonized over this for a week; high time I saved a snapshot.
|
|
|
|
|
|
|
|
|
|
|
| |
Finally really fix the CI failure of commit 4894.
This is a remainder to forget my knowledge of stack addresses in the SubX
VM when writing SubX programs. Otherwise my programs will work in the VM
but not natively. The only assumptions a SubX program should make about
its segment addresses are what's encoded in the ELF binary. Thanks to
https://en.wikipedia.org/wiki/Address_space_layout_randomization, it can't
know anything else.
|
|
|
|
| |
Fix CI.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Done with kinda-safe pointers.
In a real compiler the fast path of 'lookup' would ideally get inlined.
Excluding procedure-call overhead, the current implementation consumes 2
registers besides the input, and requires 9 instructions (2 push, 2 load,
compare, jump, increment, 2 pop). That's large enough that inlining may
become a trade-off. Even if we somehow magically had the registers already
loaded and available, we'd still need 4 instructions (1 pointer dereference,
compare, jump and increment). The price of safety.
|
| |
|