Commit Graph

594 Commits

Author SHA1 Message Date
Mitchell Rosen
1804ab9d53 remove new runtime arg from UnisonSources test 2021-04-15 20:36:00 -04:00
Mitchell Rosen
e25e43edc9 fix tests 2021-04-15 20:31:12 -04:00
Rúnar
b437e09a53 Merge branch 'trunk' of github.com:unisonweb/unison into topic/fzf-endpoint 2021-04-15 10:41:55 -04:00
Rúnar
42a13baebb Add best names and type definitions to fzf 2021-04-12 15:00:44 -04:00
Dan Doel
9e2aeb6756 Keep track of decompilation info while floating
This allows a much wider range of terms to be decompiled. We remember
the original term that we're about to float, and use it when the floated
combinator is decompiled.

We do this for every closed term that is being floated. Before floating,
we do a pass to close all lambda terms, so the only free variables in
them are actual recursive references. This means that every (locally)
non-recursive function has retained decompilation information.
2021-04-06 11:31:41 -04:00
Cody Allen
9f3ce3838c
name.segments test: don't pick from an empty list
Resolves #1648.

Technically I think that this has slightly different RNG characteristics
than the old implementation, but I wouldn't expect it to matter for
the sake of the test.
2021-03-15 19:21:24 -07:00
Cody Allen
334fa29607
Tests: explicit branch in git init
Before this change, when I ran the tests I got the following "hints"
printed to the console:

```
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:   git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m <name>
```

I think that this means that the tests could potentially fail, depending
on the user's local git config and/or version.

I tried using the `trunk` branch and the tests failed. It seems that
the tests are dependent on the `master` branch being used, so I figured
it was probably be best to explicitly specify that branch name.
2021-03-13 07:50:32 -08:00
Arya Irani
2785610aad update git test after #1817 2021-03-04 10:55:32 -05:00
Arya Irani
ed9bf17dd1
Merge branch 'trunk' into topic/codebaseserver-openapi 2021-02-16 13:12:44 -05:00
Dan Doel
54b2657dc6 Use more informative test failures for evaluation tests 2021-02-10 16:54:01 -05:00
runarorama
d1920dc2fe wip 2021-01-27 15:36:23 -05:00
runarorama
6ce155e3a6 Finally compiles 2020-12-09 21:32:57 -05:00
Dan Doel
e4961c84b2 Fix test case; improve transcript test and add output 2020-11-25 21:12:09 -05:00
Paul Chiusano
d706550926
Merge pull request #1748 from unisonweb/topic/mobile-code
Finish implementing code serialization support
2020-11-24 17:27:56 -05:00
Paul Chiusano
21abeaad09
Merge pull request #1752 from unisonweb/fix/1731
Avoid parsing erroneous patterns
2020-11-24 17:15:52 -05:00
Dan Doel
03770909fd Remove test case that relies on bad parse
- This test cases expected `{ Some x -> k }` to parse, but since
  data/effect references are resolved at parse time, this isn't
  possible. Parsing effect matches is likely covered by other tests
  with legitimate abilities anyway.
2020-11-24 11:59:18 -05:00
Paul Chiusano
062f4c24fb Add some tests of hex and octal literals 2020-11-19 21:46:35 -05:00
Paul Chiusano
eed0c5a09a update parser for bytes literals and fix lexer hex and bytes parsing bug 2020-11-19 17:36:11 -05:00
Paul Chiusano
e9ea538798 fix a bunch more failures 2020-11-18 17:50:42 -05:00
Paul Chiusano
7e9aba87d3 Down to 1 lexer test failure 2020-11-17 20:22:51 -05:00
Dan Doel
40e2db5722 Merge branch 'trunk' into topic/mobile-code
- Fixes conflicts
2020-11-10 14:14:25 -05:00
Dan Doel
9f172927e8 Use a mutable code cache in the new runtime
- This is necessary for dynamically loading intermediate code during
  execution. Local assignments of various code are now stored in
  transactional variables that can be mutated as necessary.
- Various functions for adding to this cache have naturally been moved
  to the machine implementation rather than the interface. The interface
  mainly retains functions for keeping track of mappings between the
  surface and intermediate levels, which won't be updated during
  execution.
- Helper functions for finding references in intermediate code have been
  added, since we may not have surface terms for some intermediate code
  we're dealing with.
