Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dash fixes and pthreads #3663

Merged
merged 70 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
dd8c902
Fixed the signals and error codes
john-sharratt Mar 3, 2023
e39c438
Staging changes ready for WASIX syscall changes
john-sharratt Mar 3, 2023
1eba7cf
Fixed the proc_join syscall
john-sharratt Mar 3, 2023
010e7a2
Added the missing join flags to proc_join
john-sharratt Mar 3, 2023
f365bb6
Added extra debug information on the closing of files
john-sharratt Mar 3, 2023
5c2f001
Added the new thread start routines
john-sharratt Mar 6, 2023
65eed0d
Implemented the threads spec (pthreads) for WASIX
john-sharratt Mar 6, 2023
949a4bd
Merge branch 'master' into dash-fixes
john-sharratt Mar 6, 2023
33d87eb
Merge branch 'master' into dash-fixes
john-sharratt Mar 7, 2023
ea76a73
Merge remote-tracking branch 'origin' into dash-fixes
john-sharratt Mar 7, 2023
be5242d
Now implementing TTY and getcwd properly which is needed for bash and…
john-sharratt Mar 7, 2023
e4187d7
Restructured the subprocesses so that they will be easier to join on
john-sharratt Mar 7, 2023
b881e5b
Joining an an explicit process will now remove it as a child and be r…
john-sharratt Mar 7, 2023
90bedfc
Fixed the TTY for both dash and bash
john-sharratt Mar 7, 2023
5442c48
Fixes for the dash and bash snapshot tests
john-sharratt Mar 8, 2023
dc8f86e
Fixed the snapshot tests
john-sharratt Mar 9, 2023
1c85b34
Removed tracing dependency that should not have been added
john-sharratt Mar 9, 2023
80b10fc
Updates for the review comments
john-sharratt Mar 9, 2023
4abbec7
Merge remote-tracking branch 'origin/master' into dash-fixes-and-pthr…
john-sharratt Mar 9, 2023
dbacbb9
refactor(wasi): Move capabilities into root submodule
theduke Mar 8, 2023
6009b05
Fixed the joining of subprocesses which was blocking due to a race co…
john-sharratt Mar 10, 2023
1e68b6f
Fixed the lint errors
john-sharratt Mar 10, 2023
1a19cbc
Fixes so that windows compiles again with the new TTY changes
john-sharratt Mar 10, 2023
761fff3
More lint and non-unix compile fixes
john-sharratt Mar 10, 2023
86e0ad0
Fixed the last snapshot integration tests
john-sharratt Mar 10, 2023
981962a
cargo fmt --all
john-sharratt Mar 10, 2023
1dfddf8
No longer causing a panic when globals are set to null in JS
john-sharratt Mar 10, 2023
6308144
Fixed create-exe WASI programs that will fail to exit properly
ptitSeb Mar 10, 2023
a41bf19
Refactored the exit codes so they can be strongly typed and arbitary
john-sharratt Mar 11, 2023
7e0055b
Clippy fixes
john-sharratt Mar 11, 2023
5f3619b
More lint fixes
john-sharratt Mar 11, 2023
e38fd33
On single threading apps the PID == TID
john-sharratt Mar 11, 2023
beadf18
Fixed a memory corruption issue due to an incorrectly implemented mem…
john-sharratt Mar 11, 2023
6f69912
Fix for partially written files which cause the snapshot tests to fail
john-sharratt Mar 11, 2023
dce7aaa
Fixed an issue with the forking fixes on JS builds
john-sharratt Mar 11, 2023
665230f
Improvements to the snapshot tests and added extra validation of the …
john-sharratt Mar 11, 2023
61d0972
Improved the fork and fork-longjmp unit tests
john-sharratt Mar 11, 2023
09c6805
The snapshot tests now order the debug messages for consistency and r…
john-sharratt Mar 11, 2023
d1dc0fd
Fork snapshot tests now check the exit code on subprocesses
john-sharratt Mar 11, 2023
7b8fcff
Added extra validations on the fork unit test and some stability to t…
john-sharratt Mar 11, 2023
e0d884b
Fixed an issue where the exit codes were not being properly returned …
john-sharratt Mar 11, 2023
f39353b
Fixed some linting issues
john-sharratt Mar 11, 2023
8b21135
Added some extra parameters to pass to the web threading pool
john-sharratt Mar 12, 2023
43052d2
fix(wasi): Fix TaskJoinHandle::set_finished
theduke Mar 13, 2023
0c88654
Merge branch 'capability-threading' into deploy
theduke Mar 13, 2023
f32ed3b
Merge remote-tracking branch 'origin/master' into dash-fixes-and-pthr…
theduke Mar 13, 2023
46a0388
Merge branch 'master' into deploy
john-sharratt Mar 14, 2023
02fc138
Merge branch 'deploy' of github.com:wasmerio/wasmer into deploy
john-sharratt Mar 14, 2023
e13b5a1
Merge branch 'dash-fixes-and-pthreads' of github.com:wasmerio/wasmer …
john-sharratt Mar 14, 2023
3c57b84
Merge branch 'vectored-io-fix' into dash-fixes-and-pthreads
john-sharratt Mar 14, 2023
ca7be7a
Merge branch 'master' into dash-fixes-and-pthreads
john-sharratt Mar 15, 2023
76ca48b
Added tests for python in dash and bash and reenabled the vfork test
john-sharratt Mar 14, 2023
9c20584
Merge branch 'master' into dash-fixes-and-pthreads
john-sharratt Mar 16, 2023
e1fe620
Now using real temporary files that are unique to prevent a concurren…
john-sharratt Mar 16, 2023
0537a7c
Merge branch 'dash-fixes-and-pthreads' of github.com:wasmerio/wasmer …
john-sharratt Mar 16, 2023
8312c2e
Fixes for snapshot tests
john-sharratt Mar 16, 2023
987bc4a
Fixed a bug where the signals were not being properly processed
john-sharratt Mar 16, 2023
d7e2129
Added more snapshot tests for different scenarios
john-sharratt Mar 16, 2023
0b8d2b1
Added more tests for the dev files and added urandom support
john-sharratt Mar 16, 2023
21023a3
Added a HTTP server snapshot test
john-sharratt Mar 16, 2023
3ba3f41
Merge branch 'master' into dash-fixes-and-pthreads
john-sharratt Mar 16, 2023
7afc869
Merge branch 'master' into dash-fixes-and-pthreads
john-sharratt Mar 16, 2023
461c208
Moved the process exit to after the WASI cleanup and added some flush…
john-sharratt Mar 16, 2023
781d861
Added the ability to supply ones own webc packages to wasmer
john-sharratt Mar 16, 2023
34486b7
Updated the snapshot tests with the first part of offline webc packag…
john-sharratt Mar 16, 2023
e2bf8de
Merge branch 'master' into dash-fixes-and-pthreads
john-sharratt Mar 16, 2023
739aa0c
Snapshot tests can now work offline and are more deterministic
john-sharratt Mar 16, 2023
1531645
Fixed linting issues
john-sharratt Mar 16, 2023
fc7a5ad
Fixed the error code check - someone really needs to refactor this
john-sharratt Mar 16, 2023
bdc41ec
Targeting environments that the snapshot tests work on
john-sharratt Mar 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions lib/api/src/function_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,12 @@ pub struct FunctionEnvMut<'a, T: 'a> {
pub(crate) func_env: FunctionEnv<T>,
}

