Skip to content

AST-58: New Actor IR#189

Closed
nomeata wants to merge 5 commits intomasterfrom
joachim/AST58
Closed

AST-58: New Actor IR#189
nomeata wants to merge 5 commits intomasterfrom
joachim/AST58

Conversation

@nomeata
Copy link
Contributor

@nomeata nomeata commented Feb 24, 2019

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.

Also note that a declaration crash throws an internal error, tracked at
https://dfinity.atlassian.net/browse/AST-60
@nomeata nomeata changed the title AST58: New Actor IR AST-58: New Actor IR Feb 25, 2019
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`.
@rossberg
Copy link
Contributor

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 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.

@nomeata
Copy link
Contributor Author

nomeata commented Feb 25, 2019

Yes, we have been using that API for a long time, when we statically know that an actorref is actually self. With this change it just becomes a bit more involved to know that.

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.

@nomeata
Copy link
Contributor Author

nomeata commented Feb 25, 2019

(BTW, if you wrote inline comments, you did not submit them yet ;-))

@crusso crusso self-requested a review February 25, 2019 16:01
| 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 *)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need field types, can't you recover them from the environment and id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto (Why do you need field types, can't you recover them from the environment and id?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's going on here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t know, but I reported it as https://dfinity.atlassian.net/browse/M1-513

to deal with varying output of “Illegal Instruction”.
nomeata added a commit that referenced this pull request Feb 27, 2019
@nomeata
Copy link
Contributor Author

nomeata commented Feb 27, 2019

I will have to rebase this on top of #196 once that is in.

@nomeata nomeata mentioned this pull request Feb 28, 2019
@nomeata
Copy link
Contributor Author

nomeata commented Feb 28, 2019

I re-did this in #201 (too much else has changed in between).

@nomeata nomeata closed this Feb 28, 2019
@nomeata nomeata deleted the joachim/AST58 branch February 28, 2019 22:25
mergify bot pushed a commit that referenced this pull request Jun 6, 2023
## 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants