Commit Graph

13 Commits

Author SHA1 Message Date
Kartik Agaram
bd57b37fc5 7173
All tests passing again.
2020-11-03 21:31:48 -08:00
Kartik Agaram
4cbe0ba1ac 7138 - type-check array 'length' instruction 2020-10-29 00:03:19 -07:00
Kartik Agaram
e8ffaf29ce 6719 - error-checking for 'index' instructions
1000+ LoC spent; just 300+ excluding tests.

Still one known gap; we don't check the entirety of an array's element
type if it's a compound. So far we just check if say both sides start with
'addr'. Obviously that's not good enough.
2020-08-21 21:32:48 -07:00
Kartik Agaram
5a6d2d0db7 6528 2020-06-15 16:57:39 -07:00
Kartik Agaram
36c2d2eadd 6526 2020-06-15 15:23:50 -07:00
Kartik Agaram
06b6e9d813 6382 - re-enable mu.subx in CI
I thought I'd done this in the previous commit, but I hadn't. And, what's
more, there was a bug that seemed pretty tough for a time. Turns out my
self-hosted translator doesn't support '.' comment tokens in data segments.

Hopefully I'm past the valley of the shadow of death now.

      "I HAVE NO TOOLS BECAUSE I’VE DESTROYED MY TOOLS WITH MY TOOLS."
      -- James Mickens (https://www.usenix.org/system/files/1311_05-08_mickens.pdf)
2020-05-22 22:50:39 -07:00
Kartik Agaram
d55144949b increase some buffer sizes
We can now natively translate mu.subx again.
2020-05-22 16:42:59 -07:00
Kartik Agaram
3cf0315859 6094 - new 'compute-offset' instruction
If indexing into a type with power-of-2-sized elements we can access them
in one instruction:

  x/reg1: (addr int) <- index A/reg2: (addr array int), idx/reg3: int

This translates to a single instruction because x86 instructions support
an addressing mode with left-shifts.

For non-powers-of-2, however, we need a multiply. To keep things type-safe,
it is performed like this:

  x/reg1: (offset T) <- compute-offset A: (addr array T), idx: int
  y/reg2: (addr T) <- index A, x

An offset is just an int that is guaranteed to be a multiple of size-of(T).
Offsets can only be used in index instructions, and the types will eventually
be required to line up.

In the process, I have to expand Input-size because mu.subx is growing
big.
2020-03-07 17:40:45 -08:00
Kartik Agaram
17c46e0b8c 6064
Fix CI.
2020-02-27 21:28:02 -08:00
Kartik Agaram
6c059c7ef3 5999
Fix CI. apps/survey was running out of space in the trace segment when
translating apps/mu.subx
2020-02-09 18:38:55 -08:00
Kartik Agaram
cfdd5b8bf3 5933
Expand some buffer sizes to continue building mu.subx natively.
2020-01-27 02:35:35 -08:00
Kartik Agaram
70187b1c01 5765
A couple more primitives now working. In the process I ran into an issue
with some buffer filling up when running ntranslate. Isolating it to survey.subx
was straightforward, but --trace ran out of RAM, and --trace --dump ran
out of (7GB of) disk. In the end what helped was just repeatedly inserting
exits at different points, and I realized there was a magic number that
hadn't been turned into a named constant.
2019-11-26 22:11:23 -08:00
Kartik Agaram
fd91f7f61b 5675 - move helpers from subx-common into layers
This undoes 5672 in favor of a new plan:

Layers 000 - 099 are for running without syntax sugar. We use them for
building syntax-sugar passes.

Layers 100 and up are for running with all syntax sugar.

The layers are arranged in approximate order so more phases rely on earlier
layers than later ones.

I plan to not use intermediate syntax sugar (just sigils without calls,
or sigils and calls without braces) anywhere except in the specific passes
implementing them.
2019-09-19 23:25:49 -07:00