-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add ability to set stack size for spawned threads #3995
Conversation
@@ -52,7 +52,7 @@ pub fn get_shadow_stack_pointer(module: &Module) -> Option<GlobalId> { | |||
match candidates.len() { | |||
0 => None, | |||
// TODO: have an actual check here. | |||
1 => Some(candidates[0].id()), | |||
1 | 2 => Some(candidates[0].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.
Is there some other/better way to find this now?
8ff0ff8
to
96e5541
Compare
@@ -442,7 +472,7 @@ fn inject_destroy( | |||
}, | |||
); | |||
|
|||
let destroy_id = builder.finish(Vec::new(), &mut module.funcs); | |||
let destroy_id = builder.finish(vec![tls_base, stack_alloc, stack_size], &mut module.funcs); |
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.
I only added the last parameter, the first two locals were just not assigned.
So I guess __wbindgen_thread_destroy()
didn't work until now when called for another thread.
Changing the parameters on |
Hi, I stumbled across this commit as consequence of |
You mean it is emitting a warning when you pass nothing? I will check whats going on exactly and make a PR to fix this. |
Yeah, I believe is due to this check here: wasm-bindgen/crates/cli-support/src/js/mod.rs Line 895 in d813df7
|
I am currently using wasm-pack --target no-modules with wasm_bindgen(ArrayBuffer_of_wasm_bg_binary);. The reason I use --target no-modules is that I want to deploy just a single .js file, so I keep ArrayBuffer_of_wasm_bg_binary in a code variable. I'm not using the ESM version for this same reason—because I need a single .js file. Therefore, in my use case, there's no extra .wasm file either. I received the deprecated warning, which led me to this page. Could we keep the legacy API (i.e., not deprecate it) and instead add new options in the second parameter? Since the new Initialize function favors a parameter-less approach, the parameter-less way might not be affected by this change. can we overload default() parameter like this ( at lease for --target no-modules option ) wasm_bindgen(); //new initialize way //For legacy support, can we avoid deprecating this //extend legacy support |
From your post I was unable to tell why the new API doesn't work for you. E.g. in your case: // old API:
wasm_bindgen(your_array_buffer);
// new API:
wasm_bindgen({ module_or_path: your_array_buffer }); |
Thank you for your reply. I am currently use this method Will I found the following documentation on this topic: Without a Bundler. However, I can’t find specific documentation on the correct way to initialize with Almost every new example uses initialization without parameters. |
It already is!
Unfortunately documentation is pretty lacking on this right now, it should definitely be improved!
This is a bug! |
This does a couple of things:
default()
andinitSync()
to take an object and moving all parameters into that object. The old signature still works, but is deprecated. This lets us add additional parameters without breaking changes.thread_stack_size
todefault()
andinitSync()
, to let the user set the thread stack size.__wbindgen_thread_destroy()
to take an additional parameter specifying the thread stack size. This only comes into play when destroying other threads, when destroying the current thread, by passing no parameters, the correct thread stack size is determined internally.__wbindgen_thread_destroy()
ignoring parameters. Though I'm not exactly sure how not setting the correct locals to be parameters when building the function actually played out in reality.