impl<'a, T> Debug for FunctionEnvMut<'a, T> {
impl<'a, T> Debug for FunctionEnvMut<'a, T>
where
T: Send + Debug + 'static,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "env_mut")
self.func_env.as_ref(&self.store_mut).fmt(f)
}
}

Expand Down
10 changes: 5 additions & 5 deletions lib/api/src/js/externals/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ impl Global {
let ty = self.handle.ty;
let raw = match ty.ty {
Type::I32 => RawValue {
i32: value.as_f64().unwrap() as _,
i32: value.as_f64().unwrap_or_default() as _,
},
Type::I64 => RawValue {
i64: value.as_f64().unwrap() as _,
i64: value.as_f64().unwrap_or_default() as _,
},
Type::F32 => RawValue {
f32: value.as_f64().unwrap() as _,
f32: value.as_f64().unwrap_or_default() as _,
},
Type::F64 => RawValue {
f64: value.as_f64().unwrap(),
f64: value.as_f64().unwrap_or_default(),
},
Type::V128 => RawValue {
u128: value.as_f64().unwrap() as _,
u128: value.as_f64().unwrap_or_default() as _,
},
Type::FuncRef => {
unimplemented!();
Expand Down
6 changes: 6 additions & 0 deletions lib/api/src/js/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ pub struct Module {
unsafe impl Send for Module {}
unsafe impl Sync for Module {}

impl From<Module> for JsValue {
fn from(val: Module) -> Self {
Self::from(val.module)
}
}

impl Module {
pub(crate) fn from_binary(
_engine: &impl AsEngineRef,
Expand Down
13 changes: 10 additions & 3 deletions lib/api/src/js/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ impl VMMemory {
pub fn duplicate(&self) -> Result<VMMemory, wasmer_types::MemoryError> {
let new_memory = crate::js::externals::memory::Memory::js_memory_from_type(&self.ty)?;

#[cfg(feature = "tracing")]
trace!("memory copy started");

let src = crate::js::externals::memory_view::MemoryView::new_raw(&self.memory);
let amount = src.data_size() as usize;

#[cfg(feature = "tracing")]
trace!(%amount, "memory copy started");

let mut dst = crate::js::externals::memory_view::MemoryView::new_raw(&new_memory);
let dst_size = dst.data_size() as usize;

Expand Down Expand Up @@ -111,6 +112,12 @@ impl From<VMMemory> for JsValue {
}
}

impl From<VMMemory> for (JsValue, MemoryType) {
fn from(value: VMMemory) -> Self {
(JsValue::from(value.memory), value.ty)
}
}

/// The shared memory is the same as the normal memory
pub type VMSharedMemory = VMMemory;

Expand Down
7 changes: 7 additions & 0 deletions lib/api/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,10 @@ impl fmt::Debug for Module {
.finish()
}
}

#[cfg(feature = "js")]
impl From<Module> for wasm_bindgen::JsValue {
fn from(value: Module) -> Self {
wasm_bindgen::JsValue::from(value.0)
}
}
12 changes: 8 additions & 4 deletions lib/api/src/sys/mem_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ where
.ok_or(MemoryAccessError::Overflow)?;
if end > slice.buffer.0.len as u64 {
#[cfg(feature = "tracing")]
warn!(
tracing::warn!(
"attempted to read ({} bytes) beyond the bounds of the memory view ({} > {})",
total_len, end, slice.buffer.0.len
total_len,
end,
slice.buffer.0.len
);
return Err(MemoryAccessError::HeapOutOfBounds);
}
Expand Down Expand Up @@ -47,9 +49,11 @@ where
.ok_or(MemoryAccessError::Overflow)?;
if end > ptr.buffer.0.len as u64 {
#[cfg(feature = "tracing")]
warn!(
tracing::warn!(
"attempted to read ({} bytes) beyond the bounds of the memory view ({} > {})",
total_len, end, ptr.buffer.0.len
total_len,
end,
ptr.buffer.0.len
);
return Err(MemoryAccessError::HeapOutOfBounds);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ default = [
"wasmer-artifact-create",
"static-artifact-create",
"webc_runner",
"tracing"
"tracing",
]
cache = ["wasmer-cache"]
cache-blake3-pure = ["wasmer-cache/blake3-pure"]
Expand Down
Loading