koffi 2.15.3 → 2.15.4

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/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@
7
7
 
8
8
  ### Koffi 2.15
9
9
 
10
+ #### Koffi 2.15.4
11
+
12
+ *Released on 2026-04-03*
13
+
14
+ - Fix ABI issue with variadic parameters that are passed on the stack on Apple ARM64 platforms
15
+ - Remove erroneous assertion from debug builds
16
+
10
17
  #### Koffi 2.15.3
11
18
 
12
19
  *Released on 2026-04-03*
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
@@ -4,9 +4,9 @@ var __commonJS = (cb, mod3) => function __require() {
4
4
  return mod3 || (0, cb[__getOwnPropNames(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports;
5
5
  };
6
6
 
7
- // bin/Koffi/package/src/cnoke/src/tools.js
7
+ // ../../bin/Koffi/package/src/cnoke/src/tools.js
8
8
  var require_tools = __commonJS({
9
- "bin/Koffi/package/src/cnoke/src/tools.js"(exports2, module2) {
9
+ "../../bin/Koffi/package/src/cnoke/src/tools.js"(exports2, module2) {
10
10
  "use strict";
11
11
  var crypto = require("crypto");
12
12
  var fs2 = require("fs");
@@ -393,12 +393,12 @@ var require_tools = __commonJS({
393
393
  }
394
394
  });
395
395
 
396
- // bin/Koffi/package/src/koffi/package.json
396
+ // ../../bin/Koffi/package/src/koffi/package.json
397
397
  var require_package = __commonJS({
398
- "bin/Koffi/package/src/koffi/package.json"(exports2, module2) {
398
+ "../../bin/Koffi/package/src/koffi/package.json"(exports2, module2) {
399
399
  module2.exports = {
400
400
  name: "koffi",
401
- version: "2.15.3",
401
+ version: "2.15.4",
402
402
  description: "Fast and simple C FFI (foreign function interface) for Node.js",
403
403
  keywords: [
404
404
  "foreign",
@@ -440,9 +440,9 @@ var require_package = __commonJS({
440
440
  }
441
441
  });
442
442
 
443
- // bin/Koffi/package/src/koffi/src/init.js
443
+ // ../../bin/Koffi/package/src/koffi/src/init.js
444
444
  var require_init = __commonJS({
445
- "bin/Koffi/package/src/koffi/src/init.js"(exports, module) {
445
+ "../../bin/Koffi/package/src/koffi/src/init.js"(exports, module) {
446
446
  var fs = require("fs");
447
447
  var path = require("path");
448
448
  var util = require("util");
@@ -526,7 +526,7 @@ var require_init = __commonJS({
526
526
  }
527
527
  });
528
528
 
529
- // bin/Koffi/package/src/koffi/index.js
529
+ // ../../bin/Koffi/package/src/koffi/index.js
530
530
  var { detect: detect2, init: init2 } = require_init();
531
531
  var triplet2 = detect2();
532
532
  var native2 = null;
package/indirect.js CHANGED
@@ -4,9 +4,9 @@ var __commonJS = (cb, mod3) => function __require() {
4
4
  return mod3 || (0, cb[__getOwnPropNames(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports;
5
5
  };
6
6
 
7
- // bin/Koffi/package/src/cnoke/src/tools.js
7
+ // ../../bin/Koffi/package/src/cnoke/src/tools.js
8
8
  var require_tools = __commonJS({
9
- "bin/Koffi/package/src/cnoke/src/tools.js"(exports2, module2) {
9
+ "../../bin/Koffi/package/src/cnoke/src/tools.js"(exports2, module2) {
10
10
  "use strict";
11
11
  var crypto = require("crypto");
12
12
  var fs2 = require("fs");
@@ -393,12 +393,12 @@ var require_tools = __commonJS({
393
393
  }
394
394
  });
395
395
 
396
- // bin/Koffi/package/src/koffi/package.json
396
+ // ../../bin/Koffi/package/src/koffi/package.json
397
397
  var require_package = __commonJS({
398
- "bin/Koffi/package/src/koffi/package.json"(exports2, module2) {
398
+ "../../bin/Koffi/package/src/koffi/package.json"(exports2, module2) {
399
399
  module2.exports = {
400
400
  name: "koffi",
401
- version: "2.15.3",
401
+ version: "2.15.4",
402
402
  description: "Fast and simple C FFI (foreign function interface) for Node.js",
403
403
  keywords: [
404
404
  "foreign",
@@ -440,9 +440,9 @@ var require_package = __commonJS({
440
440
  }
441
441
  });
442
442
 
443
- // bin/Koffi/package/src/koffi/src/init.js
443
+ // ../../bin/Koffi/package/src/koffi/src/init.js
444
444
  var require_init = __commonJS({
445
- "bin/Koffi/package/src/koffi/src/init.js"(exports, module) {
445
+ "../../bin/Koffi/package/src/koffi/src/init.js"(exports, module) {
446
446
  var fs = require("fs");
447
447
  var path = require("path");
448
448
  var util = require("util");
@@ -526,7 +526,7 @@ var require_init = __commonJS({
526
526
  }
527
527
  });
528
528
 
529
- // bin/Koffi/package/src/koffi/indirect.js
529
+ // ../../bin/Koffi/package/src/koffi/indirect.js
530
530
  var { detect: detect2, init: init2 } = require_init();
531
531
  var triplet2 = detect2();
532
532
  var mod2 = init2(triplet2, null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koffi",
3
- "version": "2.15.3",
3
+ "version": "2.15.4",
4
4
  "description": "Fast and simple C FFI (foreign function interface) for Node.js",
5
5
  "keywords": [
6
6
  "foreign",
@@ -286,7 +286,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
286
286
  if (param.gpr_count) [[likely]] { \
287
287
  *(gpr_ptr++) = (uint64_t)v; \
288
288
  } else { \
289
- args_ptr = AlignUp(args_ptr, param.type->align); \
289
+ args_ptr = AlignUp(args_ptr, param.variadic ? 8 : param.type->align); \
290
290
  *args_ptr = (uint64_t)v; \
291
291
  args_ptr = (uint64_t *)((uint8_t *)args_ptr + param.type->size); \
292
292
  } \
@@ -303,7 +303,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
303
303
  if (param.gpr_count) [[likely]] { \
304
304
  *(gpr_ptr++) = (uint64_t)ReverseBytes(v); \
305
305
  } else { \
306
- args_ptr = AlignUp(args_ptr, param.type->align); \
306
+ args_ptr = AlignUp(args_ptr, param.variadic ? 8 : param.type->align); \
307
307
  *args_ptr = (uint64_t)ReverseBytes(v); \
308
308
  args_ptr = (uint64_t *)((uint8_t *)args_ptr + param.type->size); \
309
309
  } \
@@ -353,6 +353,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
353
353
  if (param.gpr_count) [[likely]] {
354
354
  *(gpr_ptr++) = (uint64_t)b;
355
355
  } else {
356
+ args_ptr = AlignUp(args_ptr, param.variadic ? 8 : 1);
356
357
  *(uint8_t *)args_ptr = b;
357
358
  args_ptr = (uint64_t *)((uint8_t *)args_ptr + 1);
358
359
  }
@@ -484,7 +485,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
484
485
  #endif
485
486
  } else {
486
487
  #if defined(__APPLE__)
487
- args_ptr = AlignUp(args_ptr, 4);
488
+ args_ptr = AlignUp(args_ptr, param.variadic ? 8 : 4);
488
489
  *(float *)args_ptr = f;
489
490
  args_ptr = (uint64_t *)((uint8_t *)args_ptr + 4);
490
491
  #else
@@ -29,7 +29,6 @@ CallData::CallData(Napi::Env env, InstanceData *instance, InstanceMemory *mem)
29
29
  mem->depth++;
30
30
 
31
31
  K_ASSERT(AlignUp(mem->stack.ptr, 16) == mem->stack.ptr);
32
- K_ASSERT(AlignUp(mem->stack.end(), 16) == mem->stack.end());
33
32
  }
34
33
 
35
34
  CallData::~CallData()