Commit Graph

412 Commits

Author SHA1 Message Date
Richard Feldman
5970e16a6b
cargo fmt 2022-05-10 19:26:48 -04:00
Richard Feldman
fd40fed937
Fix a bunch of errors from clippy --tests 2022-05-10 15:21:48 -04:00
Mfon Eti-mfon
9068c2414e
Rename float functions and vars 2022-05-08 18:42:12 +01:00
Folkert
07383e96f0
Merge remote-tracking branch 'origin/trunk' into i/2792 2022-05-06 20:17:53 +02:00
Folkert
64b633bea6
make round return an integer 2022-05-06 20:17:40 +02:00
Richard Feldman
85e7969c2d
Replace references to "global tag" with "tag" 2022-04-25 17:04:34 -04:00
Ayaz Hafiz
cf8409dfaa
Remove private tag variants 2022-04-25 11:38:54 -04:00
Richard Feldman
57b7832917
Upgrade target-lexicon 2022-04-23 20:51:57 -04:00
Brendan Hansknecht
d9c3601ec4 stop special casing on list and str. They are just large structs 2022-03-11 18:43:31 -08:00
Brendan Hansknecht
de68e55aca update loading small str in dev 2022-03-11 18:42:53 -08:00
Folkert
b3b3b8790c
add new Expr variants 2022-03-07 21:13:48 +01:00
Brendan Hansknecht
2b3545233a switch storage manager to default clone 2022-03-06 22:56:49 -08:00
Brendan Hansknecht
02e7cf016b fix jumps with primitive arguments 2022-03-06 22:52:25 -08:00
Brendan Hansknecht
611c5a69cb remove commented line 2022-03-06 22:32:11 -08:00
Brendan Hansknecht
beeff5ca72 misc cleanup 2022-03-01 15:52:34 -08:00
Brendan Hansknecht
2801699ffc fix warnings 2022-02-28 17:10:14 -08:00
Brendan Hansknecht
facfe9cffc re-enable freeing all to stack 2022-02-28 11:05:16 -08:00
Brendan Hansknecht
72cc0e4f38 cleanup join points 2022-02-28 10:38:38 -08:00
Brendan Hansknecht
b53a53adbd fix list get unsafe 2022-02-28 09:11:36 -08:00
Brendan Hansknecht
3b77f5c235 fix stack size being too small in branches 2022-02-28 08:41:21 -08:00
Brendan Hansknecht
90e44003fc fix infinite looping 2022-02-28 08:17:34 -08:00
Brendan Hansknecht
442d0e3bff expand arg support 2022-02-28 01:03:31 -08:00
Brendan Hansknecht
20e792c174 fix pointer cast 2022-02-28 00:53:57 -08:00
Brendan Hansknecht
151b5c9336 generate nested rc procs 2022-02-28 00:49:28 -08:00
Brendan Hansknecht
06c3376577 fix some storage issues around jumps 2022-02-28 00:05:12 -08:00
Brendan Hansknecht
069361a07e first attempt at List.replace in the dev backend 2022-02-27 22:02:47 -08:00
Brendan Hansknecht
7a608524ec Merge remote-tracking branch 'origin/trunk' into gen-dev/quicksort2 2022-02-27 00:26:04 -08:00
Brendan Hansknecht
39d070e543 flip platform flag to be default 2022-02-25 20:10:36 -08:00
ayazhafiz
e52d427ac8 Hash record field name order in generated layouts
Closes #2535

See the referenced issue for longer discussion - here's the synopsis.
Consider this program

```
app "test" provides [ nums ] to "./platform"

alpha = { a: 1, b: 2 }

nums : List U8
nums =
    [
        alpha.a,
        alpha.b,
    ]
```

Here's its IR:

