koffi 1.3.10 → 2.0.0

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.
Files changed (89) hide show
  1. package/CMakeLists.txt +7 -2
  2. package/ChangeLog.md +52 -14
  3. package/README.md +6 -0
  4. package/build/qemu/2.0.0/koffi_darwin_arm64.tar.gz +0 -0
  5. package/build/qemu/2.0.0/koffi_darwin_x64.tar.gz +0 -0
  6. package/build/qemu/2.0.0/koffi_freebsd_arm64.tar.gz +0 -0
  7. package/build/qemu/2.0.0/koffi_freebsd_ia32.tar.gz +0 -0
  8. package/build/qemu/2.0.0/koffi_freebsd_x64.tar.gz +0 -0
  9. package/build/qemu/2.0.0/koffi_linux_arm32hf.tar.gz +0 -0
  10. package/build/qemu/2.0.0/koffi_linux_arm64.tar.gz +0 -0
  11. package/build/qemu/2.0.0/koffi_linux_ia32.tar.gz +0 -0
  12. package/build/qemu/2.0.0/koffi_linux_riscv64hf64.tar.gz +0 -0
  13. package/build/qemu/2.0.0/koffi_linux_x64.tar.gz +0 -0
  14. package/build/qemu/2.0.0/koffi_openbsd_ia32.tar.gz +0 -0
  15. package/build/qemu/2.0.0/koffi_openbsd_x64.tar.gz +0 -0
  16. package/build/qemu/2.0.0/koffi_win32_arm64.tar.gz +0 -0
  17. package/build/qemu/2.0.0/koffi_win32_ia32.tar.gz +0 -0
  18. package/build/qemu/2.0.0/koffi_win32_x64.tar.gz +0 -0
  19. package/doc/benchmarks.md +2 -2
  20. package/doc/changes.md +156 -1
  21. package/doc/contribute.md +0 -1
  22. package/doc/dist/doctrees/changes.doctree +0 -0
  23. package/doc/dist/doctrees/environment.pickle +0 -0
  24. package/doc/dist/doctrees/functions.doctree +0 -0
  25. package/doc/dist/doctrees/types.doctree +0 -0
  26. package/doc/dist/html/_sources/changes.md.txt +156 -1
  27. package/doc/dist/html/_sources/functions.md.txt +8 -4
  28. package/doc/dist/html/_sources/types.md.txt +9 -0
  29. package/doc/dist/html/benchmarks.html +1 -1
  30. package/doc/dist/html/changes.html +226 -14
  31. package/doc/dist/html/contribute.html +1 -1
  32. package/doc/dist/html/functions.html +15 -12
  33. package/doc/dist/html/genindex.html +1 -1
  34. package/doc/dist/html/index.html +6 -16
  35. package/doc/dist/html/memory.html +3 -3
  36. package/doc/dist/html/objects.inv +0 -0
  37. package/doc/dist/html/platforms.html +1 -1
  38. package/doc/dist/html/search.html +1 -1
  39. package/doc/dist/html/searchindex.js +1 -1
  40. package/doc/dist/html/start.html +1 -1
  41. package/doc/dist/html/types.html +11 -3
  42. package/doc/functions.md +137 -13
  43. package/doc/types.md +35 -10
  44. package/package.json +9 -7
  45. package/qemu/registry/machines.json +5 -5
  46. package/qemu/registry/sha256sum.txt +16 -16
  47. package/src/abi_arm32.cc +90 -18
  48. package/src/abi_arm32_fwd.S +121 -57
  49. package/src/abi_arm64.cc +90 -18
  50. package/src/abi_arm64_fwd.S +96 -0
  51. package/src/abi_arm64_fwd.asm +128 -0
  52. package/src/abi_riscv64.cc +88 -18
  53. package/src/abi_riscv64_fwd.S +96 -0
  54. package/src/abi_x64_sysv.cc +93 -21
  55. package/src/abi_x64_sysv_fwd.S +96 -0
  56. package/src/abi_x64_win.cc +88 -18
  57. package/src/abi_x64_win_fwd.asm +128 -0
  58. package/src/abi_x86.cc +93 -18
  59. package/src/abi_x86_fwd.S +96 -0
  60. package/src/abi_x86_fwd.asm +128 -0
  61. package/src/call.cc +97 -63
  62. package/src/call.hh +2 -1
  63. package/src/ffi.cc +452 -140
  64. package/src/ffi.hh +23 -9
  65. package/src/parser.cc +20 -42
  66. package/src/util.cc +117 -27
  67. package/src/util.hh +3 -2
  68. package/test/callbacks.js +54 -8
  69. package/test/misc.c +30 -15
  70. package/test/raylib.js +1 -1
  71. package/test/sqlite.js +24 -16
  72. package/test/sync.js +43 -33
  73. package/vendor/libcc/libcc.cc +18 -5
  74. package/vendor/libcc/libcc.hh +70 -23
  75. package/build/qemu/1.3.10/koffi_darwin_arm64.tar.gz +0 -0
  76. package/build/qemu/1.3.10/koffi_darwin_x64.tar.gz +0 -0
  77. package/build/qemu/1.3.10/koffi_freebsd_arm64.tar.gz +0 -0
  78. package/build/qemu/1.3.10/koffi_freebsd_ia32.tar.gz +0 -0
  79. package/build/qemu/1.3.10/koffi_freebsd_x64.tar.gz +0 -0
  80. package/build/qemu/1.3.10/koffi_linux_arm32hf.tar.gz +0 -0
  81. package/build/qemu/1.3.10/koffi_linux_arm64.tar.gz +0 -0
  82. package/build/qemu/1.3.10/koffi_linux_ia32.tar.gz +0 -0
  83. package/build/qemu/1.3.10/koffi_linux_riscv64hf64.tar.gz +0 -0
  84. package/build/qemu/1.3.10/koffi_linux_x64.tar.gz +0 -0
  85. package/build/qemu/1.3.10/koffi_openbsd_ia32.tar.gz +0 -0
  86. package/build/qemu/1.3.10/koffi_openbsd_x64.tar.gz +0 -0
  87. package/build/qemu/1.3.10/koffi_win32_arm64.tar.gz +0 -0
  88. package/build/qemu/1.3.10/koffi_win32_ia32.tar.gz +0 -0
  89. package/build/qemu/1.3.10/koffi_win32_x64.tar.gz +0 -0
