koffi 2.15.1 → 2.16.0-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.
Files changed (50) hide show
  1. package/build/koffi/darwin_arm64/koffi.node +0 -0
  2. package/build/koffi/darwin_x64/koffi.node +0 -0
  3. package/build/koffi/freebsd_arm64/koffi.node +0 -0
  4. package/build/koffi/freebsd_ia32/koffi.node +0 -0
  5. package/build/koffi/freebsd_x64/koffi.node +0 -0
  6. package/build/koffi/linux_arm64/koffi.node +0 -0
  7. package/build/koffi/linux_armhf/koffi.node +0 -0
  8. package/build/koffi/linux_ia32/koffi.node +0 -0
  9. package/build/koffi/linux_loong64/koffi.node +0 -0
  10. package/build/koffi/linux_riscv64d/koffi.node +0 -0
  11. package/build/koffi/linux_x64/koffi.node +0 -0
  12. package/build/koffi/musl_arm64/koffi.node +0 -0
  13. package/build/koffi/musl_x64/koffi.node +0 -0
  14. package/build/koffi/openbsd_ia32/koffi.node +0 -0
  15. package/build/koffi/openbsd_x64/koffi.node +0 -0
  16. package/build/koffi/win32_arm64/koffi.node +0 -0
  17. package/build/koffi/win32_ia32/koffi.node +0 -0
  18. package/build/koffi/win32_x64/koffi.node +0 -0
  19. package/index.d.ts +11 -9
  20. package/index.js +8 -8
  21. package/indirect.js +8 -8
  22. package/package.json +1 -1
  23. package/src/koffi/src/abi_arm32.cc +222 -219
  24. package/src/koffi/src/abi_arm32_asm.S +1 -29
  25. package/src/koffi/src/abi_arm64.cc +257 -235
  26. package/src/koffi/src/abi_arm64_asm.S +1 -32
  27. package/src/koffi/src/abi_arm64_asm.asm +1 -23
  28. package/src/koffi/src/abi_loong64_asm.S +1 -25
  29. package/src/koffi/src/abi_riscv64.cc +220 -217
  30. package/src/koffi/src/abi_riscv64_asm.S +1 -25
  31. package/src/koffi/src/abi_x64_sysv.cc +196 -192
  32. package/src/koffi/src/abi_x64_sysv_asm.S +1 -31
  33. package/src/koffi/src/abi_x64_win.cc +188 -172
  34. package/src/koffi/src/abi_x64_win_asm.S +1 -19
  35. package/src/koffi/src/abi_x64_win_asm.asm +1 -21
  36. package/src/koffi/src/abi_x86.cc +224 -189
  37. package/src/koffi/src/abi_x86_asm.S +6 -25
  38. package/src/koffi/src/abi_x86_asm.asm +9 -22
  39. package/src/koffi/src/call.cc +246 -428
  40. package/src/koffi/src/call.hh +9 -8
  41. package/src/koffi/src/ffi.cc +140 -87
  42. package/src/koffi/src/ffi.hh +12 -58
  43. package/src/koffi/src/primitives.inc +39 -0
  44. package/src/koffi/src/trampolines/armasm.inc +0 -32770
  45. package/src/koffi/src/trampolines/gnu.inc +0 -24578
  46. package/src/koffi/src/trampolines/masm32.inc +0 -32770
  47. package/src/koffi/src/trampolines/masm64.inc +0 -32770
  48. package/src/koffi/src/trampolines/prototypes.inc +16385 -16385
  49. package/src/koffi/src/util.cc +149 -107
  50. package/src/koffi/src/util.hh +76 -40
@@ -114,43 +114,12 @@ SYMBOL(ForwardCallXDDDD):
114
114
  .global SYMBOL(RelayCallback)
115
115
  .global SYMBOL(CallSwitchStack)
116
116
 
117
- # First, make a copy of the GPR argument registers (x0 to x7).
117
+ # First, make a copy of the argument registers.
118
118
  # Then call the C function RelayCallback with the following arguments:
119
119
  # static trampoline ID, a pointer to the saved GPR array, a pointer to the stack
120
120
  # arguments of this call, and a pointer to a struct that will contain the result registers.
121
121
  # After the call, simply load these registers from the output struct.
122
122
  .macro trampoline id
