koffi 2.7.3 → 2.7.4-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/koffi/darwin_arm64/koffi.node +0 -0
- package/build/koffi/darwin_x64/koffi.node +0 -0
- package/build/koffi/freebsd_arm64/koffi.node +0 -0
- package/build/koffi/freebsd_ia32/koffi.node +0 -0
- package/build/koffi/freebsd_x64/koffi.node +0 -0
- package/build/koffi/linux_arm32hf/koffi.node +0 -0
- package/build/koffi/linux_arm64/koffi.node +0 -0
- package/build/koffi/linux_ia32/koffi.node +0 -0
- package/build/koffi/linux_riscv64hf64/koffi.node +0 -0
- package/build/koffi/linux_x64/koffi.node +0 -0
- package/build/koffi/openbsd_ia32/koffi.node +0 -0
- package/build/koffi/openbsd_x64/koffi.node +0 -0
- package/build/koffi/win32_arm64/koffi.node +0 -0
- package/build/koffi/win32_ia32/koffi.node +0 -0
- package/build/koffi/win32_x64/koffi.node +0 -0
- package/index.js +1 -1
- package/indirect.js +1 -1
- package/package.json +1 -1
- package/src/koffi/src/abi_arm32.cc +4 -4
- package/src/koffi/src/abi_arm64.cc +4 -4
- package/src/koffi/src/abi_riscv64.cc +4 -4
- package/src/koffi/src/abi_x64_sysv.cc +4 -4
- package/src/koffi/src/abi_x64_win.cc +4 -4
- package/src/koffi/src/abi_x86.cc +4 -4
- package/src/koffi/src/call.cc +5 -5
- package/src/koffi/src/call.hh +2 -2
- package/src/koffi/src/ffi.cc +0 -9
- package/src/koffi/src/ffi.hh +0 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.js
CHANGED
|
@@ -378,7 +378,7 @@ var require_package = __commonJS({
|
|
|
378
378
|
"build/dist/src/koffi/package.json"(exports2, module2) {
|
|
379
379
|
module2.exports = {
|
|
380
380
|
name: "koffi",
|
|
381
|
-
version: "2.7.
|
|
381
|
+
version: "2.7.4-beta.1",
|
|
382
382
|
stable: "2.7.3",
|
|
383
383
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
384
384
|
keywords: [
|
package/indirect.js
CHANGED
|
@@ -378,7 +378,7 @@ var require_package = __commonJS({
|
|
|
378
378
|
"build/dist/src/koffi/package.json"(exports2, module2) {
|
|
379
379
|
module2.exports = {
|
|
380
380
|
name: "koffi",
|
|
381
|
-
version: "2.7.
|
|
381
|
+
version: "2.7.4-beta.1",
|
|
382
382
|
stable: "2.7.3",
|
|
383
383
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
384
384
|
keywords: [
|
package/package.json
CHANGED
|
@@ -564,7 +564,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
564
564
|
RG_UNREACHABLE();
|
|
565
565
|
}
|
|
566
566
|
|
|
567
|
-
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
567
|
+
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
568
568
|
{
|
|
569
569
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
570
570
|
return;
|
|
@@ -827,11 +827,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool async,
|
|
|
827
827
|
|
|
828
828
|
// Make the call
|
|
829
829
|
napi_value ret;
|
|
830
|
-
if (
|
|
831
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
832
|
-
} else {
|
|
830
|
+
if (switch_stack) {
|
|
833
831
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
834
832
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
833
|
+
} else {
|
|
834
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
835
835
|
}
|
|
836
836
|
Napi::Value value(env, ret);
|
|
837
837
|
|
|
@@ -709,7 +709,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
709
709
|
RG_UNREACHABLE();
|
|
710
710
|
}
|
|
711
711
|
|
|
712
|
-
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
712
|
+
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
713
713
|
{
|
|
714
714
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
715
715
|
return;
|
|
@@ -1143,11 +1143,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool async,
|
|
|
1143
1143
|
|
|
1144
1144
|
// Make the call
|
|
1145
1145
|
napi_value ret;
|
|
1146
|
-
if (
|
|
1147
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
1148
|
-
} else {
|
|
1146
|
+
if (switch_stack) {
|
|
1149
1147
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
1150
1148
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
1149
|
+
} else {
|
|
1150
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
1151
1151
|
}
|
|
1152
1152
|
Napi::Value value(env, ret);
|
|
1153
1153
|
|
|
@@ -506,7 +506,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
506
506
|
RG_UNREACHABLE();
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
-
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
509
|
+
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
510
510
|
{
|
|
511
511
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
512
512
|
return;
|
|
@@ -740,11 +740,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool async,
|
|
|
740
740
|
|
|
741
741
|
// Make the call
|
|
742
742
|
napi_value ret;
|
|
743
|
-
if (
|
|
744
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
745
|
-
} else {
|
|
743
|
+
if (switch_stack) {
|
|
746
744
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
747
745
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
746
|
+
} else {
|
|
747
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
748
748
|
}
|
|
749
749
|
Napi::Value value(env, ret);
|
|
750
750
|
|
|
@@ -541,7 +541,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
541
541
|
RG_UNREACHABLE();
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
544
|
+
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
545
545
|
{
|
|
546
546
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
547
547
|
return;
|
|
@@ -764,11 +764,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool async,
|
|
|
764
764
|
|
|
765
765
|
// Make the call
|
|
766
766
|
napi_value ret;
|
|
767
|
-
if (
|
|
768
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
769
|
-
} else {
|
|
767
|
+
if (switch_stack) {
|
|
770
768
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
771
769
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
770
|
+
} else {
|
|
771
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
772
772
|
}
|
|
773
773
|
Napi::Value value(env, ret);
|
|
774
774
|
|
|
@@ -350,7 +350,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
350
350
|
RG_UNREACHABLE();
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
353
|
+
void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
354
354
|
{
|
|
355
355
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
356
356
|
return;
|
|
@@ -587,11 +587,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool async,
|
|
|
587
587
|
|
|
588
588
|
// Make the call
|
|
589
589
|
napi_value ret;
|
|
590
|
-
if (
|
|
591
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
592
|
-
} else {
|
|
590
|
+
if (switch_stack) {
|
|
593
591
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
594
592
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
593
|
+
} else {
|
|
594
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
595
595
|
}
|
|
596
596
|
Napi::Value value(env, ret);
|
|
597
597
|
|
package/src/koffi/src/abi_x86.cc
CHANGED
|
@@ -464,7 +464,7 @@ Napi::Value CallData::Complete(const FunctionInfo *func)
|
|
|
464
464
|
RG_UNREACHABLE();
|
|
465
465
|
}
|
|
466
466
|
|
|
467
|
-
void CallData::Relay(Size idx, uint8_t *, uint8_t *caller_sp, bool
|
|
467
|
+
void CallData::Relay(Size idx, uint8_t *, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg)
|
|
468
468
|
{
|
|
469
469
|
if (env.IsExceptionPending()) [[unlikely]]
|
|
470
470
|
return;
|
|
@@ -700,11 +700,11 @@ void CallData::Relay(Size idx, uint8_t *, uint8_t *caller_sp, bool async, BackRe
|
|
|
700
700
|
|
|
701
701
|
// Make the call
|
|
702
702
|
napi_value ret;
|
|
703
|
-
if (
|
|
704
|
-
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
705
|
-
} else {
|
|
703
|
+
if (switch_stack) {
|
|
706
704
|
ret = CallSwitchStack(&func, (size_t)arguments.len, arguments.data, old_sp, &mem->stack,
|
|
707
705
|
[](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argv[0], argc - 1, argv + 1); });
|
|
706
|
+
} else {
|
|
707
|
+
ret = (napi_value)func.Call(arguments[0], arguments.len - 1, arguments.data + 1);
|
|
708
708
|
}
|
|
709
709
|
Napi::Value value(env, ret);
|
|
710
710
|
|
package/src/koffi/src/call.cc
CHANGED
|
@@ -101,7 +101,7 @@ void CallData::Dispose()
|
|
|
101
101
|
instance = nullptr;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
void CallData::RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
104
|
+
void CallData::RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool outside_call, BackRegisters *out_reg)
|
|
105
105
|
{
|
|
106
106
|
if (std::this_thread::get_id() != instance->main_thread_id) {
|
|
107
107
|
// JS/V8 is single-threaded, and runs on main_thread_id. Forward the call
|
|
@@ -110,7 +110,7 @@ void CallData::RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool dis
|
|
|
110
110
|
RelayContext ctx;
|
|
111
111
|
|
|
112
112
|
ctx.call = this;
|
|
113
|
-
ctx.dispose_call =
|
|
113
|
+
ctx.dispose_call = outside_call;
|
|
114
114
|
ctx.idx = idx;
|
|
115
115
|
ctx.own_sp = own_sp;
|
|
116
116
|
ctx.caller_sp = caller_sp;
|
|
@@ -124,8 +124,8 @@ void CallData::RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool dis
|
|
|
124
124
|
ctx.cv.wait(lock);
|
|
125
125
|
}
|
|
126
126
|
} else {
|
|
127
|
-
|
|
128
|
-
Relay(idx, own_sp, caller_sp,
|
|
127
|
+
Napi::HandleScope scope(env);
|
|
128
|
+
Relay(idx, own_sp, caller_sp, !outside_call, out_reg);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -133,7 +133,7 @@ void CallData::RelayAsync(napi_env, napi_value, void *, void *udata)
|
|
|
133
133
|
{
|
|
134
134
|
RelayContext *ctx = (RelayContext *)udata;
|
|
135
135
|
|
|
136
|
-
ctx->call->Relay(ctx->idx, ctx->own_sp, ctx->caller_sp,
|
|
136
|
+
ctx->call->Relay(ctx->idx, ctx->own_sp, ctx->caller_sp, false, ctx->out_reg);
|
|
137
137
|
|
|
138
138
|
if (ctx->dispose_call) {
|
|
139
139
|
ctx->call->Dispose();
|
package/src/koffi/src/call.hh
CHANGED
|
@@ -107,8 +107,8 @@ public:
|
|
|
107
107
|
|
|
108
108
|
#undef INLINE_IF_UNITY
|
|
109
109
|
|
|
110
|
-
void Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
111
|
-
void RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool
|
|
110
|
+
void Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_stack, BackRegisters *out_reg);
|
|
111
|
+
void RelaySafe(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool outside_call, BackRegisters *out_reg);
|
|
112
112
|
static void RelayAsync(napi_env, napi_value, void *, void *udata);
|
|
113
113
|
|
|
114
114
|
void DumpForward(const FunctionInfo *func) const;
|
package/src/koffi/src/ffi.cc
CHANGED
|
@@ -48,10 +48,6 @@
|
|
|
48
48
|
#endif
|
|
49
49
|
|
|
50
50
|
#include <napi.h>
|
|
51
|
-
#if NODE_WANT_INTERNALS
|
|
52
|
-
#include <env-inl.h>
|
|
53
|
-
#include <js_native_api_v8.h>
|
|
54
|
-
#endif
|
|
55
51
|
|
|
56
52
|
namespace RG {
|
|
57
53
|
|
|
@@ -2084,11 +2080,6 @@ bool InitAsyncBroker(Napi::Env env, InstanceData *instance)
|
|
|
2084
2080
|
return true;
|
|
2085
2081
|
}
|
|
2086
2082
|
|
|
2087
|
-
CallData *GetThreadCall()
|
|
2088
|
-
{
|
|
2089
|
-
return exec_call;
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
2083
|
static void RegisterPrimitiveType(Napi::Env env, Napi::Object map, std::initializer_list<const char *> names,
|
|
2093
2084
|
PrimitiveKind primitive, int32_t size, int16_t align, const char *ref = nullptr)
|
|
2094
2085
|
{
|
package/src/koffi/src/ffi.hh
CHANGED