Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Get more CI passing#19

Merged
dhil merged 2 commits intoeffect-handlers:function-referencesfrom
alexcrichton:function-refernces
Apr 20, 2023
Merged

Get more CI passing#19
dhil merged 2 commits intoeffect-handlers:function-referencesfrom
alexcrichton:function-refernces

Conversation

@alexcrichton
Copy link
Copy Markdown

A few minor changes to surface failing tests on CI.

Copy link
Copy Markdown

@dhil dhil left a comment

Choose a reason for hiding this comment

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

Thanks!

@dhil dhil merged commit 196ed98 into effect-handlers:function-references Apr 20, 2023
dhil pushed a commit that referenced this pull request May 16, 2023
* Fix prints in non-command builds

When the `command` entrypoint isn't invoked, such as for non-command
builds, then prints were not working as they would return `ERRNO_BADF`
which is swallowed by at least Rust right now. This instead sets the
initialization of `State` to reflect how fd 0 is an empty stdin stream,
fd 1 goes to a `log` call, and fd 2 also goes to `log`. During `command`
initialization fds 0 and 1 are overwritten with the provided input and
for non-command builds this is the state permanently for the program.

It's possible we can add further configuration hooks for this in the
future, but this should get at least the initial state of non-command
builds more workable.

* Use BADF for reading log fds
dhil added a commit that referenced this pull request May 29, 2023
* Make wasmtime-types type check

* Make wasmtime-environ type check.

* Make wasmtime-runtime type check

* Make cranelift-wasm type check

* Make wasmtime-cranelift type check

* Make wasmtime type check

* Make wasmtime-wast type check

* Make testsuite compile

* Address Luna's comments

* Restore compatibility with effect-handlers/wasm-tools#func-ref-2

* Add function refs feature flag; support testing

* Provide function references support in helpers

- Always support Index in blocktypes
- Support Index as table type by pretending to be Func
- Etc

* Implement ref.as_non_null

* Add br_on_null

* Update Cargo.lock to use wasm-tools with peek

This will ultimately be reverted when we refer to
wasm-tools#function-references, which doesn't have peek, but does have type
annotations on CallRef

* Add call_ref

* Support typed function references in ref.null

* Implement br_on_non_null

* Remove extraneous flag; default func refs false

* Use IndirectCallToNull trap code for call_ref

* Factor common call_indirect / call_ref into a fn

* Remove copypasta clippy attribute / format

* Add a some more tests for typed table instructions

There certainly need to be many more, but this at least catches the bugs fixed
in the next commit

* Fix missing typed cases for table_grow, table_fill

* Document trap code; remove answered question

* Mark wasm-tools to wasmtime reftype infallible

* Fix reversed conditional

* Scope externref/funcref shorthands within WasmRefType

* Merge with upstream

* Make wasmtime compile again

* Fix warnings

* Remove Bot from the type algebra

* Fix table tests.

`wast::Cranelift::spec::function_references::table`
`wast::Cranelift::spec::function_references::table_pooling`

* Fix table{get,set} tests.

```
wast::Cranelift::misc::function_references::table_get
wast::Cranelift::misc::function_references::table_get_pooling
wast::Cranelift::misc::function_references::table_set
wast::Cranelift::misc::function_references::table_set_pooling
```

* Insert subtype check to fix local_get tests.

```
wast::Cranelift::spec::function_references::local_get
wast::Cranelift::spec::function_references::local_get_pooling
```

* Fix compilation of `br_on_non_null`.

The branch destinations were the other way round... :-)

Fixes the following test failures:
```
wast::Cranelift::spec::function_references::br_on_non_null
wast::Cranelift::spec::function_references::br_on_non_null_pooling
```

* Fix ref_as_non_null tests.

The test was failing due to the wrong error message being printed. As
per upstream folks' suggest we were using the trap code
`IndirectCallToNull`, but it produces an unexpected error message.

This commit reinstates the `NullReference` trap code. It produces the
expected error message. We will have to chat with the maintainers
upstream about how to handle these "test failures".

