aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-08 00:28:14 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-08 00:28:14 -0800
commit3e9bb6859b5bd832da73ba48ede24eaf9cc1cbee (patch)
tree7747f8dadd1ab8a85c8b142fe605301ef0580f1b /test/bun.js
parent86f0b08b8d37389ab488bc413fd450c403d58dea (diff)
downloadbun-3e9bb6859b5bd832da73ba48ede24eaf9cc1cbee.tar.gz
bun-3e9bb6859b5bd832da73ba48ede24eaf9cc1cbee.tar.zst
bun-3e9bb6859b5bd832da73ba48ede24eaf9cc1cbee.zip
Stack allocate arguments to make it actually threadsafe
Diffstat (limited to 'test/bun.js')
-rw-r--r--test/bun.js/ffi.test.fixture.callback.c3
-rw-r--r--test/bun.js/ffi.test.fixture.receiver.c2
2 files changed, 1 insertions, 4 deletions
diff --git a/test/bun.js/ffi.test.fixture.callback.c b/test/bun.js/ffi.test.fixture.callback.c
index 58e6c482e..9c3c088ce 100644
--- a/test/bun.js/ffi.test.fixture.callback.c
+++ b/test/bun.js/ffi.test.fixture.callback.c
@@ -111,8 +111,6 @@ static EncodedJSValue _FFI_Callback_call(void* ctx, size_t argCount, ZIG_REPR_TY
return_value.asZigRepr = FFI_Callback_call(ctx, argCount, args);
return return_value;
}
-static ZIG_REPR_TYPE arguments[100];
-
#endif
static bool JSVALUE_IS_CELL(EncodedJSValue val) __attribute__((__always_inline__));
@@ -290,6 +288,7 @@ bool my_callback_function(void* arg0) {
#ifdef INJECT_BEFORE
INJECT_BEFORE;
#endif
+ ZIG_REPR_TYPE arguments[1];
arguments[0] = PTR_TO_JSVALUE(arg0).asZigRepr;
return (bool)JSVALUE_TO_BOOL(_FFI_Callback_call((void*)0x0UL, 1, arguments));
}
diff --git a/test/bun.js/ffi.test.fixture.receiver.c b/test/bun.js/ffi.test.fixture.receiver.c
index c972c2df1..a507ab3a5 100644
--- a/test/bun.js/ffi.test.fixture.receiver.c
+++ b/test/bun.js/ffi.test.fixture.receiver.c
@@ -111,8 +111,6 @@ static EncodedJSValue _FFI_Callback_call(void* ctx, size_t argCount, ZIG_REPR_TY
return_value.asZigRepr = FFI_Callback_call(ctx, argCount, args);
return return_value;
}
-static ZIG_REPR_TYPE arguments[100];
-
#endif
static bool JSVALUE_IS_CELL(EncodedJSValue val) __attribute__((__always_inline__));