Open jdm opened 5 years ago
It does not crash on macOS x86.
Visual C++ on x86 arch uses "thiscall" call convention for member functions.
The struct CustomAutoRooterVFTable as defined in https://github.com/servo/mozjs/blob/master/src/jsgc.rs is missing "thiscall" for x86 windows.
Unfortunately thiscall is only available in unstable rust https://github.com/rust-lang/rust/issues/42202
#[repr(C)]
pub struct CustomAutoRooterVFTable {
#[cfg(windows)]
pub padding: [usize; 1],
#[cfg(not(windows))]
pub padding: [usize; 2],
#[cfg(all(windows, target_pointer_width = "32"))]
pub trace: unsafe extern "thiscall" fn (this: *mut c_void, trc: *mut JSTracer),
#[cfg(not(all(windows, target_pointer_width = "32")))]
pub trace: unsafe extern "C" fn (this: *mut c_void, trc: *mut JSTracer),
}
The crash occurs during the call to JS_GC, which suggests that the AutoGCRooter structure or CustomAutoRooter vtable is not correct for that arch.