123
- .cfi_startproc
124
- hint #34
125
- stp x29, x30, [sp, -16]!
126
- .cfi_def_cfa sp, 16
127
- .cfi_offset 29, 16
128
- .cfi_offset 30, 8
129
- sub sp, sp, #192
130
- .cfi_def_cfa sp, 208
131
- stp x0, x1, [sp, 0]
132
- stp x2, x3, [sp, 16]
133
- stp x4, x5, [sp, 32]
134
- stp x6, x7, [sp, 48]
135
- str x8, [sp, 64]
136
- mov x0, \id
137
- mov x1, sp
138
- add x2, sp, #208
139
- add x3, sp, #136
140
- bl SYMBOL(RelayCallback)
141
- ldp x0, x1, [sp, 136]
142
- add sp, sp, #192
143
- .cfi_def_cfa sp, 16
144
- ldp x29, x30, [sp], 16
145
- .cfi_def_cfa sp, 0
146
- .cfi_restore 30
147
- .cfi_restore 29
148
- ret
149
- .cfi_endproc
150
- .endm
151
-
152
- # Same thing, but also forwards the floating-point argument registers and loads them at the end.
153
- .macro trampoline_vec id
154
123
  .cfi_startproc
155
124
  hint #34
156
125
  stp x29, x30, [sp, -16]!
@@ -108,7 +108,7 @@ ForwardCallXDDDD PROC
108
108
  EXTERN RelayCallback
109
109
  EXPORT CallSwitchStack
110
110
 
111
- ; First, make a copy of the GPR argument registers (x0 to x7).
111
+ ; First, make a copy of the argument registers.
112
112
  ; Then call the C function RelayCallback with the following arguments:
113
113
  ; static trampoline ID, a pointer to the saved GPR array, a pointer to the stack
114
114
  ; arguments of this call, and a pointer to a struct that will contain the result registers.
@@ -116,28 +116,6 @@ ForwardCallXDDDD PROC
116
116
  MACRO
117
117
  trampoline $ID
118
118
 
119
- stp x29, x30, [sp, -16]!
120
- sub sp, sp, #192
121
- stp x0, x1, [sp, 0]
122
- stp x2, x3, [sp, 16]
123
- stp x4, x5, [sp, 32]
124
- stp x6, x7, [sp, 48]
125
- str x8, [sp, 64]
126
- mov x0, $ID
127
- mov x1, sp
128
- add x2, sp, #208
129
- add x3, sp, #136
130
- bl RelayCallback
131
- ldp x0, x1, [sp, 136]
132
- add sp, sp, #192
133
- ldp x29, x30, [sp], 16
134
- ret
135
- MEND
136
-
137
- ; Same thing, but also forwards the floating-point argument registers and loads them at the end.
138
- MACRO
139
- trampoline_vec $ID
140
-
141
119
  stp x29, x30, [sp, -16]!
142
120
  sub sp, sp, #192
143
121
  stp x0, x1, [sp, 0]
@@ -131,36 +131,12 @@ ForwardCallXDD:
131
131
  .global RelayCallback
132
132
  .global CallSwitchStack
133
133
 
134
- # First, make a copy of the GPR argument registers (a0 to a7).
134
+ # First, make a copy of the argument registers.
135
135
  # Then call the C function RelayCallback with the following arguments:
136
136
  # static trampoline ID, a pointer to the saved GPR array, a pointer to the stack
137
137
  # arguments of this call, and a pointer to a struct that will contain the result registers.
138
138
  # After the call, simply load these registers from the output struct.
139
139
  .macro trampoline id
140
- addi.d $sp, $sp, -176
141
- st.d $ra, $sp, 0
142
- st.d $a0, $sp, 8
143
- st.d $a1, $sp, 16
144
- st.d $a2, $sp, 24
145
- st.d $a3, $sp, 32
146
- st.d $a4, $sp, 40
147
- st.d $a5, $sp, 48
148
- st.d $a6, $sp, 56
149
- st.d $a7, $sp, 64
150
- li.d $a0, \id
151
- addi.d $a1, $sp, 8
152
- addi.d $a2, $sp, 176
153
- addi.d $a3, $sp, 136
154
- bl RelayCallback
155
- ld.d $ra, $sp, 0
156
- ld.d $a0, $sp, 136
157
- ld.d $a1, $sp, 144
158
- addi.d $sp, $sp, 176
159
- jr $ra
160
- .endm
161
-
162
- # Same thing, but also forwards the floating-point argument registers and loads them at the end.
163
- .macro trampoline_vec id
164
140
  addi.d $sp, $sp, -176
165
141
  st.d $ra, $sp, 0
166
142
  st.d $a0, $sp, 8