Stream: git-wasmtime

Topic: wasmtime / PR #1910 Factor Wiggle's wasmtime integration ...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 02:36):

pchickey opened PR #1910 from pch/separate_wasmtime_wiggle_crate to master:

Presently, integrating wiggle with wasmtime is taken care of as a one-off proc macro in wasi-common's wig crate.

It would be ideal to provide a single proc macro that generates the adapter between wiggle::from_witx! -generated code and Wasmtime. This can be used as a substitute for the wig code in wasmtime-wasi, and in other crates.

This PR moves and refactors the wig implementation of this adapter code to be general purpose.

The configuration options for define_struct_for_wiggle are dramatically expanded, and re-use some code and the style of parsing configuration options from wiggle_generate.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 02:36):

pchickey requested alexcrichton for a review on PR #1910.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 02:39):

pchickey edited PR #1910 from pch/separate_wasmtime_wiggle_crate to master:

Presently, integrating wiggle with wasmtime is taken care of as a one-off proc macro in wasi-common's wig crate.

It would be ideal to provide a single proc macro that generates the adapter between wiggle::from_witx! -generated code and Wasmtime. This can be used as a substitute for the wig code in wasmtime-wasi, and in other crates.

The design of this crate is based on (lucet-wiggle)[https://github.com/bytecodealliance/lucet/tree/master/lucet-wiggle], which provides the same adapter between wiggle and lucet-runtime.

This PR moves and refactors the wig implementation of this adapter code to be general purpose.

The configuration options for define_struct_for_wiggle are dramatically expanded, and re-use some code and the style of parsing configuration options from wiggle_generate.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 02:42):

pchickey edited PR #1910 from pch/separate_wasmtime_wiggle_crate to master:

Presently, integrating wiggle with wasmtime is taken care of as a one-off proc macro in wasi-common's wig crate.

It would be ideal to provide a single proc macro that generates the adapter between wiggle::from_witx! -generated code and Wasmtime. This can be used as a substitute for the wig code in wasmtime-wasi, and in other crates.

The design of this crate is based on lucet-wiggle, which provides the same adapter between wiggle and lucet-runtime.

This PR moves and refactors the wig implementation of this adapter code to be general purpose.

The configuration options for define_struct_for_wiggle are dramatically expanded, and re-use some code and the style of parsing configuration options from wiggle_generate.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 19:30):

alexcrichton submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 19:30):

alexcrichton created PR Review Comment:

Technically this isn't quite true since wasi-common supports virtual handles, right?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 19:30):

alexcrichton submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 20:36):

pchickey created PR Review Comment:

The Handle trait doesn't expose GuestPtr or any types which contain one, so I think technically we are ok. All of the interesting uses of GuestPtr get translated into std::io::IoSlice{Mut} before being passed to the Handle methods.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 20:36):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 21:21):

alexcrichton submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 21:21):

alexcrichton created PR Review Comment:

I'm not necessarily worried about GuestPtr, moreso that if you run arbitrary code it could reenter wasm which could invalidate GuestPtr values on the stack previously. The Handle type I think can run arbitrary code, right? (and internally it can call something which reenters the original wasm module)

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 21:46):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 21:46):

pchickey created PR Review Comment:

Ah, right, I forgot about that aspect. Yes, Handle impls can execute whatever code they like, so it is definitely possible for them to re-enter the instance. That means we should be finding some way to provide a BorrowChecker that has the same lifetime as the instance, because the lifetime of the call into these functions is no longer sufficient.

I'm not sure how to do that, but I can fix it in this PR if you can outline how I should, or we can leave it for a separate PR.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 22:27):

pchickey updated PR #1910 from pch/separate_wasmtime_wiggle_crate to master:

Presently, integrating wiggle with wasmtime is taken care of as a one-off proc macro in wasi-common's wig crate.

It would be ideal to provide a single proc macro that generates the adapter between wiggle::from_witx! -generated code and Wasmtime. This can be used as a substitute for the wig code in wasmtime-wasi, and in other crates.

The design of this crate is based on lucet-wiggle, which provides the same adapter between wiggle and lucet-runtime.

This PR moves and refactors the wig implementation of this adapter code to be general purpose.

The configuration options for define_struct_for_wiggle are dramatically expanded, and re-use some code and the style of parsing configuration options from wiggle_generate.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 22:28):

pchickey updated PR #1910 from pch/separate_wasmtime_wiggle_crate to master:

Presently, integrating wiggle with wasmtime is taken care of as a one-off proc macro in wasi-common's wig crate.

It would be ideal to provide a single proc macro that generates the adapter between wiggle::from_witx! -generated code and Wasmtime. This can be used as a substitute for the wig code in wasmtime-wasi, and in other crates.

The design of this crate is based on lucet-wiggle, which provides the same adapter between wiggle and lucet-runtime.