```
procedure : `#UserApp.alpha` {I64, U8}
procedure = `#UserApp.alpha` ():
    let `#UserApp.5` : Builtin(Int(I64)) = 1i64;
    let `#UserApp.6` : Builtin(Int(U8)) = 2i64;
    let `#UserApp.4` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = Struct {`#UserApp.5`, `#UserApp.6`};
    ret `#UserApp.4`;

procedure : `#UserApp.nums` List U8
procedure = `#UserApp.nums` ():
    let `#UserApp.7` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = CallByName `#UserApp.alpha`;
    let `#UserApp.1` : Builtin(Int(U8)) = StructAtIndex 1 `#UserApp.7`;
    let `#UserApp.3` : Struct([Builtin(Int(I64)), Builtin(Int(U8))]) = CallByName `#UserApp.alpha`;
    let `#UserApp.2` : Builtin(Int(U8)) = StructAtIndex 1 `#UserApp.3`;
    let `#UserApp.0` : Builtin(List(Builtin(Int(U8)))) = Array [`#UserApp.1`, `#UserApp.2`];
    ret `#UserApp.0`;
```

What's happening is that we need to specialize `alpha` twice - once for the
type of a narrowed to a U8, another time for the type of b narrowed to a U8.

We do the specialization for alpha.b first - record fields are sorted by
layout, so we generate a record of type {i64, u8}. But then we go to
specialize alpha.a, but this has the same layout - {i64, u8} - so we reuse
the existing one! So (at least for records), we need to include record field
order associated with the sorted layout fields, so that we don't reuse
monomorphizations like this incorrectly!
2022-02-21 14:10:45 -05:00
Brendan Hansknecht
2154e910d8 expand test coverage 2022-02-19 19:39:44 -08:00
Brendan Hansknecht
c6f1edbf47 load literals that are union args 2022-02-19 19:24:37 -08:00
Brendan Hansknecht
28ec18c564 add new union creation 2022-02-19 19:14:09 -08:00
Brendan Hansknecht
f8e12da809 add List.getUnsafe 2022-02-19 17:07:53 -08:00
Brendan Hansknecht
c47209c54a add copying any memcpy-able symbols to a stack offset 2022-02-19 16:48:27 -08:00
Brendan Hansknecht
1ef7df19b4 add List.set 2022-02-19 16:43:24 -08:00
Brendan Hansknecht
4bc59cdb61 add storing large args for passing 2022-02-19 16:42:21 -08:00
Brendan Hansknecht
b5a10695ac update ret pointer returning 2022-02-19 16:36:28 -08:00
Brendan Hansknecht
cf8d294ec1 add List.len 2022-02-19 16:01:59 -08:00
Brendan Hansknecht
a39f610395 add copying to a return pointer 2022-02-19 15:53:31 -08:00
Brendan Hansknecht
39b9ab44a7 more ignoring of branch info 2022-02-19 15:34:27 -08:00
Brendan Hansknecht
bbee753e21 copying list and str to stack offset 2022-02-19 15:33:39 -08:00
Brendan Hansknecht
c0b0fe3ba1 add Num.Lte 2022-02-19 15:29:52 -08:00
Brendan Hansknecht
f2e5b63ec3 load union at index for recursive and nonrecursive unions 2022-02-19 15:24:25 -08:00
Brendan Hansknecht
a86f1193c6 skip branch info in switch 2022-02-19 15:15:08 -08:00
Brendan Hansknecht
bed779a290 add zero and sign extension 2022-02-19 15:12:50 -08:00
Brendan Hansknecht
f55f82119c wider int support for equality 2022-02-19 14:16:06 -08:00
Brendan Hansknecht
2307be8f0a add loading tag for non-recursive union 2022-02-19 14:09:55 -08:00
Brendan Hansknecht
05959b0622 enable returning small complex types 2022-02-19 13:23:13 -08:00
Brendan Hansknecht
582413a5bb add List.get wrapper 2022-02-19 13:18:17 -08:00
Brendan Hansknecht
dcc68fbc84 enable passing lists to functions 2022-02-19 13:15:51 -08:00