-
Notifications
You must be signed in to change notification settings - Fork 821
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
Take into account requirements for "isolate" or single-threaded runtimes #5284
base: wasmer-5.1.0
Are you sure you want to change the base?
Take into account requirements for "isolate" or single-threaded runtimes #5284
Conversation
...since it's not necessarily creating a store anymore.
Note: the removal of the reference for `StoreSnapshots` in `TaskWasm` in favour of an owned value is due to an initial work for making `TaskWasm` `Send` or not leaking references that outlive spawned threads.
#[cfg(feature = "js")] | ||
Self::Js(_) => crate::RuntimeKind::Js, | ||
#[cfg(feature = "jsc")] | ||
Self::Jsc(_) => crate::RuntimeKind::Jsc, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is public, it needs to be #[non_exhaustive]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/api/src/entities/store/inner.rs
Outdated
@@ -19,6 +19,9 @@ pub(crate) struct StoreInner { | |||
pub(crate) on_called: Option<OnCalledHandler>, | |||
} | |||
|
|||
unsafe impl Send for StoreInner {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should very much not have this on the whole StoreInner.
If we need it for one particular variant, it should be on that variant. (v8)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed it in c463031. BTW, v8 is technically the only one that should not be Send
.
let store_ref = store.as_store_ref(); | ||
let v8_store = store_ref.inner.store.as_v8(); | ||
|
||
if v8_store.thread_id != std::thread::current().id() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used a lot... how about making it a method?
task.spawn_type, | ||
task.update_layout, | ||
)?; | ||
//let module = task.module; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -240,6 +240,11 @@ impl crate::Engine { | |||
_ => panic!("Not a `jsc` engine!"), | |||
} | |||
} | |||
|
|||
/// Return true if [`self`] is an engine from the `jsc` runtime. | |||
pub fn is_jsc(&self) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the js engine have a is_jsc method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in jsc/entities/engine.rs
. Am I missing something?
V8 needs Wasm entities to be created in the same thread they run in. This PR moves the creation of said entities down to the
task_wasm
function in WASIX.Caveats
This depends on a build of V8 with shared memory, which is not available yet - that is, running the precise code in this PR with wordpress won't work (again, because the wasm_c_api implementation of V8 does not support shared memories)