This PR moves and refactors the wig implementation of this adapter code to be general purpose.

The configuration options for define_struct_for_wiggle are dramatically expanded, and re-use some code and the style of parsing configuration options from wiggle_generate.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2020 at 23:29):

pchickey updated PR #1910 from pch/separate_wasmtime_wiggle_crate to master:

Presently, integrating wiggle with wasmtime is taken care of as a one-off proc macro in wasi-common's wig crate.

It would be ideal to provide a single proc macro that generates the adapter between wiggle::from_witx! -generated code and Wasmtime. This can be used as a substitute for the wig code in wasmtime-wasi, and in other crates.

The design of this crate is based on lucet-wiggle, which provides the same adapter between wiggle and lucet-runtime.

This PR moves and refactors the wig implementation of this adapter code to be general purpose.

The configuration options for define_struct_for_wiggle are dramatically expanded, and re-use some code and the style of parsing configuration options from wiggle_generate.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2020 at 00:42):

pchickey updated PR #1910 from pch/separate_wasmtime_wiggle_crate to master:

Presently, integrating wiggle with wasmtime is taken care of as a one-off proc macro in wasi-common's wig crate.

It would be ideal to provide a single proc macro that generates the adapter between wiggle::from_witx! -generated code and Wasmtime. This can be used as a substitute for the wig code in wasmtime-wasi, and in other crates.

The design of this crate is based on lucet-wiggle, which provides the same adapter between wiggle and lucet-runtime.

This PR moves and refactors the wig implementation of this adapter code to be general purpose.

The configuration options for define_struct_for_wiggle are dramatically expanded, and re-use some code and the style of parsing configuration options from wiggle_generate.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2020 at 01:11):

pchickey updated PR #1910 from pch/separate_wasmtime_wiggle_crate to master:

Presently, integrating wiggle with wasmtime is taken care of as a one-off proc macro in wasi-common's wig crate.

It would be ideal to provide a single proc macro that generates the adapter between wiggle::from_witx! -generated code and Wasmtime. This can be used as a substitute for the wig code in wasmtime-wasi, and in other crates.

The design of this crate is based on lucet-wiggle, which provides the same adapter between wiggle and lucet-runtime.

This PR moves and refactors the wig implementation of this adapter code to be general purpose.

The configuration options for define_struct_for_wiggle are dramatically expanded, and re-use some code and the style of parsing configuration options from wiggle_generate.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2020 at 15:04):

alexcrichton submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2020 at 15:04):

alexcrichton created PR Review Comment:

There's a number of ways that we could do this, but I don't think any of them are relatively easy. What we probably want to do is to integrate this into wasmtime-the-crate itself, and that way entering into wasm could always check to make sure there are no active borrows because we have tight control over the wasm entry points.

Perhaps we could have a discussion in an issue about how to best integrate this tightly with the wasmtime crate itself? I feel like borrowing from guest memory is so common it's justified to put this in the core functionality.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2020 at 19:47):

pchickey updated PR #1910 from pch/separate_wasmtime_wiggle_crate to master:

Presently, integrating wiggle with wasmtime is taken care of as a one-off proc macro in wasi-common's wig crate.

It would be ideal to provide a single proc macro that generates the adapter between wiggle::from_witx! -generated code and Wasmtime. This can be used as a substitute for the wig code in wasmtime-wasi, and in other crates.

The design of this crate is based on lucet-wiggle, which provides the same adapter between wiggle and lucet-runtime.

This PR moves and refactors the wig implementation of this adapter code to be general purpose.

The configuration options for define_struct_for_wiggle are dramatically expanded, and re-use some code and the style of parsing configuration options from wiggle_generate.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2020 at 21:34):

pchickey updated PR #1910 from pch/separate_wasmtime_wiggle_crate to master:

Presently, integrating wiggle with wasmtime is taken care of as a one-off proc macro in wasi-common's wig crate.

It would be ideal to provide a single proc macro that generates the adapter between wiggle::from_witx! -generated code and Wasmtime. This can be used as a substitute for the wig code in wasmtime-wasi, and in other crates.

The design of this crate is based on lucet-wiggle, which provides the same adapter between wiggle and lucet-runtime.

This PR moves and refactors the wig implementation of this adapter code to be general purpose.

The configuration options for define_struct_for_wiggle are dramatically expanded, and re-use some code and the style of parsing configuration options from wiggle_generate.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2020 at 21:52):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2020 at 21:52):

pchickey created PR Review Comment:

https://github.com/bytecodealliance/wasmtime/issues/1917

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2020 at 21:52):

pchickey has marked PR #1910 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2020 at 21:52):

pchickey requested alexcrichton for a review on PR #1910.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2020 at 14:20):

alexcrichton submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2020 at 16:34):

pchickey merged PR #1910.


Last updated: Dec 23 2024 at 12:05 UTC