Commit Graph

4875 Commits

Author SHA1 Message Date
Kartik Agaram 2eb174d697 4908
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.
2019-01-05 01:07:37 -08:00
Kartik Agaram aa96ac23a6 4907 2019-01-04 21:59:27 -08:00
Kartik Agaram bc20cc3d45 4906 - helper to allocate streams on the heap 2019-01-04 15:37:16 -08:00
Kartik Agaram 7b548ff5c5 4905 - safe ptr lookup is now 6 instructions
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.
2019-01-04 11:29:12 -08:00
Kartik Agaram 8413cd9c9d 4904 2019-01-04 00:06:21 -08:00
Kartik Agaram e3118458b0 4903 2019-01-03 23:54:54 -08:00
Kartik Agaram 0ee4ff8193 4902 - initial sketch, stage 2 of compiler
I've agonized over this for a week; high time I saved a snapshot.
2019-01-03 23:51:52 -08:00
Kartik Agaram 634b162a98 4901 2019-01-03 17:02:17 -08:00
Kartik Agaram 1ffb27a045 4900
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.
2018-12-30 21:01:35 -08:00
Kartik Agaram 901ae47430 4899
Bug in my linkify tool introduced in commit 4891.
2018-12-30 20:24:37 -08:00
Kartik Agaram 0474ec865a 4898 2018-12-30 12:58:21 -08:00
Kartik Agaram 5a68894ca1 4897 2018-12-30 12:54:35 -08:00
Kartik Agaram cde1bf97b6 4896
Fix CI.
2018-12-30 12:08:09 -08:00
Kartik Agaram ebd3552150 4895 2018-12-30 01:42:06 -08:00
Kartik Agaram 395b3ffbeb 4894
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.
2018-12-30 01:30:56 -08:00
Kartik Agaram 76590e79bb 4893 2018-12-30 00:36:07 -08:00
Kartik Agaram e0ffdcd1a6 4892 2018-12-30 00:16:32 -08:00
Kartik Agaram 08a0eed699 4891
Couple more tweaks to html rendering:
a) SubX definitions no longer link redundantly to themselves. This long-standing
issue turns out to be tractable to solve for SubX files since the syntax
is so simple.
b) Fix links to SubX definitions in other directories. I forgot that I
have to always generate tags from the directory of the file being linkified.
c) Fix link colors. Before we lost all syntax highlighting for functions
and Globals. Now they maintain their colors, just add an underline.
2018-12-30 00:02:42 -08:00
Kartik Agaram ac07e589b3 4890 - new html renderings
a) Switch to a light background.
b) Linkify calls in .subx files.
c) Keep all colorization in the Vim colorscheme, get rid of hacky special-cases
   in update_html.
2018-12-29 15:27:18 -08:00
Kartik Agaram c164f4fb6b 4889 - playing with kinda-safe pointers 2018-12-29 14:32:27 -08:00
Kartik Agaram dd9ba09a7c 4888
We only can't use rm32=5 when mod=0. Totally fine when it's mod=1.
2018-12-29 13:36:06 -08:00
Kartik Agaram d762282438 4887 2018-12-29 13:21:20 -08:00
Kartik Agaram 431627b242 4886 2018-12-28 21:26:42 -08:00
Kartik Agaram c2532c2d10 4885
Make dots a little more salient on a light-background Vim.
2018-12-28 21:08:17 -08:00
Kartik Agaram 32af4a33bb 4884 2018-12-28 21:04:15 -08:00
Kartik Agaram 6a7eaa81ee 4883 - rudimentary memory allocator 2018-12-28 11:14:29 -08:00
Kartik Agaram 51bf3554b7 4882 2018-12-28 10:43:00 -08:00
Kartik Agaram 5a9795bb66 4881 2018-12-28 08:56:21 -08:00
Kartik Agaram e0610e396f 4880 2018-12-28 02:18:16 -08:00
Kartik Agaram 044b413021 4879 2018-12-28 02:07:11 -08:00
Kartik Agaram efc3c64b0d 4878 2018-12-27 23:44:03 -08:00
Kartik Agaram f842ab98de 4877 2018-12-27 23:38:38 -08:00
Kartik Agaram 58abd047ec 4876 2018-12-27 23:17:34 -08:00
Kartik Agaram 5beb25b508 4875
Another tweak for a light background.
2018-12-25 23:02:16 -08:00
Kartik Agaram fb7cd3f16c 4874 2018-12-25 23:01:26 -08:00
Kartik Agaram 17b8233f44 4873 2018-12-20 16:37:10 -08:00
Kartik Agaram f9b08fb7c1 4872 - ctags definitions for SubX
Symlink or append exuberant_ctags_rc to your ~/.ctagsrc.
2018-12-17 21:16:31 -08:00
Kartik Agaram 8490f17dec 4871
Experimenting with a light background colorscheme.
2018-12-17 00:47:25 -08:00
Kartik Agaram 0d7afdf7b4 4870
Don't treat this as a section comment:

  e8/call foo  # -1 is negative
2018-12-17 00:46:37 -08:00
Kartik Agaram cdfff1a18d 4869 2018-12-16 20:52:47 -08:00
Kartik Agaram 011a634cc6 4868 2018-12-16 20:52:41 -08:00
Kartik Agaram 50a6c04860 4867 2018-12-15 00:12:48 -08:00
Kartik Agaram afa6e18b1b 4866 2018-12-10 23:38:14 -08:00
Kartik Agaram 3d4fba4d12 4865
More mnemonic register usage in write-stream.
2018-12-10 09:55:46 -08:00
Kartik Agaram 3a4d870730 4864
Our first buffer overflow!
2018-12-10 00:17:47 -08:00
Kartik Agaram dd08c9e69b 4863 2018-12-10 00:14:49 -08:00
Kartik Agaram f9ec61327a 4862 2018-12-09 23:37:34 -08:00
Kartik Agaram 5262ed0de3 4861 2018-12-09 22:46:39 -08:00
Kartik Agaram 42a933078c 4860 - stage 1 of SubX compiler in SubX is done!
I'm imagining 3 core stages total:
  1. convert text hex bytes -> binary (✓)
  2. pack and reorder operands
  3. compute label addresses

(Not including extras like error-checking.)
2018-12-09 21:18:05 -08:00
Kartik Agaram c91d67a29b 4859 2018-12-09 21:08:06 -08:00