You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spidermonkey's jsval type is a union of size 64 bits. We represent this as struct JSVal { val: u64 } in Rust. This works great on 64bit platforms.
On 32bit platforms, the jsval values get mangled when passed to the C library functions. This seems to be an ABI issue. We've encountered this before with servo/servo#467 which was about 32bit ARM.
We were correctly determining the attributes needed for the parameters for extern fns, but when that extern fn was from another crate we never bothered to pass that information along to LLVM. (i.e never called `foreign::add_argument_attributes`).
I've just changed both local and non-local (crate) extern fn's to be dealt with together (through `foreign::register_foreign_item_fn`) so we don't run into something like again.
Fixes#14177.
…nsion, r=Veykril
Filter builtin macro expansion
This PR adds a filter on the types of built in macros that are allowed to be expanded.
Currently, This list of allowed macros contains, `stringify, cfg, core_panic, std_panic, concat, concat_bytes, include, include_str, include_bytes, env` and `option_env`.
Fixesrust-lang#14177
Spidermonkey's
jsval
type is a union of size 64 bits. We represent this asstruct JSVal { val: u64 }
in Rust. This works great on 64bit platforms.On 32bit platforms, the
jsval
values get mangled when passed to the C library functions. This seems to be an ABI issue. We've encountered this before with servo/servo#467 which was about 32bit ARM.This gist contains sample programs and the generated IR for minimal test programs using rust-mozjs: https://gist.github.com/metajack/ddc94ef7e8e3ed838054
Note that you will need my 32bit branch of rust-mozjs: https://github.com/metajack/rust-mozjs/tree/build-32bit
You can put debugging printfs in
jsapi.cpp
inJS_SetReservedSlot
to see the value on the C side.The only notable thing I see in the IR is that the clang IR has
byval
when passing thejsval
.This seems like a Rust bug, but I'd also be interested if there is a workaround that will work on all platforms.
The text was updated successfully, but these errors were encountered: