Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
07e8192
Tag pointers, not scalars
nomeata Mar 6, 2019
aa32734
Also do GC
nomeata Mar 6, 2019
b2f4cf6
Phrase object size in words
nomeata Mar 6, 2019
ae104fd
memcpy: Copy word by word instead of byte by byte
nomeata Mar 6, 2019
ea5be48
Apply suggestions from code review
ggreif Mar 6, 2019
de61c26
Use terms “skewed” for the shifted or translated pointer
nomeata Mar 7, 2019
7832b4c
Remove some redundant parenthesis
nomeata Mar 7, 2019
989f0bb
Merge pull request #217 from dfinity-lab/joachim/tag-pointers
nomeata Mar 7, 2019
0001d4d
Minor typos and elim. tabs (#219)
ggreif Mar 7, 2019
611006b
Extend testsuite to allow for FileCheck assertions
nomeata Mar 7, 2019
4f7f6f3
[AST-60] fix
crusso Mar 7, 2019
69eb6d2
Update AST-60.as
crusso Mar 7, 2019
c958f91
Merge pull request #221 from dfinity-lab/filecheck
nomeata Mar 7, 2019
b0a9bf8
AST-67: Fix Word rotations in the interpreter (#222)
ggreif Mar 8, 2019
80f73df
initial ActorScript mode for emacs
matthewhammer Mar 8, 2019
d4c7636
module keyword
matthewhammer Mar 8, 2019
ee4b495
fix font-lock for (most) symbols; special regex symbols still broken
matthewhammer Mar 8, 2019
189463d
bright braces
matthewhammer Mar 8, 2019
16f26cc
make targets 'parallel' and 'quick', speed up regression testing (#186)
ggreif Mar 9, 2019
f2f213c
Desugar loops (#191)
matthewhammer Mar 11, 2019
2bdaa99
Fix problems with Int heap management (#228)
ggreif Mar 11, 2019
9e6bee7
Typos (#229)
ggreif Mar 11, 2019
f31baf1
Merge pull request #220 from dfinity-lab/claudio/collection-modules
matthewhammer Mar 11, 2019
9563d54
AST-33: Codegen for Char/Word8/16/32 and operations (#216)
ggreif Mar 12, 2019
21ee7ab
M1-390 Fetch `dev` via nix (#227)
nomeata Mar 12, 2019
fdb4aca
Ir: Remove all loop forms but `LoopE exp
nomeata Mar 11, 2019
f349e36
review comments
matthewhammer Mar 12, 2019
945563f
Merge pull request #231 from dfinity-lab/stdlib
matthewhammer Mar 12, 2019
49e139a
Do not run FileCheck checks when building coverage report (#236)
nomeata Mar 13, 2019
cc2c367
AST-33: Word64 and operations (#235)
ggreif Mar 13, 2019
1f220c5
AST-33: Support popcnt/clz/ctz/shrs for Word8/Word16 (#238)
ggreif Mar 14, 2019
39945d9
Remove asyncreturn test case
nomeata Mar 13, 2019
979665c
Introduce a primitive type for elembufs
nomeata Mar 13, 2019
7f12768
Create a pass that inserts calls to serialize/deserialize
nomeata Mar 13, 2019
4efd915
Ir: FuncE takes a list of names, not a full pattern
nomeata Mar 13, 2019
20c6f12
Backend: Avoid boxing and re-boxing of elembufs
nomeata Mar 13, 2019
81795a1
debug names: Use function parameter names
nomeata Mar 13, 2019
caceb04
Replace ElemBuf prim with a Serialized t type constructor
nomeata Mar 14, 2019
bf7ed36
Push call to serialize into blocks and manifest tuples
nomeata Mar 14, 2019
5279ab5
Assert, not trap, if `match_arg` sees wrong number of parameters
nomeata Mar 14, 2019
6862737
Compile.FuncDec: Factor our bind_args
nomeata Mar 15, 2019
58f7bce
Remove a comment from data-params.as
nomeata Mar 15, 2019
432a47a
Extract heap traversal functions into own module
nomeata Mar 14, 2019
bb18a90
Factor out Array.alloc
nomeata Mar 14, 2019
6d0531b
Factor out Text.alloc
nomeata Mar 15, 2019
a41754a
AST-33: bit-testing of words (#239)
ggreif Mar 16, 2019
e207b2d
Move more useful functions into module UnboxedSmallWord (#245)
nomeata Mar 16, 2019
db2c3a7
Let Construct.callE infer the return type
nomeata Mar 14, 2019
89005cb
Merge pull request #223 from dfinity-lab/emacs
matthewhammer Mar 18, 2019
e9d474d
Limit `make parallel` jobs to number of processors
nomeata Mar 18, 2019
1e9f713
AST-32: Hashing of Nat/Int (#249)
ggreif Mar 19, 2019
4e19dd2
Pipeline: Wrap `Desugar` in `transform`
nomeata Mar 20, 2019
e958434
Pipeline: Use `prog_ir` IR programs
nomeata Mar 20, 2019
911912d
Rename: Count stamps per name
nomeata Mar 20, 2019
26e5a36
Desugar.to_arg: Look through `AnnotP`
nomeata Mar 20, 2019
9de6812
Less calls to `fresh_var` in `serialize`
nomeata Mar 20, 2019
363eced
Construct.fresh_var requires a name base
nomeata Mar 20, 2019
8b8d482
Export the exports of the last actor of a program, if present
nomeata Mar 20, 2019
356be2a
Give the `(de)serialize` prim a polymorphic type
nomeata Mar 14, 2019
165899d
First stab at type driven serialization
nomeata Mar 14, 2019
b7f3f8f
Special-case serialiation for Text, Word32 and references.
nomeata Mar 20, 2019
cdeb0f5
Stupid bug in the compiler
nomeata Mar 20, 2019
6686339
Document the current serialization format
nomeata Mar 21, 2019
29bfa46
Bumping `dev` for no good reason
nomeata Mar 20, 2019
becb391
AST-72: correctly lex verbatim unicode (#260)
ggreif Mar 21, 2019
da1110e
Simplify UTF8 lexing fix
rossberg Mar 22, 2019
927d687
Minor cleanup
rossberg Mar 22, 2019
82cd11c
Merge pull request #262 from dfinity-lab/utf8-lex
rossberg Mar 22, 2019
126eecc
Fast path for byte
rossberg Mar 22, 2019
c59d9bf
Merge pull request #264 from dfinity-lab/utf8-lex2
rossberg Mar 22, 2019
9e0c2bc
Represent arguments without references directly as a databuf
nomeata Mar 21, 2019
ae47fb0
Update test output (#267)
nomeata Mar 23, 2019
c5a32d5
Pull in deterministic dvm
nomeata Mar 25, 2019
4a0b01b
remove devel workaround
ggreif Mar 25, 2019
fec3f05
fix comments (#265)
ggreif Mar 25, 2019
91d6bf3
AST-70: Eliminate 1-tuples (#263)
rossberg Mar 25, 2019
26ed2f1
Nix: Use builtins.path
nomeata Mar 25, 2019
11cfb7d
WIP: Text iteration (#197)
matthewhammer Mar 26, 2019
703850c
Switch `dev` to master (PR got merged)
nomeata Mar 25, 2019
2b83bbb
nix: Tighten file-includes whitelist
nomeata Mar 25, 2019
885e107
Eliminators for tagged heap objects (#273)
ggreif Mar 26, 2019
c56e500
Rule out messages with abstract types in the type checker
nomeata Mar 18, 2019
c7b2693
Merge remote-tracking branch 'origin/master' into paulyoung/stdlib-ex…
paulyoung Mar 28, 2019
c81e325
Change Server class to actor
paulyoung Mar 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
.dvm
/result*

nix/dev-in-nix

**/*~
**/_build
**/_output
Expand Down
35 changes: 0 additions & 35 deletions Jenkinsfile

This file was deleted.

29 changes: 4 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,6 @@ To install the `asc` binary into your nix environment, use
$ nix-env -i -f . -A native
```

## Setup of `dev`

Until we join the monorepo, we need a checkout the `dev` repository in
`nix/dev`; see the `Jenkinsfile` the precise revision to use.

For a fresh checkout, run
```
git clone --recursive git@github.com:dfinity-lab/dev nix/dev
git -C nix/dev checkout 2bc6…see…Jenkinsfile…fecd
git -C nix/dev submodule update --init --recursive
```

To update, just run the last two commands again.


## Development using Nix

This is the command that should always pass on master is the following, which builds everything:
Expand Down Expand Up @@ -65,27 +50,21 @@ installing all required tools without nix is out of scope).
```
opam install num vlq yojson bisect_ppx bisect_ppx-ocamlbuild menhir
```
* Install the `wasm` package. We use a newer version than is on opam, and a
* Install the `wasm` Ocaml package. We use a newer version than is on opam, and a
fork that supports the multi-value extension. See `nix/ocaml-wasm.nix` for
the precise repository and version. You can use `nix` to fetch the correct
source for you, and run the manual installation inside:
```
cd $(nix-build -Q -A wasm.src)/interpreter
make install
```
* Install the `wasm` tool, using
* Install various command line tools used by, in particuar, the test suite:
```
nix-env -i -f . -A wasm
```
* Install the `dvm` tool, using
```
nix-env -i -f . -A filecheck
nix-env -i -f . -A wabt
nix-env -i -f . -A dvm
```
or simply
```
./update-dvm.sh
```
which also updates the `dev` checkout.


## Create a coverage report
Expand Down
1 change: 1 addition & 0 deletions ci-pr.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import ./ci.nix
5 changes: 1 addition & 4 deletions ci.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# We need to set test-dvm to false because hydra has
# no access to the `dev` repo. This can go away once we join
# the monorepo.
import ./default.nix { test-dvm = false; }
import ./default.nix { }
50 changes: 30 additions & 20 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@

let stdenv = nixpkgs.stdenv; in

let sourceByRegex = src: regexes: builtins.filterSource (path: type:
let sourceByRegex = src: regexes: builtins.path
{ name = "actorscript";
path = src;
filter = path: type:
let relPath = nixpkgs.lib.removePrefix (toString src + "/") (toString path); in
let match = builtins.match (nixpkgs.lib.strings.concatStringsSep "|" regexes); in
( type == "directory" && match (relPath + "/") != null
|| match relPath != null)) src; in
( type == "directory" && match (relPath + "/") != null || match relPath != null);
}; in

let ocaml_wasm = (import ./nix/ocaml-wasm.nix) {
inherit (nixpkgs) stdenv fetchFromGitHub ocaml;
Expand All @@ -30,12 +33,12 @@ let real-dvm =
then
if test-dvm
then
if !builtins.pathExists ./nix/dev/default.nix
then
throw "\"test-dvm = true\" requires a checkout of dev in ./nix.\nSee Jenkinsfile for the required revision. "
else
# Pass devel = true until the dev test suite runs on MacOS again
((import ./nix/dev) { devel = true; }).dvm
let dev = builtins.fetchGit {
url = "ssh://git@github.com/dfinity-lab/dev";
ref = "master";
rev = "55724569782676b1e08fdce265b7daddaeaec860";
}; in
(import dev {}).dvm
else null
else dvm; in

Expand Down Expand Up @@ -92,9 +95,10 @@ rec {
"test/"
"test/.*Makefile.*"
"test/quick.mk"
"test/(run.*|fail)/"
"test/(run.*|fail)/.*.as"
"test/(run.*|fail)/ok/.*"
"test/(fail|run|run-dfinity)/"
"test/(fail|run|run-dfinity)/.*.as"
"test/(fail|run|run-dfinity)/ok/"
"test/(fail|run|run-dfinity)/ok/.*.ok"
"test/.*.sh"
"samples/"
"samples/.*"
Expand All @@ -111,6 +115,7 @@ rec {
nixpkgs.wabt
nixpkgs.bash
nixpkgs.perl
filecheck
] ++
(if test-dvm then [ real-dvm ] else []);

Expand All @@ -119,12 +124,13 @@ rec {
asc --version
make -C stdlib ASC=asc all
make -C samples ASC=asc all
make -C test/run VERBOSE=1 ASC=asc all
make -C test/fail VERBOSE=1 ASC=asc all
'' +
(if test-dvm then ''
make -C test/run-dfinity VERBOSE=1 ASC=asc all
'' else "");
(if test-dvm
then ''
make -C test ASC=asc parallel
'' else ''
make -C test ASC=asc quick
'');

installPhase = ''
mkdir -p $out
Expand All @@ -149,9 +155,10 @@ rec {
"test/"
"test/.*Makefile.*"
"test/quick.mk"
"test/(run.*|fail)/"
"test/(run.*|fail)/.*.as"
"test/(run.*|fail)/ok/.*"
"test/(fail|run|run-dfinity)/"
"test/(fail|run|run-dfinity)/.*.as"
"test/(fail|run|run-dfinity)/ok/"
"test/(fail|run|run-dfinity)/ok/.*.ok"
"test/.*.sh"
"samples/"
"samples/.*"
Expand Down Expand Up @@ -208,6 +215,9 @@ rec {

wasm = ocaml_wasm;
dvm = real-dvm;
filecheck = nixpkgs.linkFarm "FileCheck"
[ { name = "bin/FileCheck"; path = "${nixpkgs.llvm}/bin/FileCheck";} ];
wabt = nixpkgs.wabt;

all-systems-go = nixpkgs.releaseTools.aggregate {
name = "all-systems-go";
Expand Down
102 changes: 102 additions & 0 deletions design/TmpWireFormat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
Temporary Wire Format
=====================

This document describes the serializaion format currently used by the
ActorScript runtime, i.e. a mapping from ActorScript types to DFINITY types (=
WebAssembly types + `databuf`, `elmembuf`, `funcref` and `actorref`), and a
mapping between the corresponding values.

This is a scaffolding tool to prototype applications until we have decided upon
the actual IDL of the system, which will change all that is described here.

It also does not support all features that we want to support eventually. In
particular, it does not support subtyping.

Some types have a *specialized argument format* when used directly as a
function arguments, rather than nested inside a data structure. Other types use
the _general argument format (without references)_ or the _general argument
format (with references)_.

Each argument of a function is serialized separately. If the function is
defined with a list of arguments, these all become arguments of the WebAssembly
function. See the [ActorScript guide](https://hydra.oregon.dfinity.build//job/dfinity-ci-build/actorscript.pr-252/users-guide/latest/download/1/guide/#function-types) for the precise rules for function arities.


Specialized argument format: `Word32`
-------------------------------------

A message entry point with an argument of type `Word32` is directly represented
as a `I32`.

Specialized argument format: `Text`
-------------------------------------

A message entry point with an argument of type `Text` is represented as a `databuf` that contains the UTF8-encoded string.

Note that there is no terminating `\0`, and the length is implicit as the
length of the `databuf`.


General argument format (without references)
--------------------------------------------

Arguments with a type that does not mention any reference types (no actors, no
shared functions), are represented as a `databuf`. This `databuf` is generated
by an in-order traversal of the data type. All numbers are fixed-width and in
little endian format.

* A `Nat`, `Int` or `Word64` is represented by 8 bytes.
* A `Word32` is represented by 4 bytes.
* A `Word16` is represented by 2 bytes.
* A `Word8` is represented by 1 byte.
* A `Bool` is represented by 1 byte that is `0` for `false` and `1` for `true`.
* A `Text` is represented by 4 bytes indicating the length of the following
payload, followed by the payload as a utf8-encoded string (no trailing `\0`).
* An `Array` is represented by 4 bytes indicating the number of entries,
followed by the concatenation of the representation of these entries.
* An `Tuple` is represented the concatenation of the representation of its
entries. (No need for a length field, as it is statically determined.)
* An `Object` is represented the concatenation of the representation of its
fields, sorted by field name. (The field names are not serialized, as they
are statically known.)
* An `Option` is represented by a single byte `0` if it is `null`, or
otherwise by a single byte `1` followed by the representation of the value
* An empty tuple, the type `Null` and the type `Shared` are represented by
zero bytes.


*Example:* The ActorScript value
```
(null, ?4, "!") : (?Text, ?Int, Text)
```
is represented as
```
00 01 04 00 00 00 00 00 00 00 01 21
```

General argument format (with references)
-----------------------------------------

Argument with a type that mentions reference types (actors or shared functions)
are represented as an `elembuf`:

* the first entry is a `databuf` contains the data according to the format
above.
* all further entries are the references contained in the data.

The above format is thus extended with the following case:

* A reference (`actor`, `shared func`) is represented as a 32 bit number (4
bytes). Thus number is an index into the surrounding `elembuf`.

NB: The index is never never `0`, as the first entry in the `elembuf` is the
`databuf` with the actual data.

*Example:* The ActorScript value
```
(null, ?console) : (?actor {}, ?actor {log : Text -> () })
```
is represented as
```
elembuf [databuf [00 01 01 00 00 00], console]
```
Loading