@@ -171,6 +171,22 @@ SYMBOL(ForwardCallXDD):
171
171
  .global SYMBOL(Trampoline13)
172
172
  .global SYMBOL(Trampoline14)
173
173
  .global SYMBOL(Trampoline15)
174
+ .global SYMBOL(Trampoline16)
175
+ .global SYMBOL(Trampoline17)
176
+ .global SYMBOL(Trampoline18)
177
+ .global SYMBOL(Trampoline19)
178
+ .global SYMBOL(Trampoline20)
179
+ .global SYMBOL(Trampoline21)
180
+ .global SYMBOL(Trampoline22)
181
+ .global SYMBOL(Trampoline23)
182
+ .global SYMBOL(Trampoline24)
183
+ .global SYMBOL(Trampoline25)
184
+ .global SYMBOL(Trampoline26)
185
+ .global SYMBOL(Trampoline27)
186
+ .global SYMBOL(Trampoline28)
187
+ .global SYMBOL(Trampoline29)
188
+ .global SYMBOL(Trampoline30)
189
+ .global SYMBOL(Trampoline31)
174
190
  .global SYMBOL(TrampolineX0)
175
191
  .global SYMBOL(TrampolineX1)
176
192
  .global SYMBOL(TrampolineX2)
@@ -187,6 +203,22 @@ SYMBOL(ForwardCallXDD):
187
203
  .global SYMBOL(TrampolineX13)
188
204
  .global SYMBOL(TrampolineX14)
189
205
  .global SYMBOL(TrampolineX15)
206
+ .global SYMBOL(TrampolineX16)
207
+ .global SYMBOL(TrampolineX17)
208
+ .global SYMBOL(TrampolineX18)
209
+ .global SYMBOL(TrampolineX19)
210
+ .global SYMBOL(TrampolineX20)
211
+ .global SYMBOL(TrampolineX21)
212
+ .global SYMBOL(TrampolineX22)
213
+ .global SYMBOL(TrampolineX23)
214
+ .global SYMBOL(TrampolineX24)
215
+ .global SYMBOL(TrampolineX25)
216
+ .global SYMBOL(TrampolineX26)
217
+ .global SYMBOL(TrampolineX27)
218
+ .global SYMBOL(TrampolineX28)
219
+ .global SYMBOL(TrampolineX29)
220
+ .global SYMBOL(TrampolineX30)
221
+ .global SYMBOL(TrampolineX31)
190
222
  .global SYMBOL(RelayCallback)
