Stream: git-wasmtime

Topic: wasmtime / PR #9681 [RFC] Move MemoryImageSource::map_at ...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 06:03):

sunshowers edited PR #9681.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 06:10):

sunshowers edited PR #9681:

This is part of the work to centralize memory management into the mmap
module. This commit introduces a few structures which aid in that process, and
starts converting one of the functions (MemoryImageSource::map_at) into this
module.

The structures introduced are:

On Zulip there was a suggestion to use Arc<Mmap> rather than a lifetime
parameter. To be honest it's quite appealing! One of the challenges though
is that Mmap has several &mut methods. The methods fall into two categories:

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 06:53):

sunshowers commented on PR #9681:

Methods like slice_mut, which are quite difficult to turn into &self methods. It would be too easy to call self.slice_mut(0..host_page_size()); self.slice_mut(0..host_page_size()); and cause an insta-UB. I spent some time looking at how to do this but found it too difficult :(

Ah interesting, it looks like the only seriously affected use is in some tests.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 06:53):

sunshowers edited a comment on PR #9681:

Methods like slice_mut, which are quite difficult to turn into &self methods. It would be too easy to call self.slice_mut(0..host_page_size()); self.slice_mut(0..host_page_size()); and cause an insta-UB. I spent some time looking at how to do this but found it too difficult :(

Ah interesting, it looks like the only seriously affected use is in some tests. Maybe this is more feasible than I think.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 07:03):

sunshowers commented on PR #9681:

Moving to draft for now -- I think Arc is possible to make work.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 07:06):

sunshowers closed without merge PR #9681.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 26 2024 at 07:06):

sunshowers commented on PR #9681:

Yeah Arc is definitely possible -- going to re-do this after moving over to Arc.


Last updated: Dec 23 2024 at 12:05 UTC