- Terms have been monomorphized to Symbol for this caching, just for
  simplicity.
2020-11-04 16:32:01 -05:00
Paul Chiusano
e721fc7d6f Fix #1737 2020-10-27 17:21:37 -04:00
Paul Chiusano
e784107d64 Implement fix. There were lots of tests that were inadvertently relying on the bug. 2020-10-22 22:33:12 -04:00
Dan Doel
20e10c6926 Keep track of let numbering in ANF
- A let may be classified as either Direct or Indirect. Indirect lets
  contain a number, so that we can represent their return location in a
  continuation. Direct indicates that this is not necessary.
- Currently, only simple direct lets are allowed, which may be turned
  into individual instructions. This is because anything else still
  requires stack/continuation management, and would require additional
  code forms to represent compound expressions that involve only local
  instructions.
- This obviates generating these numbers in the MCode translation.
  Instead, the relevant lets are numbered with Word16s, and each section
  gets 48 bits for numbering, while their lets use the low 16 bits for
  identification.
2020-10-22 14:55:02 -04:00
Dan Doel
8ab24ed34e Relax normalization of ANormal
- Previously we were ensuring that a `let` does not immediately contain
  another `let`. However, there is actually no need for this from the
  perspective of the machine code. Removing this requirement makes the
  definition somewhat less complicated.
- Includes some preparation for numbering lets for continuation
  serialization.
2020-10-15 16:45:23 -04:00
Paul Chiusano
ced4eeec71 Add a couple unit tests 2020-10-09 15:56:45 -04:00
Dan Doel
b1c186c278 Eliminate syntax trees from the continuation representation
- The previous strategy was to store a `Section` directly in the
  continuation to know where to resume. However, this is undesirable
  both from the perspective of treating them as values (with ordering
  etc.) and from the perspective of serialization.
- Instead, the continuation now stores an index that is looked up the
  same way as any function. To make this possible, during the process
  of compiling from ANF to machine code, we create code sections for
  any let block that actually does an indirect code jump (i.e. not a
  literal, primop, or similar). Then the continuation is conceptually
  a sequence of these indexes (among other things).
- Various structures/functions have been shuffled and modified to
  facilitate this change.
- For actual mobile code, some of this numbering should probably be
  tracked at the ANF level. However, this was just an initial step to
  demonstrate the feasibility.
2020-10-09 13:12:54 -04:00
Paul Chiusano
1447b0a2cd Merge remote-tracking branch 'origin/trunk' into topic/hashing 2020-10-02 11:26:01 -04:00
Paul Chiusano
71ff9f7c48
Merge pull request #1706 from unisonweb/topic/mobile-code
Pull in some changes from the mobile code development
2020-10-01 18:45:10 -04:00
Dan Doel
2018653afb Rework data/code referencing at various stages
- Make ANF representation work entirely in terms of Reference. Since ANF
  is significantly closer to something that could actually be moved
  between machines, it doesn't make much sense to work in terms of
  machine-local numberings at that stage.
- Reference => Numbering resolution has been moved to the process of
  compiling ANF code to MCode.
- References are now stored directly in closures for partial
  applications and data. This means that Foreign functions can
  potentially inspect them without making a reverse mapping function
  available to them.
  * The interpreter mostly ignores these references, working in terms of
    an ephemeral numbering of these references.
  * This makes the RTag/CTag packing scheme unnecessary. Runtime tags
    are now just storing the constructor number, and the full Word64
    space is available for data/effect and constructor numbering for
    now.
  * The performance implications of this haven't been tested. If this
    is too slow, the strategy may need to be rethought.
- Universal comparison has been tweaked to use these references. It's
  also been tweaked to try to avoid comparing references in situations
  where it should be impossible for them to not match.
2020-10-01 15:40:41 -04:00
Dan Doel
ee71f810d8 Show exceptions in Unison.Test.UnisonSources
- Previously an exception would just result in a test failure with the
  uninformative message from `undefined`
