Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe separate the compilation schemes #517
Describe separate the compilation schemes #517
Changes from 1 commit
c1c2ea4
2c5ab97
0fda049
fb76984
ff625b0
aac015e
25521e6
5eee84a
cb50163
d4270be
fe78a2e
5111672
de3f449
6499a7a
315000f
486176f
8d1de64
d1594d2
0dc5519
2e604b4
735d1c7
8f1ecbc
5c6130d
deeb0ab
69cd514
9669c50
a58f64b
a0f0d1f
5f3c1d8
9b3a03b
5ce300a
73e82da
216ec9b
210943e
1aeaf83
3f13d92
aef5f21
f860916
0cf39d4
97f96c8
76b8dad
0ad74c9
a7c50d1
6105495
8228aa4
e0ed781
fc09987
0709c75
9ab88e3
9fbcc97
b7def7e
bc0146e
a57d239
b4c4289
69f248b
ae9525c
b4fd842
e47932d
e9997d6
437e6ec
da5f546
daad463
6c46355
100a9c8
398079a
ad26233
7d223e2
a6dd07e
3236ff9
3f1b4e5
9af8a98
c013121
1fe00c9
5d6ac6c
0b80a40
c178e04
9a0fd63
5bea22c
20df622
b937038
d26205b
681e06c
4bf70d6
22e6f9f
3117224
66b9e36
68bdce7
d8ef428
d3998be
7883956
b81ba4b
74dfa8c
11ad557
c03786a
be2667f
05f41e1
ea32767
7ce3acc
3f9bb99
9558500
0d827fe
b90fbc5
6245825
d4abbae
b1e6065
97e4f2b
2fd8bbb
c09f7e1
004dfc5
290534b
63a85d6
150e206
25bb223
aa567d1
b86d879
476d7bc
d285705
5dc2ad3
7a262e5
fe5f3f3
74f3e1d
540bdeb
31aa7ae
414317c
5de6fc8
ee8388e
634202e
1b02361
25fe971
198eff8
604f05e
895efb9
3dbde59
1ba1252
12a027e
a658af3
4f0b457
e22eb8c
e93a3dd
52b0e7b
2341e70
3ca2ddf
f47f868
58e948b
4a9cc84
b69a500
53433be
4deb3ed
c03af44
76ad47d
05decaf
94ed2e7
6c21c13
e67ee97
4d9e2c1
42e095a
1e5e551
94ec9a3
2b4e9fe
d7cc6f2
0adb42b
3e643b5
e0d70d8
6d90675
025b78b
2efb6f0
caa4490
7b39e11
029f35c
61efbbf
b27ca3b
a5c0170
7b580ac
169a69c
a862a6f
be8497e
58376ea
b9f7a80
71b3f98
2967ef5
4aacf9d
49866f7
a856438
7fcfb55
370d333
ce76e60
8cccfe2
5608307
4436275
849cfba
6c14f08
bac0148
524f39d
95ab2e9
b68e97f
d6b8d0f
d9f081e
3c2e396
f0e729d
995d15b
3aef8bf
8cf3b88
9e0e17e
210f5e9
d8b1469
5be8d80
0b459e2
7ded9d7
a67695f
74220d8
9e51529
86c8fca
8ece631
c9dbf4c
d5719a6
78660e1
958ebc7
546a04f
9af8bad
58b6241
1f9453c
d36dadc
f882198
7d1d615
b23c1d3
b68a5b3
ac3dbb2
f07b5f9
9e50a5e
661cec0
72d92c9
31e1d11
4125f41
5b5b57f
36498aa
1ec09bf
41dacc7
b4ae803
c219df4
396ff25
652409e
485804c
56f626e
fcfce39
e40f4e9
cf02ea7
2299768
a169a74
a6cb9c3
11c50ae
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For symmetry with the text above, you may mention that: "incremental compilation via Wasm seems incompatible with the interpreter, but will be useful for latter versions of the compiler."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the question is: How will it work with the intepreter? I.e. is there the assumption that the
.as
files are always available next to the compiled.wasm
thing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you envision this in addition to the "natural" scheme? I assume the benefit you have in mind is performance? Do we know that's not a premature optimisation? And would it be possible to support optimised calling conventions as an augmentation to the "natural" format, e.g., by exporting additional entry points?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s not (just) performance, it is also simplification.
The “natural” scheme (and I should call you out for using a term that implicit carries judgmental value, but at least you are putting it in quotes ;-)) has lots of complications for the backend – eta-expansion of closures, re-boxing of modules on the importing side, specifying a stable name mangling of field names.
So I expect to implement this scheme will be implemented before the “natural” scheme, which would already give us a usable model for incremental compilation. And the “natural” scheme can follow later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, surely, supporting two schemes is not a simplification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but starting with the simpler, more flexible scheme is :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you are suggesting it as a temporary solution? Why put it in the design doc then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I am suggesting this as a viable, useful and realisitc solution for 0.5 and 1.0, leaving the “natural” solution (which I am still not sold on) in the document as a vision for post 1.0 as a compromise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Selling me on this would require a convincing response to, say, #452 (comment). Or a concrete usecase for who would use these “natural” entry points – especially since you admit that
asc
itself would be allowed to export and use additional faster entry points.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you're doing there ;). But I'm afraid I'll insist that this doc describes the finalised module representation, and that it's what we should have implemented by 1.0. If you think we can move faster by first doing a temporary hack that's fine, too, but it can't be more than that.
Look, Wasm defines a notion of module where the entry points to a module are represented as exported functions. That is what every tool and framework in the eco system understands. It is what relevant developments like WASI build upon. It is the minimum foundation to enable interoperability. (The only alternative is sharing a single table across all modules, and that introduces tighter coupling and hence is a less modular approach. Edit: it also causes more trouble for orthogonal persistence.)
AS isn't an island. To be practical we'll eventually need to support linking with foreign libraries in user land. And clearly we want no N^2 FFI and tooling problem. Hence, ultimately the question isn't whether we support the native platform mechanism, but only whether we also maintain something home-brewed in addition. Clearly, it wouldn't be a simplification but a complication to maintain two different mechanisms. The only justification for such a complication would be a significant performance improvement, but currently that's hypothetical and hence a premature design optimisation. Should we ever identify this as a bottleneck, and should whole program compilation not be good enough to address it, then we can still add a secondary mechanism to the design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, then we are at an impasse.
An AS module exports AS values of various types. Some of them have don’t have function types, some dot. That does not make them WebAssembly functions! AS function ≠ WebAssembly functions – the former can be closures, they can be computed, they can be put in heap data structures, some may not even be WebAssembly functions (e.g. if an argument has type
None
, they might feasibly be absent).Maybe at some point there is an realistic interop story for WebAssembly. And maybe we want to use it. That’s already two maybes that are likely not true for our 1.0.
But even if these maybe become true, there will still be a significant mismatch between anAS function and a WebAssembly interop function! Bridging this mismatch will likely
So the viable path I see is a separation between
and I expect the latter to be it’s own kind of AS unit, because of additional restrictions on what we can export (e.g. only types that have meaning in the interop world), and maybe additional requirements from the user (e.g. annotations on how to present/expect arguments).
This is not a N^2 FFI story. There is only a single FFI story. But it is an FFI story, not a “all AS code can interop”
fairy talestory.There are some languages that can pull of the seamless integration with a low-level interop language. Rust code, for example, is particularly easy to call from and to C. But that is because it is a low-level language! A high-level language (with RTS and GC, including Ocaml, Haskell, but also like AS) cannot provide that, and usually has dedicated, separate support for “creating a native library”.
And even Rust code does not provide a native library by default, but you have to tell the compiler to do so (via
crate-type = ["dylib"]
, for example), and requires annotations like#[no_mangle]
.So what you want to achieve here seems to be overly ambitious for what we need to deliver, and also seems to be guided by your vision for a bright WebAssembly world, rather than what we actually need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should put everything dedicated to AS into a single "actorscript" section with subsections. Spreading it over multiple sections introduces a bit of extra complexity.
(FWIW, we should do the same with the Dfinity section.)
Do we also envision the possibility of an DIDL section? Or should that be described somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is merit in separating the information needed for the type checker (and, e.g., a SDK) from the information needed for the code generation. We can even make a stable specification for the former.
What is the DFINITY section? The one for the old system API? That should be gone with the new System API anyways.
Clearly somewhere else, as it is language-independent, and needs input from the SDK team. Also, it would be a section on a deployable canister module, not an AS unit, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may still need a custom section to declare which memories/tables/globals are supposed to be persistent. Though come to think of it, we might differentiate that with appropriate import naming conventions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? I thought the point of orthogonal persistence is that, well, the whole state (“store” as per WebAssembly spec) is persisted.
But this is out of scope for this discussion. If there is a need, a PR against the end2end spec would be appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the negation is true: 0.5 will support these things? Sorry, I'm forgetting the consensus opinion about the timeline for these features, though I know we've discussed that before.
I don't see this question answered in the AS planning google doc, but maybe I missed it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think we need to enshrine it in the design docs. But yeah, 0.5 would do “Source imports” I think