Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

List and describe post-MVP features in more detail #114

Merged
merged 6 commits into from
Aug 17, 2020
Merged

Conversation

rossberg
Copy link
Member

A somewhat more complete and detailed write-up of post-MVP features, and rationale why they are not included in the proposed MVP. It is intended to clarify some reoccurring questions and suggestions about the proposal. Probably not a comprehensive list yet, but making progress. :)

@rossberg rossberg requested a review from lukewagner August 12, 2020 16:42
@rossberg rossberg changed the title List and describe post-MVP features in more details List and describe post-MVP features in more detail Aug 12, 2020
Comment on lines 49 to 51
## "Butterfly Objects"

One common suggestion is to merge structs and arrays into a single construct with both struct-like fields and a array-like elements.
Copy link
Contributor

Choose a reason for hiding this comment

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

These are not butterfly objects. They are arrays with headers.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed that a butterfly object, by my understanding, extends dynamically in "both directions" which is not what is described below. That being said, just as the current verbiage for flexible aggregates captures "arrays with headers" by allowing flexible aggregates at the end of a struct, you could also imagine allowing flexible aggregates at the beginning of a struct which, with proper care in the subtyping rules, would allow a butterfly implementation. In fact, it would generalize pure butterfly objects by allowing a fixed set of statically-typed fields to be stored in the "middle" of the butterfly object.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, renamed to "arrays with fields".

Comment on lines 171 to 176
With the extension sketched below, it is possible, for example, to represent the equivalent of ["butterfly objects"](#butterfly-objects), by nesting a dynamically-sized array at the end of the struct.
For example:
```
(type $Array (array i32))
(type $Butterfly (struct f32 i64 (type $Array))
```
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a butterfly object. A butterfly has two arrays that spread out from the "center" of the object (one at positive offsets and the other at negative offsets).

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed.


Imported types are essentially parameters to the module.
As such, they are entirely abstract, as far as compile-time validation is concerned.
The only operations possible with them are those that do not require knowledge of their actual definition or size: primarily, passing and storing references to such types.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should mention casting with rtts and with call_indirect.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Comment on lines +500 to +501
- or `ft = (type $t')` and `$l : [(inref $t')]`
- i.e., if the field type is a scalar, pass its value to the label, otherwise an interior reference
Copy link
Contributor

Choose a reason for hiding this comment

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

Clever use of interior references!

Copy link
Member

@lukewagner lukewagner left a comment

Choose a reason for hiding this comment

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

Nice to see these ideas explicated more. lgtm assuming you can address the "butterfly" comments some way or another.

Comment on lines 49 to 51
## "Butterfly Objects"

One common suggestion is to merge structs and arrays into a single construct with both struct-like fields and a array-like elements.
Copy link
Member

Choose a reason for hiding this comment

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

Agreed that a butterfly object, by my understanding, extends dynamically in "both directions" which is not what is described below. That being said, just as the current verbiage for flexible aggregates captures "arrays with headers" by allowing flexible aggregates at the end of a struct, you could also imagine allowing flexible aggregates at the beginning of a struct which, with proper care in the subtyping rules, would allow a butterfly implementation. In fact, it would generalize pure butterfly objects by allowing a fixed set of statically-typed fields to be stored in the "middle" of the butterfly object.

@@ -0,0 +1,563 @@
# GC Post-v1 Extensions

This document discusses various extensions which seem desirable for comprehensive support of GC types, but are intentionally left out of the [MVP](MVP.md), in order to keep its scope manageable.
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps add a sentence to the effect of: "Over the course of implementing and validating the MVP, it is possible that features in this list may be promoted to the MVP if experience shows that MVP performance would not otherwise be viable." ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.


Allocation:

* Allocation instructions like `struct.new` expect initialiser operands for nested aggregates: each individual field for a nested struct, and one initialiser for a nested array (which may itself be a list of initialisers, if the array's element type is a again a struct). Details TBD.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Allocation instructions like `struct.new` expect initialiser operands for nested aggregates: each individual field for a nested struct, and one initialiser for a nested array (which may itself be a list of initialisers, if the array's element type is a again a struct). Details TBD.
* Allocation instructions like `struct.new` expect initialiser operands for nested aggregates: each individual field for a nested struct, and one initialiser for a nested array (which may itself be a list of initialisers, if the array's element type is again a struct). Details TBD.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.


An engine should be able to optimise away intermediate interior pointers very easily.

* TBD: As sketched here, interior references can only point ot nested aggregates. Should there also be interior references to plain fields?
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* TBD: As sketched here, interior references can only point ot nested aggregates. Should there also be interior references to plain fields?
* TBD: As sketched here, interior references can only point to nested aggregates. Should there also be interior references to plain fields?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Unfortunately, hardware differs widely in how many tagging bits a pointer can conveniently support, and different VMs might have additional constraints on how many of these bits they can make available to user code.
In order to provide tagging in a way that is portable but maximally efficient on any given hardware and engine, a somewhat higher level of abstraction is useful.

Such a more high-level solution would be to support a form of _variant types_ (a.k.a. disjoint unions or sum types) in the type system.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Such a more high-level solution would be to support a form of _variant types_ (a.k.a. disjoint unions or sum types) in the type system.
Such a higher-level solution would be to support a form of _variant types_ (a.k.a. disjoint unions or sum types) in the type system.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@rossberg rossberg merged commit c7b22e5 into master Aug 17, 2020
@rossberg rossberg deleted the postmvp branch August 17, 2020 10:37
rossberg added a commit that referenced this pull request Feb 24, 2021
Incorporate active/passive segments into instantiation. While doing so, drop the notion of segment types as well as initelem/initdata administrative instructions and express the latter in terms of table.init and memory.init instructions. Adjust interpreter accordingly.
rossberg added a commit that referenced this pull request Apr 23, 2024
More fixes and tests around element segments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants