koffi 2.0.0 → 2.1.0-beta.2
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/CMakeLists.txt +2 -9
- package/ChangeLog.md +25 -2
- package/benchmark/atoi_koffi.js +12 -8
- package/benchmark/atoi_napi.js +12 -8
- package/benchmark/atoi_node_ffi.js +11 -10
- package/benchmark/raylib_cc.cc +12 -9
- package/benchmark/raylib_koffi.js +15 -13
- package/benchmark/raylib_node_ffi.js +15 -13
- package/benchmark/raylib_node_raylib.js +14 -11
- package/build/qemu/2.1.0-beta.2/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.2/koffi_win32_x64.tar.gz +0 -0
- package/doc/benchmarks.md +2 -2
- package/doc/changes.md +23 -19
- package/doc/conf.py +14 -1
- package/doc/dist/doctrees/benchmarks.doctree +0 -0
- package/doc/dist/doctrees/changes.doctree +0 -0
- package/doc/dist/doctrees/environment.pickle +0 -0
- package/doc/dist/doctrees/functions.doctree +0 -0
- package/doc/dist/doctrees/index.doctree +0 -0
- package/doc/dist/doctrees/types.doctree +0 -0
- package/doc/functions.md +76 -10
- package/doc/templates/badges.html +4 -0
- package/doc/types.md +157 -161
- package/package.json +2 -2
- package/qemu/qemu.js +1 -1
- package/src/abi_arm32.cc +167 -3
- package/src/abi_arm64.cc +196 -3
- package/src/abi_riscv64.cc +107 -3
- package/src/abi_x64_sysv.cc +114 -4
- package/src/abi_x64_win.cc +113 -3
- package/src/abi_x86.cc +156 -5
- package/src/call.cc +241 -26
- package/src/call.hh +15 -3
- package/src/ffi.cc +123 -34
- package/src/ffi.hh +19 -0
- package/src/index.js +4 -2
- package/src/parser.cc +3 -5
- package/src/util.cc +44 -1
- package/src/util.hh +4 -0
- package/test/async.js +1 -2
- package/test/callbacks.js +2 -3
- package/test/misc.c +21 -1
- package/test/raylib.js +1 -1
- package/test/sqlite.js +7 -7
- package/test/sync.js +30 -4
- package/build/qemu/2.0.0/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/2.0.0/koffi_win32_x64.tar.gz +0 -0
- package/doc/dist/html/.buildinfo +0 -4
- package/doc/dist/html/_sources/benchmarks.md.txt +0 -137
- package/doc/dist/html/_sources/changes.md.txt +0 -157
- package/doc/dist/html/_sources/contribute.md.txt +0 -127
- package/doc/dist/html/_sources/functions.md.txt +0 -355
- package/doc/dist/html/_sources/index.rst.txt +0 -39
- package/doc/dist/html/_sources/memory.md.txt +0 -32
- package/doc/dist/html/_sources/platforms.md.txt +0 -31
- package/doc/dist/html/_sources/start.md.txt +0 -100
- package/doc/dist/html/_sources/types.md.txt +0 -545
- package/doc/dist/html/_static/_sphinx_javascript_frameworks_compat.js +0 -134
- package/doc/dist/html/_static/basic.css +0 -932
- package/doc/dist/html/_static/bench_linux.png +0 -0
- package/doc/dist/html/_static/bench_windows.png +0 -0
- package/doc/dist/html/_static/custom.css +0 -22
- package/doc/dist/html/_static/debug.css +0 -69
- package/doc/dist/html/_static/doctools.js +0 -264
- package/doc/dist/html/_static/documentation_options.js +0 -14
- package/doc/dist/html/_static/file.png +0 -0
- package/doc/dist/html/_static/jquery-3.6.0.js +0 -10881
- package/doc/dist/html/_static/jquery.js +0 -2
- package/doc/dist/html/_static/language_data.js +0 -199
- package/doc/dist/html/_static/minus.png +0 -0
- package/doc/dist/html/_static/perf_linux_20220623.png +0 -0
- package/doc/dist/html/_static/perf_linux_20220623_2.png +0 -0
- package/doc/dist/html/_static/perf_windows_20220623.png +0 -0
- package/doc/dist/html/_static/perf_windows_20220623_2.png +0 -0
- package/doc/dist/html/_static/plus.png +0 -0
- package/doc/dist/html/_static/pygments.css +0 -252
- package/doc/dist/html/_static/scripts/furo-extensions.js +0 -0
- package/doc/dist/html/_static/scripts/furo.js +0 -3
- package/doc/dist/html/_static/scripts/furo.js.LICENSE.txt +0 -7
- package/doc/dist/html/_static/scripts/furo.js.map +0 -1
- package/doc/dist/html/_static/searchtools.js +0 -531
- package/doc/dist/html/_static/skeleton.css +0 -296
- package/doc/dist/html/_static/styles/furo-extensions.css +0 -2
- package/doc/dist/html/_static/styles/furo-extensions.css.map +0 -1
- package/doc/dist/html/_static/styles/furo.css +0 -2
- package/doc/dist/html/_static/styles/furo.css.map +0 -1
- package/doc/dist/html/_static/underscore-1.13.1.js +0 -2042
- package/doc/dist/html/_static/underscore.js +0 -6
- package/doc/dist/html/benchmarks.html +0 -568
- package/doc/dist/html/changes.html +0 -653
- package/doc/dist/html/contribute.html +0 -400
- package/doc/dist/html/functions.html +0 -653
- package/doc/dist/html/genindex.html +0 -250
- package/doc/dist/html/index.html +0 -356
- package/doc/dist/html/memory.html +0 -343
- package/doc/dist/html/objects.inv +0 -0
- package/doc/dist/html/platforms.html +0 -368
- package/doc/dist/html/search.html +0 -258
- package/doc/dist/html/searchindex.js +0 -1
- package/doc/dist/html/start.html +0 -381
- package/doc/dist/html/types.html +0 -1044
package/src/abi_x86.cc
CHANGED
|
@@ -229,6 +229,17 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
229
229
|
int32_t v = CopyNumber<int32_t>(value);
|
|
230
230
|
*(int32_t *)((param.fast ? fast_ptr : args_ptr)++) = v;
|
|
231
231
|
} break;
|
|
232
|
+
case PrimitiveKind::Int16S:
|
|
233
|
+
case PrimitiveKind::UInt16S:
|
|
234
|
+
case PrimitiveKind::Int32S: {
|
|
235
|
+
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
236
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
int32_t v = CopyNumber<int32_t>(value);
|
|
241
|
+
*(int32_t *)((param.fast ? fast_ptr : args_ptr)++) = ReverseBytes(v);
|
|
242
|
+
} break;
|
|
232
243
|
case PrimitiveKind::UInt32: {
|
|
233
244
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
234
245
|
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
|
|
@@ -238,6 +249,15 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
238
249
|
uint32_t v = CopyNumber<uint32_t>(value);
|
|
239
250
|
*((param.fast ? fast_ptr : args_ptr)++) = v;
|
|
240
251
|
} break;
|
|
252
|
+
case PrimitiveKind::UInt32S: {
|
|
253
|
+
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
254
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
uint32_t v = CopyNumber<uint32_t>(value);
|
|
259
|
+
*((param.fast ? fast_ptr : args_ptr)++) = ReverseBytes(v);
|
|
260
|
+
} break;
|
|
241
261
|
case PrimitiveKind::Int64: {
|
|
242
262
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
243
263
|
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
|
|
@@ -248,6 +268,16 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
248
268
|
*(int64_t *)args_ptr = v;
|
|
249
269
|
args_ptr += 2;
|
|
250
270
|
} break;
|
|
271
|
+
case PrimitiveKind::Int64S: {
|
|
272
|
+
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
273
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
int64_t v = CopyNumber<int64_t>(value);
|
|
278
|
+
*(int64_t *)args_ptr = ReverseBytes(v);
|
|
279
|
+
args_ptr += 2;
|
|
280
|
+
} break;
|
|
251
281
|
case PrimitiveKind::UInt64: {
|
|
252
282
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
253
283
|
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
|
|
@@ -258,6 +288,16 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
258
288
|
*(uint64_t *)args_ptr = v;
|
|
259
289
|
args_ptr += 2;
|
|
260
290
|
} break;
|
|
291
|
+
case PrimitiveKind::UInt64S: {
|
|
292
|
+
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
293
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected number", GetValueType(instance, value), param.offset + 1);
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
uint64_t v = CopyNumber<uint64_t>(value);
|
|
298
|
+
*(uint64_t *)args_ptr = ReverseBytes(v);
|
|
299
|
+
args_ptr += 2;
|
|
300
|
+
} break;
|
|
261
301
|
case PrimitiveKind::String: {
|
|
262
302
|
const char *str;
|
|
263
303
|
if (RG_LIKELY(value.IsString())) {
|
|
@@ -382,11 +422,17 @@ void CallData::Execute()
|
|
|
382
422
|
case PrimitiveKind::Int8:
|
|
383
423
|
case PrimitiveKind::UInt8:
|
|
384
424
|
case PrimitiveKind::Int16:
|
|
425
|
+
case PrimitiveKind::Int16S:
|
|
385
426
|
case PrimitiveKind::UInt16:
|
|
427
|
+
case PrimitiveKind::UInt16S:
|
|
386
428
|
case PrimitiveKind::Int32:
|
|
429
|
+
case PrimitiveKind::Int32S:
|
|
387
430
|
case PrimitiveKind::UInt32:
|
|
431
|
+
case PrimitiveKind::UInt32S:
|
|
388
432
|
case PrimitiveKind::Int64:
|
|
433
|
+
case PrimitiveKind::Int64S:
|
|
389
434
|
case PrimitiveKind::UInt64:
|
|
435
|
+
case PrimitiveKind::UInt64S:
|
|
390
436
|
case PrimitiveKind::String:
|
|
391
437
|
case PrimitiveKind::String16:
|
|
392
438
|
case PrimitiveKind::Pointer:
|
|
@@ -413,16 +459,22 @@ Napi::Value CallData::Complete()
|
|
|
413
459
|
};
|
|
414
460
|
|
|
415
461
|
switch (func->ret.type->primitive) {
|
|
416
|
-
case PrimitiveKind::Void: return env.
|
|
462
|
+
case PrimitiveKind::Void: return env.Undefined();
|
|
417
463
|
case PrimitiveKind::Bool: return Napi::Boolean::New(env, result.u32);
|
|
418
464
|
case PrimitiveKind::Int8: return Napi::Number::New(env, (double)result.i8);
|
|
419
465
|
case PrimitiveKind::UInt8: return Napi::Number::New(env, (double)result.u8);
|
|
420
466
|
case PrimitiveKind::Int16: return Napi::Number::New(env, (double)result.i16);
|
|
467
|
+
case PrimitiveKind::Int16S: return Napi::Number::New(env, (double)ReverseBytes(result.i16));
|
|
421
468
|
case PrimitiveKind::UInt16: return Napi::Number::New(env, (double)result.u16);
|
|
469
|
+
case PrimitiveKind::UInt16S: return Napi::Number::New(env, (double)ReverseBytes(result.u16));
|
|
422
470
|
case PrimitiveKind::Int32: return Napi::Number::New(env, (double)result.i32);
|
|
471
|
+
case PrimitiveKind::Int32S: return Napi::Number::New(env, (double)ReverseBytes(result.i32));
|
|
423
472
|
case PrimitiveKind::UInt32: return Napi::Number::New(env, (double)result.u32);
|
|
473
|
+
case PrimitiveKind::UInt32S: return Napi::Number::New(env, (double)ReverseBytes(result.u32));
|
|
424
474
|
case PrimitiveKind::Int64: return NewBigInt(env, result.i64);
|
|
475
|
+
case PrimitiveKind::Int64S: return NewBigInt(env, ReverseBytes(result.i64));
|
|
425
476
|
case PrimitiveKind::UInt64: return NewBigInt(env, result.u64);
|
|
477
|
+
case PrimitiveKind::UInt64S: return NewBigInt(env, ReverseBytes(result.u64));
|
|
426
478
|
case PrimitiveKind::String: return result.ptr ? Napi::String::New(env, (const char *)result.ptr) : env.Null();
|
|
427
479
|
case PrimitiveKind::String16: return result.ptr ? Napi::String::New(env, (const char16_t *)result.ptr) : env.Null();
|
|
428
480
|
case PrimitiveKind::Pointer:
|
|
@@ -524,24 +576,52 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
524
576
|
Napi::Value arg = Napi::Number::New(env, d);
|
|
525
577
|
arguments.Append(arg);
|
|
526
578
|
} break;
|
|
579
|
+
case PrimitiveKind::Int16S: {
|
|
580
|
+
int16_t v = *(int16_t *)(args_ptr++);
|
|
581
|
+
double d = (double)ReverseBytes(v);
|
|
582
|
+
|
|
583
|
+
Napi::Value arg = Napi::Number::New(env, d);
|
|
584
|
+
arguments.Append(arg);
|
|
585
|
+
} break;
|
|
527
586
|
case PrimitiveKind::UInt16: {
|
|
528
587
|
double d = (double)*(uint16_t *)(args_ptr++);
|
|
529
588
|
|
|
530
589
|
Napi::Value arg = Napi::Number::New(env, d);
|
|
531
590
|
arguments.Append(arg);
|
|
532
591
|
} break;
|
|
592
|
+
case PrimitiveKind::UInt16S: {
|
|
593
|
+
uint16_t v = *(uint16_t *)(args_ptr++);
|
|
594
|
+
double d = (double)ReverseBytes(v);
|
|
595
|
+
|
|
596
|
+
Napi::Value arg = Napi::Number::New(env, d);
|
|
597
|
+
arguments.Append(arg);
|
|
598
|
+
} break;
|
|
533
599
|
case PrimitiveKind::Int32: {
|
|
534
600
|
double d = (double)*(int32_t *)(args_ptr++);
|
|
535
601
|
|
|
536
602
|
Napi::Value arg = Napi::Number::New(env, d);
|
|
537
603
|
arguments.Append(arg);
|
|
538
604
|
} break;
|
|
605
|
+
case PrimitiveKind::Int32S: {
|
|
606
|
+
int32_t v = *(int32_t *)(args_ptr++);
|
|
607
|
+
double d = (double)ReverseBytes(v);
|
|
608
|
+
|
|
609
|
+
Napi::Value arg = Napi::Number::New(env, d);
|
|
610
|
+
arguments.Append(arg);
|
|
611
|
+
} break;
|
|
539
612
|
case PrimitiveKind::UInt32: {
|
|
540
613
|
double d = (double)*(uint32_t *)(args_ptr++);
|
|
541
614
|
|
|
542
615
|
Napi::Value arg = Napi::Number::New(env, d);
|
|
543
616
|
arguments.Append(arg);
|
|
544
617
|
} break;
|
|
618
|
+
case PrimitiveKind::UInt32S: {
|
|
619
|
+
uint32_t v = *(uint32_t *)(args_ptr++);
|
|
620
|
+
double d = (double)ReverseBytes(v);
|
|
621
|
+
|
|
622
|
+
Napi::Value arg = Napi::Number::New(env, d);
|
|
623
|
+
arguments.Append(arg);
|
|
624
|
+
} break;
|
|
545
625
|
case PrimitiveKind::Int64: {
|
|
546
626
|
int64_t v = *(int64_t *)args_ptr;
|
|
547
627
|
args_ptr += 2;
|
|
@@ -549,6 +629,13 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
549
629
|
Napi::Value arg = NewBigInt(env, v);
|
|
550
630
|
arguments.Append(arg);
|
|
551
631
|
} break;
|
|
632
|
+
case PrimitiveKind::Int64S: {
|
|
633
|
+
int64_t v = *(int64_t *)args_ptr;
|
|
634
|
+
args_ptr += 2;
|
|
635
|
+
|
|
636
|
+
Napi::Value arg = NewBigInt(env, ReverseBytes(v));
|
|
637
|
+
arguments.Append(arg);
|
|
638
|
+
} break;
|
|
552
639
|
case PrimitiveKind::UInt64: {
|
|
553
640
|
uint64_t v = *(uint64_t *)args_ptr;
|
|
554
641
|
args_ptr += 2;
|
|
@@ -556,6 +643,13 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
556
643
|
Napi::Value arg = NewBigInt(env, v);
|
|
557
644
|
arguments.Append(arg);
|
|
558
645
|
} break;
|
|
646
|
+
case PrimitiveKind::UInt64S: {
|
|
647
|
+
uint64_t v = *(uint64_t *)args_ptr;
|
|
648
|
+
args_ptr += 2;
|
|
649
|
+
|
|
650
|
+
Napi::Value arg = NewBigInt(env, ReverseBytes(v));
|
|
651
|
+
arguments.Append(arg);
|
|
652
|
+
} break;
|
|
559
653
|
case PrimitiveKind::String: {
|
|
560
654
|
const char *str = *(const char **)(args_ptr++);
|
|
561
655
|
|
|
@@ -647,8 +741,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
647
741
|
case PrimitiveKind::UInt8:
|
|
648
742
|
case PrimitiveKind::Int16:
|
|
649
743
|
case PrimitiveKind::UInt16:
|
|
650
|
-
case PrimitiveKind::Int32:
|
|
651
|
-
case PrimitiveKind::UInt32: {
|
|
744
|
+
case PrimitiveKind::Int32: {
|
|
652
745
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
653
746
|
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
|
|
654
747
|
return;
|
|
@@ -657,8 +750,36 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
657
750
|
int32_t v = CopyNumber<int32_t>(value);
|
|
658
751
|
out_reg->eax = (uint32_t)v;
|
|
659
752
|
} break;
|
|
660
|
-
case PrimitiveKind::
|
|
661
|
-
case PrimitiveKind::
|
|
753
|
+
case PrimitiveKind::Int16S:
|
|
754
|
+
case PrimitiveKind::UInt16S:
|
|
755
|
+
case PrimitiveKind::Int32S: {
|
|
756
|
+
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
757
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
int32_t v = CopyNumber<int32_t>(value);
|
|
762
|
+
out_reg->eax = (uint32_t)ReverseBytes(v);
|
|
763
|
+
} break;
|
|
764
|
+
case PrimitiveKind::UInt32: {
|
|
765
|
+
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
766
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
uint32_t v = CopyNumber<uint32_t>(value);
|
|
771
|
+
out_reg->eax = v;
|
|
772
|
+
} break;
|
|
773
|
+
case PrimitiveKind::UInt32S: {
|
|
774
|
+
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
775
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
uint32_t v = CopyNumber<uint32_t>(value);
|
|
780
|
+
out_reg->eax = ReverseBytes(v);
|
|
781
|
+
} break;
|
|
782
|
+
case PrimitiveKind::Int64: {
|
|
662
783
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
663
784
|
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
|
|
664
785
|
return;
|
|
@@ -668,6 +789,36 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
668
789
|
out_reg->eax = (uint32_t)(v & 0xFFFFFFFFul);
|
|
669
790
|
out_reg->edx = (uint32_t)(v << 32);
|
|
670
791
|
} break;
|
|
792
|
+
case PrimitiveKind::Int64S: {
|
|
793
|
+
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
794
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
int64_t v = ReverseBytes(CopyNumber<int64_t>(value));
|
|
799
|
+
out_reg->eax = (uint32_t)(v & 0xFFFFFFFFul);
|
|
800
|
+
out_reg->edx = (uint32_t)(v << 32);
|
|
801
|
+
} break;
|
|
802
|
+
case PrimitiveKind::UInt64: {
|
|
803
|
+
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
804
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
uint64_t v = CopyNumber<uint64_t>(value);
|
|
809
|
+
out_reg->eax = (uint32_t)(v & 0xFFFFFFFFul);
|
|
810
|
+
out_reg->edx = (uint32_t)(v << 32);
|
|
811
|
+
} break;
|
|
812
|
+
case PrimitiveKind::UInt64S: {
|
|
813
|
+
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
814
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected number", GetValueType(instance, value));
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
uint64_t v = ReverseBytes(CopyNumber<uint64_t>(value));
|
|
819
|
+
out_reg->eax = (uint32_t)(v & 0xFFFFFFFFul);
|
|
820
|
+
out_reg->edx = (uint32_t)(v << 32);
|
|
821
|
+
} break;
|
|
671
822
|
case PrimitiveKind::String: {
|
|
672
823
|
const char *str;
|
|
673
824
|
if (RG_LIKELY(value.IsString())) {
|