191
223
  .global SYMBOL(CallSwitchStack)
192
224
 
@@ -296,6 +328,38 @@ SYMBOL(Trampoline14):
296
328
  trampoline 14
297
329
  SYMBOL(Trampoline15):
298
330
  trampoline 15
331
+ SYMBOL(Trampoline16):
332
+ trampoline 16
333
+ SYMBOL(Trampoline17):
334
+ trampoline 17
335
+ SYMBOL(Trampoline18):
336
+ trampoline 18
337
+ SYMBOL(Trampoline19):
338
+ trampoline 19
339
+ SYMBOL(Trampoline20):
340
+ trampoline 20
341
+ SYMBOL(Trampoline21):
342
+ trampoline 21
343
+ SYMBOL(Trampoline22):
344
+ trampoline 22
345
+ SYMBOL(Trampoline23):
346
+ trampoline 23
347
+ SYMBOL(Trampoline24):
348
+ trampoline 24
349
+ SYMBOL(Trampoline25):
350
+ trampoline 25
351
+ SYMBOL(Trampoline26):
352
+ trampoline 26
353
+ SYMBOL(Trampoline27):
354
+ trampoline 27
355
+ SYMBOL(Trampoline28):
356
+ trampoline 28
357
+ SYMBOL(Trampoline29):
358
+ trampoline 29
359
+ SYMBOL(Trampoline30):
360
+ trampoline 30
361
+ SYMBOL(Trampoline31):
362
+ trampoline 31
299
363
 
300
364
  SYMBOL(TrampolineX0):
301
365
  trampoline_xmm 0
@@ -329,6 +393,38 @@ SYMBOL(TrampolineX14):
329
393
  trampoline_xmm 14
330
394
  SYMBOL(TrampolineX15):
331
395
  trampoline_xmm 15
396
+ SYMBOL(TrampolineX16):
397
+ trampoline_xmm 16
398
+ SYMBOL(TrampolineX17):
399
+ trampoline_xmm 17
400
+ SYMBOL(TrampolineX18):
401
+ trampoline_xmm 18
402
+ SYMBOL(TrampolineX19):
403
+ trampoline_xmm 19
404
+ SYMBOL(TrampolineX20):
405
+ trampoline_xmm 20
406
+ SYMBOL(TrampolineX21):
407
+ trampoline_xmm 21
408
+ SYMBOL(TrampolineX22):
409
+ trampoline_xmm 22
410
+ SYMBOL(TrampolineX23):
411
+ trampoline_xmm 23
412
+ SYMBOL(TrampolineX24):
413
+ trampoline_xmm 24
414
+ SYMBOL(TrampolineX25):
415
+ trampoline_xmm 25
416
+ SYMBOL(TrampolineX26):
417
+ trampoline_xmm 26
418
+ SYMBOL(TrampolineX27):
419
+ trampoline_xmm 27
420
+ SYMBOL(TrampolineX28):
421
+ trampoline_xmm 28
422
+ SYMBOL(TrampolineX29):
423
+ trampoline_xmm 29
424
+ SYMBOL(TrampolineX30):
425
+ trampoline_xmm 30
426
+ SYMBOL(TrampolineX31):
427
+ trampoline_xmm 31
332
428
 
333
429
  # When a callback is relayed, Koffi will call into Node.js and V8 to execute Javascript.
334
430
  # The problem is that we're still running on the separate Koffi stack, and V8 will
@@ -50,6 +50,22 @@ extern "C" int Trampoline12; extern "C" int TrampolineX12;
50
50
  extern "C" int Trampoline13; extern "C" int TrampolineX13;
51
51
  extern "C" int Trampoline14; extern "C" int TrampolineX14;
52
52
  extern "C" int Trampoline15; extern "C" int TrampolineX15;
