Stream: git-wasmtime

Topic: wasmtime / PR #1395 Clean up the use of mutable Entry


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

kubkon opened PR #1395 from mut-cleanup to master:

Until now, several syscalls including fd_pwrite etc. were relying on mutating &mut Entry by mutating its inner file handle. This is unnecessary in almost all cases since all methods mutating std::fs::File in Rust's libstd are also implemented for &std::fs::File. In part, this will prepare us to handle Entrys behind an Rc and RefCell combo.

While here, I've also modified OsHandle in BSD to include RefCell<Option<Dir>> rather than Option<Mutex<Dir>> as was until now. While RefCell could easily be replaced with RefCell, since going multithreading will require a lot of (probably even) conceptual changes to wasi-common, I thought it'd be best not to mix single- with multithreading contexts and swap all places at once when it comes to it. If y'all feel this is not the right approach, lemme know!

I've also had to make some modifications to virtual FS which mainly swapped mutability for interior mutability in places.

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

kubkon requested alexcrichton and iximeow for a review on PR #1395.

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

kubkon requested alexcrichton and iximeow for a review on PR #1395.

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

kubkon edited PR #1395 from mut-cleanup to master:

Until now, several syscalls including fd_pwrite etc. were relying on mutating &mut Entry by mutating its inner file handle. This is unnecessary in almost all cases since all methods mutating std::fs::File in Rust's libstd are also implemented for &std::fs::File. In part, this will prepare us to handle Entrys behind an Rc and RefCell combo.

While here, I've also modified OsHandle in BSD to include RefCell<Option<Dir>> rather than Option<Mutex<Dir>> as was until now. While RefCell could easily be replaced with Mutex, since going multithreading will require a lot of (probably even) conceptual changes to wasi-common, I thought it'd be best not to mix single- with multithreading contexts and swap all places at once when it comes to it. If y'all feel this is not the right approach, lemme know!

I've also had to make some modifications to virtual FS which mainly swapped mutability for interior mutability in places.

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

kubkon edited PR #1395 from mut-cleanup to master:

Until now, several syscalls including fd_pwrite etc. were relying on mutating &mut Entry by mutating its inner file handle. This is unnecessary in almost all cases since all methods mutating std::fs::File in Rust's libstd are also implemented for &std::fs::File. In part, this will prepare us to handle Entrys behind an Rc and RefCell combo.

While here, I've also modified OsHandle in BSD to include RefCell<Option<Dir>> rather than Option<Mutex<Dir>> as was until now. While RefCell could easily be replaced with Mutex, since going multithreading will require a lot of conceptual changes to wasi-common, I thought it'd be best not to mix single- with multithreading contexts and swap all places at once when it comes to it. If y'all feel this is not the right approach, lemme know!

I've also had to make some modifications to virtual FS which mainly swapped mutability for interior mutability in places.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 24 2020 at 20:26):

kubkon edited PR #1395 from mut-cleanup to master:

Until now, several syscalls including fd_pwrite etc. were relying on mutating &mut Entry by mutating its inner file handle. This is unnecessary in almost all cases since all methods mutating std::fs::File in Rust's libstd are also implemented for &std::fs::File. In part, this will prepare us to handle Entrys behind an Rc and RefCell combo.

While here, I've also modified OsHandle in BSD to include RefCell<Option<Dir>> rather than Option<Mutex<Dir>> as was until now. While RefCell could easily be replaced with Mutex, since going multithreading will require a lot of conceptual changes to wasi-common, I thought it'd be best not to mix single- with multithreading contexts and swap all places at once when it comes to it. If y'all feel this is not the right approach, lemme know!

I've also had to make some modifications to virtual FS which mainly swaps mutability for interior mutability in places.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 24 2020 at 20:26):

kubkon edited PR #1395 from mut-cleanup to master:

Until now, several syscalls including fd_pwrite etc. were relying on mutating &mut Entry by mutating its inner file handle. This is unnecessary in almost all cases since all methods mutating std::fs::File in Rust's libstd are also implemented for &std::fs::File. In part, this will prepare us to handle Entrys behind an Rc and RefCell combo.

While here, I've also modified OsHandle in BSD to include RefCell<Option<Dir>> rather than Option<Mutex<Dir>> as was until now. While RefCell could easily be replaced with Mutex, since going multithreading will require a lot of conceptual changes to wasi-common, I thought it'd be best not to mix single- with multithreading contexts and swap all places at once when it comes to it. If y'all feel this is not the right approach, lemme know!

I've also had to make some modifications to virtual FS which mainly swaps mutability for interior mutability in a handful of places.


Last updated: Dec 23 2024 at 12:05 UTC