2020-10-01 14:25:21 -04:00
Paul Chiusano
91220df8fc Merge remote-tracking branch 'origin/trunk' into topic/hashing 2020-09-30 18:51:11 -04:00
Chris Gibbs
37bcd95009 tweak interaction between destructuring bind and calculate imports (use insertion) 2020-09-30 22:16:47 +01:00
Paul Chiusano
27173e5cc6 Something implemented and runs for Sha3{512,256}, Sha2{512,256}, Blake2b{512,256}, Blake2s{256}. Still pending work from @dolio for the universal hashing functions. 2020-09-30 17:14:25 -04:00
Dan Doel
849e8e03af Merge branch 'trunk' into topic/mobile-code 2020-09-29 11:36:25 -04:00
Paul Chiusano
81f51fc646 Updated pretty-printer to use destructuring bind syntax, and updated pretty-printer tests. 2020-09-28 12:30:36 -04:00
Paul Chiusano
0a81eaf992 tests passing again after disabling namespace blocks, but still haven't switched on the new destructuring bind syntax 2020-09-27 21:20:50 -04:00
Dan Doel
6fa06c9078 Make new runtime use split combinators
- Previously the new runtime expected the code it was to run to be
  completely contained in a single letrec. The new code no longer has
  this restriction, and it will even break down top-level letrecs it's
  given into separate referenced combinators.
- Internal letrecs are not split out currently; they are lifted after
  the top group is split up. This results in each top-level reference
  potentially having a set of mutually recursive definitions.
- The mutually recursive definitions of each reference are preserved all
  the way to machine code, resulting in (potentially) multiple
  combinators making up a single referenced definition. One of these is
  distinguished as the main entry point, and local entry points can only
  be referenced from within the combinator (at this point).
- The new runtime interface will actualaly chase term dependencies now,
  and compile them.
- Debugging and test code has been tweaked to work with these changes.
- Decompilation of 'internal' function sections likely still needs work.
2020-09-24 11:25:07 -04:00
Dan Doel
04d0bed56c Add test case for bad variable indexing behavior 2020-09-22 17:43:44 -04:00
Dan Doel
a2a6aa4e00 Roll back runtime selection for IO tests
- The tests are specifically for the IO ability used in the old runtime.
  It was anticipated that the new one would use the same IO, but that
  ended up not being the case.
- So instead, just run the IO test with the old runtime, since that is
  simple, and doesn't require any complicated logic to make the test
  valid in both situations.
2020-09-10 13:24:10 -04:00
Dan Doel
616787cf59 Rework FFI
- As part of implementing MVar, it became clear that the existing FFI
  methodology wasn't set up to handle 'foreign' code working
  parametrically in closures.
- Rather than wrapping closures in Foreign or the like, things have been
  reworked to enable operating on closures directly, while still having
  convenience machinery for working on wrapped Haskell values.
- This required some additional refactoring to avoid cyclic or collapsed
  module structures.
  * Foreign functions are now stored in a map and referred to by word,
    similar to combinators.
  * The map is threaded through execution, and various 'static
    environment' maps have been combined into a single record for easier
    threading.
  * The ForeignFunc type has been given its own module, because it
    involves operating on stacks, but the stack module contains the
    closure type which has wrapped foreign values.
  * IOp to foreign function translation has been moved to the builtin
    module. Code emission is accomplished by using the Enum instance to
    pick words for the corresponding function.
- Some of the foreign machinery has been used to overload various
  peek/poke convenience operators rather than having multiple functions.
- Runtime exceptions have been moved to their own module.
2020-09-02 22:36:10 -04:00
Arya Irani
df65368600
Merge pull request #1631 from unisonweb/wip/rt2
New Runtime Implementation
2020-08-24 22:07:15 -04:00
Dan Doel
1e3faeb83a Make IO test disambiguate which IO it's using. 2020-08-24 14:08:29 -04:00
Mitchell Rosen
3de08f0299 Fix bug in lexing hash-qualified symboly id 2020-08-22 09:49:21 -04:00
Dan Doel
d555693423 Merge branch 'trunk' into wip/rt2 2020-08-19 10:59:08 -04:00
Dan Doel
c68fe09378 Fix test discrepancies 2020-08-18 17:11:55 -04:00
dolio
b58d222b22
Merge pull request #1649 from unisonweb/wip/rt2-patternp
merge topic/patternp into wip/rt2
2020-08-18 16:41:03 -04:00
Dan Doel
d3d331c36e Fix test compilation for previously modified handler adjustment 2020-08-14 11:12:34 -04:00
Arya Irani
4a56dda1bc rename DataDeclaration' to DataDeclaration, etc. 2020-08-12 19:39:24 -04:00