53
+ extern "C" int Trampoline16; extern "C" int TrampolineX16;
54
+ extern "C" int Trampoline17; extern "C" int TrampolineX17;
55
+ extern "C" int Trampoline18; extern "C" int TrampolineX18;
56
+ extern "C" int Trampoline19; extern "C" int TrampolineX19;
57
+ extern "C" int Trampoline20; extern "C" int TrampolineX20;
58
+ extern "C" int Trampoline21; extern "C" int TrampolineX21;
59
+ extern "C" int Trampoline22; extern "C" int TrampolineX22;
60
+ extern "C" int Trampoline23; extern "C" int TrampolineX23;
61
+ extern "C" int Trampoline24; extern "C" int TrampolineX24;
62
+ extern "C" int Trampoline25; extern "C" int TrampolineX25;
63
+ extern "C" int Trampoline26; extern "C" int TrampolineX26;
64
+ extern "C" int Trampoline27; extern "C" int TrampolineX27;
65
+ extern "C" int Trampoline28; extern "C" int TrampolineX28;
66
+ extern "C" int Trampoline29; extern "C" int TrampolineX29;
67
+ extern "C" int Trampoline30; extern "C" int TrampolineX30;
68
+ extern "C" int Trampoline31; extern "C" int TrampolineX31;
53
69
 
54
70
  extern "C" napi_value CallSwitchStack(Napi::Function *func, size_t argc, napi_value *argv,
55
71
  uint8_t *old_sp, Span<uint8_t> *new_stack,
@@ -71,9 +87,25 @@ static void *const Trampolines[][2] = {
71
87
  { &Trampoline12, &TrampolineX12 },
72
88
  { &Trampoline13, &TrampolineX13 },
73
89
  { &Trampoline14, &TrampolineX14 },
74
- { &Trampoline15, &TrampolineX15 }
90
+ { &Trampoline15, &TrampolineX15 },
91
+ { &Trampoline16, &TrampolineX16 },
92
+ { &Trampoline17, &TrampolineX17 },
93
+ { &Trampoline18, &TrampolineX18 },
94
+ { &Trampoline19, &TrampolineX19 },
95
+ { &Trampoline20, &TrampolineX20 },
96
+ { &Trampoline21, &TrampolineX21 },
97
+ { &Trampoline22, &TrampolineX22 },
98
+ { &Trampoline23, &TrampolineX23 },
99
+ { &Trampoline24, &TrampolineX24 },
100
+ { &Trampoline25, &TrampolineX25 },
101
+ { &Trampoline26, &TrampolineX26 },
102
+ { &Trampoline27, &TrampolineX27 },
103
+ { &Trampoline28, &TrampolineX28 },
104
+ { &Trampoline29, &TrampolineX29 },
105
+ { &Trampoline30, &TrampolineX30 },
106
+ { &Trampoline31, &TrampolineX31 }
75
107
  };
76
- RG_STATIC_ASSERT(RG_LEN(Trampolines) == MaxTrampolines);
108
+ RG_STATIC_ASSERT(RG_LEN(Trampolines) == MaxTrampolines * 2);
77
109
 
78
110
  static RG_THREAD_LOCAL CallData *exec_call;
79
111
 
@@ -235,10 +267,10 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
235
267
  if (value.IsFunction()) {
236
268
  Napi::Function func = value.As<Napi::Function>();
237
269
 
238
- ptr = ReserveTrampoline(param.type->proto, func);
270
+ ptr = ReserveTrampoline(param.type->ref.proto, func);
239
271
  if (RG_UNLIKELY(!ptr))
240
272
  return false;
241
- } else if (CheckValueTag(instance, value, param.type)) {
273
+ } else if (CheckValueTag(instance, value, param.type->ref.marker)) {
242
274
  ptr = value.As<Napi::External<uint8_t>>().Data();
243
275
  } else if (IsNullOrUndefined(value)) {
244
276
  ptr = nullptr;
@@ -249,6 +281,8 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
249
281
 
250
282
  *(void **)(args_ptr++) = ptr;
251
283
  } break;
284
+
285
+ case PrimitiveKind::Prototype: { RG_UNREACHABLE(); } break;
252
286
  }
253
287
  }
254
288
 
@@ -287,6 +321,8 @@ void CallData::Execute()
287
321
  case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
288
322
  case PrimitiveKind::Float32: { result.f = PERFORM_CALL(F); } break;
289
323
  case PrimitiveKind::Float64: { result.d = PERFORM_CALL(D); } break;
324
+
325
+ case PrimitiveKind::Prototype: { RG_UNREACHABLE(); } break;
290
326
  }
291
327
 
292
328
  #undef PERFORM_CALL
@@ -294,7 +330,13 @@ void CallData::Execute()
294
330
 
295
331
  Napi::Value CallData::Complete()
