Conversation
Also note that a declaration crash throws an internal error, tracked at https://dfinity.atlassian.net/browse/AST-60
e4c9e66 to
5d1af54
Compare
An actor in the IR is now a bunch of “normal” declarations, follows by a mapping between exported label and local id. I dropped the `self` field from `IR.ActorE`. The compiler has a hack to support that particular idiom; I will tackle general actor value capture next. The current implementation of `ActorE` in the backend is most general: It assumes that the declarations decare some `funcref` (as they necessarily do, given their types), stores this in a static locations, and then exports a small wrapper function that calls this `funcref`. In general, that is the right thing to do (the funcref could be captured from the enviornment). But in most cases, we just want to call the function directly. There is also one test case that makes v8 throw a nasty exception, and it cannot be minimzed separately. Not sure what I am doing wrong. Will report that against `dev`.
5d1af54 to
d617ac9
Compare
The current API provides a specific function to get the current actorref, i.e., self. I wonder if we may not need to use that in some cases, e.g., when deploying a standalone actor. |
|
Yes, we have been using that API for a long time, when we statically know that an actorref is actually I would not mind making that explicit in the IR and move this logic out of the backend, though. But that should be a separate change. |
|
(BTW, if you wrote inline comments, you did not submit them yet ;-)) |
| | AssertE of exp (* assertion *) | ||
| | DeclareE of id * Type.typ * exp (* local promise *) | ||
| | DefineE of id * mut * exp (* promise fulfillment *) | ||
| | ActorE of dec list * (name * id * Type.typ) list * Type.typ (* actor *) |
There was a problem hiding this comment.
Why do you need field types, can't you recover them from the environment and id?
There was a problem hiding this comment.
I could; this is for convenience in those code paths that don’t keep a full environment.
I guess a maybe more idiomatic alternative would be to use (name * id) phrase list
| | ActorE of dec list * (name * id * Type.typ) list * Type.typ (* actor *) | ||
| | NewObjE of (* make an object, preserving mutable identity *) | ||
| Type.obj_sort * (name * id) list * Type.typ | ||
| Type.obj_sort * (name * id * Type.typ) list * Type.typ |
There was a problem hiding this comment.
ditto (Why do you need field types, can't you recover them from the environment and id?)
There was a problem hiding this comment.
Here I just add them for symmetry with ActorE.
| higher-order | ||
| ,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, | ||
| # | ||
| # Fatal error in v8::ToLocalChecked |
There was a problem hiding this comment.
I don’t know, but I reported it as https://dfinity.atlassian.net/browse/M1-513
to deal with varying output of “Illegal Instruction”.
AST-58 A test in preparation of #189
|
I will have to rebase this on top of #196 once that is in. |
|
I re-did this in #201 (too much else has changed in between). |
## Changelog for ic-hs: Branch: master Commits: [dfinity/ic-hs@406decfa...9152a0ff](dfinity/ic-hs@406decf...9152a0f) * [`d4db8d07`](dfinity/ic-hs@d4db8d0) bump nixpkgs to 7c786944f801745310578d1cfc019923396f830c ([dfinity/ic-hs#163](https://github.com/dfinity/ic-hs/issues/163)) * [`31d535d2`](dfinity/ic-hs@31d535d) increase the number of allowed delegations in a request from 4 to 20 ([dfinity/ic-hs#166](https://github.com/dfinity/ic-hs/issues/166)) * [`4a310c0d`](dfinity/ic-hs@4a310c0) support ic0.is_controller ([dfinity/ic-hs#169](https://github.com/dfinity/ic-hs/issues/169)) * [`5fc27bdc`](dfinity/ic-hs@5fc27bd) do not include keep-alive header in httpbin response ([dfinity/ic-hs#170](https://github.com/dfinity/ic-hs/issues/170)) * [`96448083`](dfinity/ic-hs@9644808) drop nix-build-uncached ([dfinity/ic-hs#175](https://github.com/dfinity/ic-hs/issues/175)) * [`c6fbe1f7`](dfinity/ic-hs@c6fbe1f) increase ingress_expiry in reference test suite ([dfinity/ic-hs#176](https://github.com/dfinity/ic-hs/issues/176)) * [`a1b3f670`](dfinity/ic-hs@a1b3f67) add Connection: close header to httpbin ([dfinity/ic-hs#178](https://github.com/dfinity/ic-hs/issues/178)) * [`d3812ffc`](dfinity/ic-hs@d3812ff) increase delegation expiry in tests ([dfinity/ic-hs#182](https://github.com/dfinity/ic-hs/issues/182)) * [`40a46e2f`](dfinity/ic-hs@40a46e2) sync universal-canister with IC repo ([dfinity/ic-hs#177](https://github.com/dfinity/ic-hs/issues/177)) * [`7a6259c2`](dfinity/ic-hs@7a6259c) decrease number of threads and request submission latency ([dfinity/ic-hs#179](https://github.com/dfinity/ic-hs/issues/179)) * [`a9f73dba`](dfinity/ic-hs@a9f73db) fix decoding compressed WASM modules during snapshotting ([dfinity/ic-hs#184](https://github.com/dfinity/ic-hs/issues/184)) * [`64c19a95`](dfinity/ic-hs@64c19a9) bump nixpkgs to eaf03591711b46d21abc7082a8ebee4681f9dbeb ([dfinity/ic-hs#189](https://github.com/dfinity/ic-hs/issues/189)) * [`9152a0ff`](dfinity/ic-hs@9152a0f) add date header to httpbin responses and make http header names lower-case ([dfinity/ic-hs#188](https://github.com/dfinity/ic-hs/issues/188)) Includes and closes #3915. Reason: `ic-hs` and `nixpkgs` must be in sync, so that the artefact caching can work.
An actor in the IR is now a bunch of “normal” declarations, follows by a
mapping between exported label and local id.
I dropped the
selffield fromIR.ActorE. The compiler has a hack tosupport that particular idiom; I will tackle general actor value capture
next.
The current implementation of
ActorEin the backend is most general:It assumes that the declarations decare some
funcref(as theynecessarily do, given their types), stores this in a static locations,
and then exports a small wrapper function that calls this
funcref.In general, that is the right thing to do (the funcref could be captured
from the enviornment). But in most cases, we just want to call the
function directly.
There is also one test case that makes v8 throw a nasty exception, and
it cannot be minimzed separately. Not sure what I am doing wrong. Will
report that against
dev.