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

Update SpiderMonkey to ESR128.0 #474

Merged
merged 31 commits into from
Jul 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0d2fc99
Update docs/version to ESR128
sagudev Jul 9, 2024
ea70da4
Update SpiderMonkey
sagudev Jul 9, 2024
61b0ee8
Update patches
sagudev Jul 9, 2024
843f1ab
Apply all patches except streams
sagudev Jul 9, 2024
78fdab6
Add bidi patch
sagudev Jul 10, 2024
1707b60
Apply bidi patch
sagudev Jul 10, 2024
8e68a36
Streams patch
sagudev Jul 10, 2024
cf02136
Apply streams patch
sagudev Jul 10, 2024
30cb9a4
Add Macos min sdk 14.2 patch
sagudev Jul 10, 2024
23ad4e5
Apply Macos min sdk 14.2 patch
sagudev Jul 10, 2024
ed6bbf3
Moving from 0 based column number to 1 based column number
sagudev Jul 10, 2024
71085cc
Draining stopped in jobqueue
sagudev Jul 10, 2024
098b6b6
Latin1 external strings
sagudev Jul 10, 2024
5ea9c0d
Remove offthread stuff
sagudev Jul 10, 2024
95b5be9
Regen wrappers
sagudev Jul 10, 2024
5f825c3
fix rust code
sagudev Jul 10, 2024
0e5e3c6
Reapply filter
sagudev Jul 10, 2024
0091633
Fix icu linking errors
sagudev Jul 10, 2024
54d19e5
Fix android
sagudev Jul 10, 2024
da2375e
Update ndk to 26 (per SM)
sagudev Jul 10, 2024
89a8119
Fix a test
sagudev Jul 10, 2024
eaf9ed4
Fix wasm test
sagudev Jul 11, 2024
35a78c8
fix integrity check
sagudev Jul 12, 2024
d977698
generalize alignment wrapper
sagudev Jul 12, 2024
bfe26b8
fix wasm
sagudev Jul 12, 2024
9b952b2
Manually create static lib on windows, strip debug symbols and add on…
sagudev Jul 12, 2024
3614575
Wrapper for NewExternalArrayBuffer
sagudev Jul 12, 2024
4a7ca84
fixup 1-origin
sagudev Jul 13, 2024
e6c24b0
filter out zlib
sagudev Jul 11, 2024
4ad5ae1
Use zlib from libz-sys
sagudev Jul 26, 2024
ebb82be
Patch libz-sys
sagudev Jul 27, 2024
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
Prev Previous commit
Next Next commit
Fix wasm test
the content needs to be aligned of 8

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
  • Loading branch information
sagudev committed Jul 27, 2024
commit eaf9ed42ded141ebfcaf97ad9ee26ba4fed9358c
16 changes: 11 additions & 5 deletions mozjs/examples/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! and do some setup on both of these. You also need to enter a "realm"
//! (environment within one global object) before you can execute code.

use ::std::ffi::{c_char, c_uchar};
use ::std::ffi::c_char;
use ::std::ptr;
use ::std::ptr::null_mut;

Expand All @@ -19,6 +19,9 @@ use mozjs::rust::SIMPLE_GLOBAL_CLASS;
use mozjs::rust::{JSEngine, RealmOptions, Runtime};
use mozjs_sys::jsgc::ValueArray;

#[repr(align(8))]
struct Aligned8ByteArray<const N: usize>([u8; N]);

/// hi.wat:
/// ```
/// (module
Expand All @@ -28,12 +31,12 @@ use mozjs_sys::jsgc::ValueArray;
/// call $bar
/// ))
///```
const HI_WASM: [c_uchar; 56] = [
const HI_WASM: Aligned8ByteArray<56> = Aligned8ByteArray([
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x02, 0x60, 0x01, 0x7f, 0x01, 0x7f,
0x60, 0x00, 0x01, 0x7f, 0x02, 0x0b, 0x01, 0x03, 0x65, 0x6e, 0x76, 0x03, 0x62, 0x61, 0x72, 0x00,
0x00, 0x03, 0x02, 0x01, 0x01, 0x07, 0x07, 0x01, 0x03, 0x66, 0x6f, 0x6f, 0x00, 0x01, 0x0a, 0x08,
0x01, 0x06, 0x00, 0x41, 0x2a, 0x10, 0x00, 0x0b,
];
]);

unsafe extern "C" fn bar(_cx: *mut JSContext, argc: u32, vp: *mut Value) -> bool {
let args = CallArgs::from_vp(vp, argc);
Expand Down Expand Up @@ -76,13 +79,16 @@ fn run(rt: Runtime) {
&mut wasm_instance.handle_mut()
));

// ptr needs to be aligned to 8
assert!(HI_WASM.0.as_ptr() as usize % 8 == 0);

// Construct Wasm module from bytes.
rooted!(in(rt.cx()) let mut module = null_mut::<JSObject>());
{
let array_buffer = JS::NewArrayBufferWithUserOwnedContents(
rt.cx(),
HI_WASM.len(),
HI_WASM.as_ptr() as _,
HI_WASM.0.len(),
HI_WASM.0.as_ptr() as _,
);
assert!(!array_buffer.is_null());

Expand Down