Skip to content

Commit 26511b1

Browse files
committed
Revert "[DO NOT MERGE] Revert "Work around broken Windows ABI issues for off thread compilation API.""
This reverts commit 6f3f382.
1 parent b740937 commit 26511b1

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

mozjs/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ const BLACKLIST_FUNCTIONS: &'static [&'static str] = &[
387387
"JS_GetPropertyDescriptor",
388388
"JS_GetUCPropertyDescriptor",
389389
"js::SetPropertyIgnoringNamedGetter",
390+
"JS::FinishOffThreadStencil",
390391
];
391392

392393
/// Types that should be treated as an opaque blob of bytes whenever they show

rust-mozjs/src/glue.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use jsapi::*;
2+
use jsapi::js::frontend::CompilationStencil;
23
use std::os::raw::{c_char, c_void};
34
use std::{mem, ptr};
45

@@ -609,4 +610,10 @@ extern "C" {
609610
value: HandleValue,
610611
attrs: u32,
611612
);
613+
pub fn FinishOffThreadStencil(
614+
cx: *mut JSContext,
615+
token: *mut OffThreadToken,
616+
storage: *mut InstantiationStorage,
617+
out: *mut already_AddRefed<CompilationStencil>,
618+
);
612619
}

rust-mozjs/src/glue_wrappers.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ wrap!(glue: pub fn JS_GetPromiseResult(promise: HandleObject, dest: MutableHandl
1919
wrap!(glue: pub fn JS_GetScriptPrivate(script: *mut JSScript, dest: MutableHandleValue));
2020
wrap!(glue: pub fn JS_GetModulePrivate(module: *mut JSObject, dest: MutableHandleValue));
2121
wrap!(glue: pub fn EncodeStringToUTF8(cx: *mut JSContext, str: HandleString, cb: fn(*const c_char)));
22-
wrap!(glue: pub fn SetDataPropertyDescriptor(desc: MutableHandle<PropertyDescriptor>, value: HandleValue, attrs: u32));
22+
wrap!(glue: pub fn SetDataPropertyDescriptor(desc: MutableHandle<PropertyDescriptor>, value: HandleValue, attrs: u32));
23+
wrap!(glue: pub fn FinishOffThreadStencil(cx: *mut JSContext, token: *mut OffThreadToken, storage: *mut InstantiationStorage, out: *mut already_AddRefed<CompilationStencil>));

rust-mozjs/src/jsglue.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "js/StructuredClone.h"
2929
#include "js/Wrapper.h"
3030
#include "js/experimental/JitInfo.h"
31+
#include "js/experimental/JSStencil.h"
3132
#include "js/experimental/TypedData.h"
3233
#include "js/friend/ErrorMessages.h"
3334
#include "jsapi.h"
@@ -1080,4 +1081,14 @@ void SetDataPropertyDescriptor(
10801081
desc.set(JS::PropertyDescriptor::Data(value, attrs));
10811082
}
10821083

1084+
void FinishOffThreadStencil(
1085+
JSContext* cx,
1086+
JS::OffThreadToken* token,
1087+
JS::InstantiationStorage* storage,
1088+
already_AddRefed<JS::Stencil>* stencil
1089+
) {
1090+
already_AddRefed<JS::Stencil> retval = JS::FinishOffThreadStencil(cx, token, storage);
1091+
*stencil = std::move(retval);
1092+
}
1093+
10831094
} // extern "C"

rust-mozjs/src/rust.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,11 @@ pub unsafe fn FinishOffThreadStencil(
976976
token: *mut OffThreadToken,
977977
storage: *mut InstantiationStorage,
978978
) -> Stencil {
979-
let stencil = jsapi::FinishOffThreadStencil(cx, token, storage);
979+
let mut stencil = already_AddRefed {
980+
mRawPtr: std::ptr::null_mut(),
981+
_phantom_0: PhantomData,
982+
};
983+
crate::glue::FinishOffThreadStencil(cx, token, storage, &mut stencil);
980984
return Stencil { inner: stencil };
981985
}
982986

0 commit comments

Comments
 (0)