296
332
  {
297
- PopOutArguments();
333
+ RG_DEFER {
334
+ PopOutArguments();
335
+
336
+ if (func->ret.type->dispose) {
337
+ func->ret.type->dispose(env, func->ret.type, result.ptr);
338
+ }
339
+ };
298
340
 
299
341
  switch (func->ret.type->primitive) {
300
342
  case PrimitiveKind::Void: return env.Null();
@@ -313,7 +355,7 @@ Napi::Value CallData::Complete()
313
355
  case PrimitiveKind::Callback: {
314
356
  if (result.ptr) {
315
357
  Napi::External<void> external = Napi::External<void>::New(env, result.ptr);
316
- SetValueTag(instance, external, func->ret.type);
358
+ SetValueTag(instance, external, func->ret.type->ref.marker);
317
359
 
318
360
  return external;
319
361
  } else {
@@ -330,6 +372,8 @@ Napi::Value CallData::Complete()
330
372
  case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
331
373
  case PrimitiveKind::Float32: return Napi::Number::New(env, (double)result.f);
332
374
  case PrimitiveKind::Float64: return Napi::Number::New(env, result.d);
375
+
376
+ case PrimitiveKind::Prototype: { RG_UNREACHABLE(); } break;
333
377
  }
334
378
 
335
379
  RG_UNREACHABLE();
@@ -337,12 +381,10 @@ Napi::Value CallData::Complete()
337
381
 
338
382
  void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegisters *out_reg)
339
383
  {
340
- const TrampolineInfo &trampoline = instance->trampolines[idx];
341
-
342
- if (RG_UNLIKELY(trampoline.generation != mem->generation)) {
343
- ThrowError<Napi::Error>(env, "Cannot use non-persistent callback beyond FFI call");
384
+ if (RG_UNLIKELY(env.IsExceptionPending()))
344
385
  return;
345
- }
386
+
387
+ const TrampolineInfo &trampoline = instance->trampolines[idx];
346
388
 
347
389
  const FunctionInfo *proto = trampoline.proto;
348
390
  Napi::Function func = trampoline.func.Value();
@@ -353,6 +395,13 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
353
395
 
354
396
  uint8_t *return_ptr = !proto->ret.regular ? (uint8_t *)gpr_ptr[0] : nullptr;
355
397
 
398
+ RG_DEFER_N(err_guard) { memset(out_reg, 0, RG_SIZE(*out_reg)); };
399
+
400
+ if (RG_UNLIKELY(trampoline.generation >= 0 && trampoline.generation != (int32_t)mem->generation)) {
401
+ ThrowError<Napi::Error>(env, "Cannot use non-registered callback beyond FFI call");
402
+ return;
403
+ }
404
+
356
405
  LocalArray<napi_value, MaxParameters> arguments;
357
406
 
358
407
  // Convert to JS arguments
@@ -432,6 +481,10 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
432
481
 
433
482
  Napi::Value arg = str ? Napi::String::New(env, str) : env.Null();
434
483
  arguments.Append(arg);
484
+
485
+ if (param.type->dispose) {
486
+ param.type->dispose(env, param.type, str);
487
+ }
435
488
  } break;
436
489
  case PrimitiveKind::String16: {
437
490
  const char16_t *str16 = *(const char16_t **)(j < 4 ? gpr_ptr + j : args_ptr);
@@ -439,6 +492,10 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
439
492
 
440
493
  Napi::Value arg = str16 ? Napi::String::New(env, str16) : env.Null();
441
494
  arguments.Append(arg);
495
+
496
+ if (param.type->dispose) {
497
+ param.type->dispose(env, param.type, str16);
498
+ }
442
499
  } break;
443
500
  case PrimitiveKind::Pointer:
444
501
  case PrimitiveKind::Callback: {
@@ -447,12 +504,16 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
447
504
 
448
505
  if (ptr2) {
449
506
  Napi::External<void> external = Napi::External<void>::New(env, ptr2);
450
- SetValueTag(instance, external, param.type);
507
+ SetValueTag(instance, external, param.type->ref.marker);
451
508
 
452
509
  arguments.Append(external);
453
510
  } else {
454
511
  arguments.Append(env.Null());
455
512
  }
513
+
514
+ if (param.type->dispose) {
515
+ param.type->dispose(env, param.type, ptr2);
516
+ }
456
517
  } break;
457
518
  case PrimitiveKind::Record: {
458
519
  uint8_t *ptr;
@@ -481,6 +542,8 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
481
542
  Napi::Value arg = Napi::Number::New(env, d);
482
543
  arguments.Append(arg);
483
544
  } break;
545
+
546
+ case PrimitiveKind::Prototype: { RG_UNREACHABLE(); } break;
484
547
  }
485
548
  }