Fixes the following test failures:

```
wast::Cranelift::spec::function_references::ref_as_non_null
wast::Cranelift::spec::function_references::ref_as_non_null_pooling
```

* Fix a call_ref regression.

* Fix global tests.

Extend `is_matching_assert_invalid_error_message` to circumvent the textual error message failure.

Fixes the following test failures:
```
wast::Cranelift::spec::function_references::global
wast::Cranelift::spec::function_references::global_pooling
```

* Cargo update

* Update

* Spell out some cases in match_val

* Disgusting hack to subvert limitations of type reconstruction.

In the function `wasmtime::values::Val::ty()` attempts to reconstruct
the type of its underlying value purely based on the shape of the
value. With function references proposal this sort of reconstruction
is no longer complete as a source reference type may have been
nullable. Nullability is not inferrable by looking at the shape of the
runtime object alone.

Consequently, the runtime cannot reconstruct the type for
`Val::FuncRef` and `Val::ExternRef` by looking at their respective
shapes.

* Address workflows comments.

* null reference => null_reference for CLIF parsing compliance.

* Delete duplicate-loads-dynamic-memory-egraph (again)

* Idiomatic code change.

* Nullability subtyping + fix non-null storage check.

This commit removes the `hacky_eq` check in `func.rs`. Instead it is
replaced by a subtype check. This subtype check occurs in
`externals.rs` too.

This commit also fixes a bug. Previously, it was possible to store a
null reference into a non-null table cell. I have added to new test
cases for this bug: one for funcrefs and another for externrefs.

* Trigger unimplemented for typed function references. Format values.rs

* run cargo fmt

* Explicitly match on HeapType::Extern.

* Address cranelift-related feedback

* Remove PartialEq,Eq from ValType, RefType, HeapType.

* Pin wasmparser to a fairly recent commit.

* Run cargo fmt

* Ignore tail call tests.

* Remove garbage

* Revert changes to wasmtime public API.

* Run cargo fmt

* Get more CI passing (#19)

* Undo Cargo.lock changes

* Fix build of cranelift tests

* Implement link-time matches relation. Disable tests failing due to lack of public API support.

* Run cargo fmt

* Run cargo fmt

* Initial implementation of eager table initialization

* Tidy up eager table initialisation

* Cargo fmt

* Ignore type-equivalence test

* Replace TODOs with descriptive comments.

* Various changes found during review (#21)

* Clarify a comment

This isn't only used for null references

* Resolve a TODO in local init

Don't initialize non-nullable locals to null, instead skip
initialization entirely and wasm validation will ensure it's always
initialized in the scope where it's used.

* Clarify a comment and skipping the null check.

* Remove a stray comment

* Change representation of `WasmHeapType`

Use a `SignatureIndex` instead of a `u32` which while not 100% correct
should be more correct. This additionally renames the `Index` variant to
`TypedFunc` to leave space for future types which aren't functions to
not all go into an `Index` variant.

This required updates to Winch because `wasmtime_environ` types can no
longer be converted back to their `wasmparser` equivalents. Additionally
this means that all type translation needs to go through some form of
context to resolve indices which is now encapsulated in a `TypeConvert`
trait implemented in various locations.

* Refactor table initialization

Reduce some duplication and simplify some data structures to have a more
direct form of table initialization and a bit more graceful handling of
element-initialized tables. Additionally element-initialize tables are
now treated the same as if there's a large element segment initializing
them.

* Clean up some unrelated chagnes

* Simplify Table bindings slightly

* Remove a no-longer-needed TODO

* Add a FIXME for `SignatureIndex` in `WasmHeapType`

* Add a FIXME for panicking on exposing function-references types

* Fix a warning on nightly

* Fix tests for winch and cranelift

* Cargo fmt

* Fix arity mismatch in aarch64/abi

---------

Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@huawei.com>
Co-authored-by: Alex Crichton <alex@alexcrichton.com>
@alexcrichton alexcrichton deleted the function-refernces branch June 12, 2023 18:20
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.

2 participants