486
549
 
@@ -491,6 +554,9 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
491
554
  [](Napi::Function *func, size_t argc, napi_value *argv) { return (napi_value)func->Call(argc, argv); });
492
555
  Napi::Value value(env, ret);
493
556
 
557
+ if (RG_UNLIKELY(env.IsExceptionPending()))
558
+ return;
559
+
494
560
  switch (type->primitive) {
495
561
  case PrimitiveKind::Void: {} break;
496
562
  case PrimitiveKind::Bool: {
@@ -551,14 +617,14 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
551
617
  case PrimitiveKind::Pointer: {
552
618
  uint8_t *ptr;
553
619
 
554
- if (CheckValueTag(instance, value, type)) {
620
+ if (CheckValueTag(instance, value, type->ref.marker)) {
555
621
  ptr = value.As<Napi::External<uint8_t>>().Data();
556
- } else if (IsObject(value) && type->ref->primitive == PrimitiveKind::Record) {
622
+ } else if (IsObject(value) && type->ref.type->primitive == PrimitiveKind::Record) {
557
623
  Napi::Object obj = value.As<Napi::Object>();
558
624
 
559
- ptr = AllocHeap(type->ref->size, 16);
625
+ ptr = AllocHeap(type->ref.type->size, 16);
560
626
 
561
- if (!PushObject(obj, type->ref, ptr))
627
+ if (!PushObject(obj, type->ref.type, ptr))
562
628
  return;
563
629
  } else if (IsNullOrUndefined(value)) {
564
630
  ptr = nullptr;
@@ -612,10 +678,10 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
612
678
  if (value.IsFunction()) {
613
679
  Napi::Function func2 = value.As<Napi::Function>();
614
680
 
615
- ptr = ReserveTrampoline(type->proto, func2);
681
+ ptr = ReserveTrampoline(type->ref.proto, func2);
616
682
  if (RG_UNLIKELY(!ptr))
617
683
  return;
618
- } else if (CheckValueTag(instance, value, type)) {
684
+ } else if (CheckValueTag(instance, value, type->ref.marker)) {
619
685
  ptr = value.As<Napi::External<uint8_t>>().Data();
620
686
  } else if (IsNullOrUndefined(value)) {
621
687
  ptr = nullptr;
@@ -626,7 +692,11 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
626
692
 
627
693
  out_reg->rax = (uint64_t)ptr;
628
694
  } break;
695
+
696
+ case PrimitiveKind::Prototype: { RG_UNREACHABLE(); } break;
629
697
  }
698
+
699
+ err_guard.Disable();
630
700
  }
631
701
 
632
702
  void *GetTrampoline(Size idx, const FunctionInfo *proto)
@@ -126,6 +126,22 @@ public Trampoline12
126
126
  public Trampoline13
127
127
  public Trampoline14
128
128
  public Trampoline15
129
+ public Trampoline16
130
+ public Trampoline17
131
+ public Trampoline18
132
+ public Trampoline19
133
+ public Trampoline20
134
+ public Trampoline21
135
+ public Trampoline22
136
+ public Trampoline23
137
+ public Trampoline24
138
+ public Trampoline25
139
+ public Trampoline26
140
+ public Trampoline27
141
+ public Trampoline28
142
+ public Trampoline29
143
+ public Trampoline30
144
+ public Trampoline31
129
145
  public TrampolineX0
130
146
  public TrampolineX1
131
147
  public TrampolineX2
@@ -142,6 +158,22 @@ public TrampolineX12
142
158
  public TrampolineX13
143
159
  public TrampolineX14
144
160
  public TrampolineX15
161
+ public TrampolineX16
162
+ public TrampolineX17
163
+ public TrampolineX18
164
+ public TrampolineX19
165
+ public TrampolineX20
166
+ public TrampolineX21
167
+ public TrampolineX22
168
+ public TrampolineX23
169
+ public TrampolineX24
170
+ public TrampolineX25
171
+ public TrampolineX26
172
+ public TrampolineX27
173
+ public TrampolineX28
174
+ public TrampolineX29
175
+ public TrampolineX30
176
+ public TrampolineX31
145
177
  extern RelayCallback : PROC
146
178
  public CallSwitchStack
147
179
 
@@ -242,6 +274,54 @@ Trampoline14 endp
242
274
  Trampoline15 proc frame
243
275
  trampoline 15
244
276
  Trampoline15 endp
277
+ Trampoline16 proc frame
278
+ trampoline 16
279
+ Trampoline16 endp
280
+ Trampoline17 proc frame
281
+ trampoline 17
282
+ Trampoline17 endp
283
+ Trampoline18 proc frame
284
+ trampoline 18
285
+ Trampoline18 endp
286
+ Trampoline19 proc frame
287
+ trampoline 19
288
+ Trampoline19 endp
289
+ Trampoline20 proc frame
290
+ trampoline 20
291
+ Trampoline20 endp
292
+ Trampoline21 proc frame
293
+ trampoline 21
294
+ Trampoline21 endp
295
+ Trampoline22 proc frame
296
+ trampoline 22
297
+ Trampoline22 endp
298
+ Trampoline23 proc frame
299
+ trampoline 23
300
+ Trampoline23 endp
301
+ Trampoline24 proc frame
302
+ trampoline 24
303
+ Trampoline24 endp
304
+ Trampoline25 proc frame
305
+ trampoline 25
306
+ Trampoline25 endp
307
+ Trampoline26 proc frame
308
+ trampoline 26
309
+ Trampoline26 endp
310
+ Trampoline27 proc frame
311
+ trampoline 27
312
+ Trampoline27 endp
313
+ Trampoline28 proc frame
314
+ trampoline 28
315
+ Trampoline28 endp
316
+ Trampoline29 proc frame
317
+ trampoline 29
318
+ Trampoline29 endp
319
+ Trampoline30 proc frame
320
+ trampoline 30
321
+ Trampoline30 endp
322
+ Trampoline31 proc frame
323
+ trampoline 31
324
+ Trampoline31 endp
245
325
 
246
326
  TrampolineX0 proc frame
247
327
  trampoline_xmm 0
@@ -291,6 +371,54 @@ TrampolineX14 endp
291
371
  TrampolineX15 proc frame
292
372
  trampoline_xmm 15
293
373
  TrampolineX15 endp
374
+ TrampolineX16 proc frame
375
+ trampoline_xmm 16
376
+ TrampolineX16 endp
377
+ TrampolineX17 proc frame
378
+ trampoline_xmm 17
379
+ TrampolineX17 endp
380
+ TrampolineX18 proc frame
381
+ trampoline_xmm 18
382
+ TrampolineX18 endp
383
+ TrampolineX19 proc frame
384
+ trampoline_xmm 19
385
+ TrampolineX19 endp
386
+ TrampolineX20 proc frame
387
+ trampoline_xmm 20
388
+ TrampolineX20 endp
389
+ TrampolineX21 proc frame
390
+ trampoline_xmm 21
391
+ TrampolineX21 endp
392
+ TrampolineX22 proc frame
393
+ trampoline_xmm 22
394
+ TrampolineX22 endp
395
+ TrampolineX23 proc frame
396
+ trampoline_xmm 23
397
+ TrampolineX23 endp
398
+ TrampolineX24 proc frame
399
+ trampoline_xmm 24
400
+ TrampolineX24 endp
401
+ TrampolineX25 proc frame
402
+ trampoline_xmm 25
403
+ TrampolineX25 endp
404
+ TrampolineX26 proc frame
405
+ trampoline_xmm 26
406
+ TrampolineX26 endp
407
+ TrampolineX27 proc frame
408
+ trampoline_xmm 27
409
+ TrampolineX27 endp
410
+ TrampolineX28 proc frame
411
+ trampoline_xmm 28
412
+ TrampolineX28 endp
413
+ TrampolineX29 proc frame
414
+ trampoline_xmm 29
415
+ TrampolineX29 endp
416
+ TrampolineX30 proc frame
417
+ trampoline_xmm 30
418
+ TrampolineX30 endp
419
+ TrampolineX31 proc frame
420
+ trampoline_xmm 31
421
+ TrampolineX31 endp
294
422
 
295
423
  ; When a callback is relayed, Koffi will call into Node.js and V8 to execute Javascript.
296
424
  ; The problem is that we're still running on the separate Koffi stack, and V8 will