koffi 0.9.20 → 0.9.23

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 (266) hide show
  1. package/CMakeLists.txt +1 -57
  2. package/README.md +7 -6
  3. package/benchmark/build.sh +13 -0
  4. package/benchmark/raylib_c +0 -0
  5. package/benchmark/raylib_c.c +83 -0
  6. package/benchmark/raylib_koffi.js +127 -0
  7. package/benchmark/raylib_node_ffi.js +144 -0
  8. package/package.json +4 -2
  9. package/src/call_arm32.cc +5 -8
  10. package/src/call_arm64.cc +16 -5
  11. package/src/call_arm64_fwd.S +18 -12
  12. package/src/call_x64_sysv.cc +5 -4
  13. package/src/ffi.cc +70 -87
  14. package/src/util.cc +0 -2
  15. package/src/util.hh +5 -3
  16. package/test/registry/machines.json +21 -11
  17. package/test/test.js +38 -20
  18. package/test/tests/misc.c +98 -3
  19. package/test/tests/misc.js +30 -1
  20. package/test/tests/raylib.js +1 -1
  21. package/test/tests/sqlite.js +1 -1
  22. package/vendor/raylib/src/external/glfw/src/posix_time.c +3 -1
  23. package/vendor/raylib/src/external/glfw/src/wl_init.c +3 -1
  24. package/vendor/raylib/projects/VS2019/examples/audio_module_playing.vcxproj +0 -387
  25. package/vendor/raylib/projects/VS2019/examples/audio_multichannel_sound.vcxproj +0 -387
  26. package/vendor/raylib/projects/VS2019/examples/audio_music_stream.vcxproj +0 -387
  27. package/vendor/raylib/projects/VS2019/examples/audio_raw_stream.vcxproj +0 -387
  28. package/vendor/raylib/projects/VS2019/examples/audio_sound_loading.vcxproj +0 -387
  29. package/vendor/raylib/projects/VS2019/examples/core_2d_camera.vcxproj +0 -387
  30. package/vendor/raylib/projects/VS2019/examples/core_2d_camera_platformer.vcxproj +0 -387
  31. package/vendor/raylib/projects/VS2019/examples/core_3d_camera_first_person.vcxproj +0 -387
  32. package/vendor/raylib/projects/VS2019/examples/core_3d_camera_free.vcxproj +0 -387
  33. package/vendor/raylib/projects/VS2019/examples/core_3d_camera_mode.vcxproj +0 -387
  34. package/vendor/raylib/projects/VS2019/examples/core_3d_picking.vcxproj +0 -387
  35. package/vendor/raylib/projects/VS2019/examples/core_basic_window.vcxproj +0 -387
  36. package/vendor/raylib/projects/VS2019/examples/core_custom_logging.vcxproj +0 -387
  37. package/vendor/raylib/projects/VS2019/examples/core_drop_files.vcxproj +0 -387
  38. package/vendor/raylib/projects/VS2019/examples/core_input_gamepad.vcxproj +0 -387
  39. package/vendor/raylib/projects/VS2019/examples/core_input_gestures.vcxproj +0 -387
  40. package/vendor/raylib/projects/VS2019/examples/core_input_keys.vcxproj +0 -387
  41. package/vendor/raylib/projects/VS2019/examples/core_input_mouse.vcxproj +0 -387
  42. package/vendor/raylib/projects/VS2019/examples/core_input_mouse_wheel.vcxproj +0 -387
  43. package/vendor/raylib/projects/VS2019/examples/core_input_multitouch.vcxproj +0 -387
  44. package/vendor/raylib/projects/VS2019/examples/core_loading_thread.vcxproj +0 -387
  45. package/vendor/raylib/projects/VS2019/examples/core_quat_conversion.vcxproj +0 -387
  46. package/vendor/raylib/projects/VS2019/examples/core_random_values.vcxproj +0 -387
  47. package/vendor/raylib/projects/VS2019/examples/core_scissor_test.vcxproj +0 -387
  48. package/vendor/raylib/projects/VS2019/examples/core_split_screen.vcxproj +0 -387
  49. package/vendor/raylib/projects/VS2019/examples/core_storage_values.vcxproj +0 -387
  50. package/vendor/raylib/projects/VS2019/examples/core_vr_simulator.vcxproj +0 -387
  51. package/vendor/raylib/projects/VS2019/examples/core_window_flags.vcxproj +0 -387
  52. package/vendor/raylib/projects/VS2019/examples/core_window_letterbox.vcxproj +0 -387
  53. package/vendor/raylib/projects/VS2019/examples/core_world_screen.vcxproj +0 -387
  54. package/vendor/raylib/projects/VS2019/examples/easings_testbed.vcxproj +0 -387
  55. package/vendor/raylib/projects/VS2019/examples/embedded_files_loading.vcxproj +0 -387
  56. package/vendor/raylib/projects/VS2019/examples/models_animation.vcxproj +0 -387
  57. package/vendor/raylib/projects/VS2019/examples/models_billboard.vcxproj +0 -387
  58. package/vendor/raylib/projects/VS2019/examples/models_box_collisions.vcxproj +0 -387
  59. package/vendor/raylib/projects/VS2019/examples/models_cubicmap.vcxproj +0 -387
  60. package/vendor/raylib/projects/VS2019/examples/models_first_person_maze.vcxproj +0 -387
  61. package/vendor/raylib/projects/VS2019/examples/models_geometric_shapes.vcxproj +0 -387
  62. package/vendor/raylib/projects/VS2019/examples/models_heightmap.vcxproj +0 -387
  63. package/vendor/raylib/projects/VS2019/examples/models_loading.vcxproj +0 -387
  64. package/vendor/raylib/projects/VS2019/examples/models_loading_gltf.vcxproj +0 -387
  65. package/vendor/raylib/projects/VS2019/examples/models_loading_vox.vcxproj +0 -387
  66. package/vendor/raylib/projects/VS2019/examples/models_mesh_generation.vcxproj +0 -387
  67. package/vendor/raylib/projects/VS2019/examples/models_mesh_picking.vcxproj +0 -387
  68. package/vendor/raylib/projects/VS2019/examples/models_orthographic_projection.vcxproj +0 -387
  69. package/vendor/raylib/projects/VS2019/examples/models_rlgl_solar_system.vcxproj +0 -387
  70. package/vendor/raylib/projects/VS2019/examples/models_skybox.vcxproj +0 -387
  71. package/vendor/raylib/projects/VS2019/examples/models_waving_cubes.vcxproj +0 -387
  72. package/vendor/raylib/projects/VS2019/examples/models_yaw_pitch_roll.vcxproj +0 -387
  73. package/vendor/raylib/projects/VS2019/examples/physics_demo.vcxproj +0 -387
  74. package/vendor/raylib/projects/VS2019/examples/physics_friction.vcxproj +0 -387
  75. package/vendor/raylib/projects/VS2019/examples/physics_movement.vcxproj +0 -387
  76. package/vendor/raylib/projects/VS2019/examples/physics_restitution.vcxproj +0 -387
  77. package/vendor/raylib/projects/VS2019/examples/physics_shatter.vcxproj +0 -387
  78. package/vendor/raylib/projects/VS2019/examples/raudio_standalone.vcxproj +0 -387
  79. package/vendor/raylib/projects/VS2019/examples/rlgl_standalone.vcxproj +0 -391
  80. package/vendor/raylib/projects/VS2019/examples/shaders_basic_lighting.vcxproj +0 -387
  81. package/vendor/raylib/projects/VS2019/examples/shaders_custom_uniform.vcxproj +0 -387
  82. package/vendor/raylib/projects/VS2019/examples/shaders_eratosthenes.vcxproj +0 -387
  83. package/vendor/raylib/projects/VS2019/examples/shaders_fog.vcxproj +0 -387
  84. package/vendor/raylib/projects/VS2019/examples/shaders_hot_reloading.vcxproj +0 -387
  85. package/vendor/raylib/projects/VS2019/examples/shaders_julia_set.vcxproj +0 -387
  86. package/vendor/raylib/projects/VS2019/examples/shaders_mesh_instancing.vcxproj +0 -387
  87. package/vendor/raylib/projects/VS2019/examples/shaders_model_shader.vcxproj +0 -387
  88. package/vendor/raylib/projects/VS2019/examples/shaders_multi_sample2d.vcxproj +0 -387
  89. package/vendor/raylib/projects/VS2019/examples/shaders_palette_switch.vcxproj +0 -387
  90. package/vendor/raylib/projects/VS2019/examples/shaders_postprocessing.vcxproj +0 -387
  91. package/vendor/raylib/projects/VS2019/examples/shaders_raymarching.vcxproj +0 -387
  92. package/vendor/raylib/projects/VS2019/examples/shaders_shapes_textures.vcxproj +0 -387
  93. package/vendor/raylib/projects/VS2019/examples/shaders_simple_mask.vcxproj +0 -387
  94. package/vendor/raylib/projects/VS2019/examples/shaders_spotlight.vcxproj +0 -387
  95. package/vendor/raylib/projects/VS2019/examples/shaders_texture_drawing.vcxproj +0 -387
  96. package/vendor/raylib/projects/VS2019/examples/shaders_texture_waves.vcxproj +0 -387
  97. package/vendor/raylib/projects/VS2019/examples/shapes_basic_shapes.vcxproj +0 -387
  98. package/vendor/raylib/projects/VS2019/examples/shapes_bouncing_ball.vcxproj +0 -387
  99. package/vendor/raylib/projects/VS2019/examples/shapes_collision_area.vcxproj +0 -387
  100. package/vendor/raylib/projects/VS2019/examples/shapes_colors_palette.vcxproj +0 -387
  101. package/vendor/raylib/projects/VS2019/examples/shapes_draw_circle_sector.vcxproj +0 -387
  102. package/vendor/raylib/projects/VS2019/examples/shapes_draw_rectangle_rounded.vcxproj +0 -387
  103. package/vendor/raylib/projects/VS2019/examples/shapes_draw_ring.vcxproj +0 -387
  104. package/vendor/raylib/projects/VS2019/examples/shapes_easings_ball_anim.vcxproj +0 -387
  105. package/vendor/raylib/projects/VS2019/examples/shapes_easings_box_anim.vcxproj +0 -387
  106. package/vendor/raylib/projects/VS2019/examples/shapes_easings_rectangle_array.vcxproj +0 -387
  107. package/vendor/raylib/projects/VS2019/examples/shapes_following_eyes.vcxproj +0 -387
  108. package/vendor/raylib/projects/VS2019/examples/shapes_lines_bezier.vcxproj +0 -387
  109. package/vendor/raylib/projects/VS2019/examples/shapes_logo_raylib.vcxproj +0 -387
  110. package/vendor/raylib/projects/VS2019/examples/shapes_logo_raylib_anim.vcxproj +0 -387
  111. package/vendor/raylib/projects/VS2019/examples/shapes_rectangle_scaling.vcxproj +0 -387
  112. package/vendor/raylib/projects/VS2019/examples/shapes_top_down_lights.vcxproj +0 -387
  113. package/vendor/raylib/projects/VS2019/examples/text_font_filters.vcxproj +0 -387
  114. package/vendor/raylib/projects/VS2019/examples/text_font_loading.vcxproj +0 -387
  115. package/vendor/raylib/projects/VS2019/examples/text_font_sdf.vcxproj +0 -387
  116. package/vendor/raylib/projects/VS2019/examples/text_font_spritefont.vcxproj +0 -387
  117. package/vendor/raylib/projects/VS2019/examples/text_format_text.vcxproj +0 -387
  118. package/vendor/raylib/projects/VS2019/examples/text_input_box.vcxproj +0 -387
  119. package/vendor/raylib/projects/VS2019/examples/text_raylib_fonts.vcxproj +0 -387
  120. package/vendor/raylib/projects/VS2019/examples/text_rectangle_bounds.vcxproj +0 -387
  121. package/vendor/raylib/projects/VS2019/examples/text_unicode.vcxproj +0 -387
  122. package/vendor/raylib/projects/VS2019/examples/text_writing_anim.vcxproj +0 -387
  123. package/vendor/raylib/projects/VS2019/examples/textures_background_scrolling.vcxproj +0 -387
  124. package/vendor/raylib/projects/VS2019/examples/textures_blend_modes.vcxproj +0 -387
  125. package/vendor/raylib/projects/VS2019/examples/textures_bunnymark.vcxproj +0 -387
  126. package/vendor/raylib/projects/VS2019/examples/textures_draw_tiled.vcxproj +0 -387
  127. package/vendor/raylib/projects/VS2019/examples/textures_image_drawing.vcxproj +0 -387
  128. package/vendor/raylib/projects/VS2019/examples/textures_image_generation.vcxproj +0 -387
  129. package/vendor/raylib/projects/VS2019/examples/textures_image_loading.vcxproj +0 -387
  130. package/vendor/raylib/projects/VS2019/examples/textures_image_processing.vcxproj +0 -387
  131. package/vendor/raylib/projects/VS2019/examples/textures_image_text.vcxproj +0 -387
  132. package/vendor/raylib/projects/VS2019/examples/textures_logo_raylib.vcxproj +0 -387
  133. package/vendor/raylib/projects/VS2019/examples/textures_mouse_painting.vcxproj +0 -387
  134. package/vendor/raylib/projects/VS2019/examples/textures_npatch_drawing.vcxproj +0 -387
  135. package/vendor/raylib/projects/VS2019/examples/textures_particles_blending.vcxproj +0 -387
  136. package/vendor/raylib/projects/VS2019/examples/textures_raw_data.vcxproj +0 -387
  137. package/vendor/raylib/projects/VS2019/examples/textures_rectangle.vcxproj +0 -387
  138. package/vendor/raylib/projects/VS2019/examples/textures_sprite_button.vcxproj +0 -387
  139. package/vendor/raylib/projects/VS2019/examples/textures_sprite_explosion.vcxproj +0 -387
  140. package/vendor/raylib/projects/VS2019/examples/textures_srcrec_dstrec.vcxproj +0 -387
  141. package/vendor/raylib/projects/VS2019/examples/textures_to_image.vcxproj +0 -387
  142. package/vendor/raylib/projects/VS2019/raylib/raylib.vcxproj +0 -341
  143. package/vendor/raylib/projects/VS2019/raylib.sln +0 -2293
  144. package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj +0 -226
  145. package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.filters +0 -10
  146. package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.user +0 -4
  147. package/vendor/raylib/projects/VS2019-Android/raylib_android.sln +0 -75
  148. package/vendor/raylib/projects/VS2022/examples/audio_module_playing.vcxproj +0 -390
  149. package/vendor/raylib/projects/VS2022/examples/audio_multichannel_sound.vcxproj +0 -390
  150. package/vendor/raylib/projects/VS2022/examples/audio_music_stream.vcxproj +0 -390
  151. package/vendor/raylib/projects/VS2022/examples/audio_raw_stream.vcxproj +0 -390
  152. package/vendor/raylib/projects/VS2022/examples/audio_sound_loading.vcxproj +0 -390
  153. package/vendor/raylib/projects/VS2022/examples/core_2d_camera.vcxproj +0 -390
  154. package/vendor/raylib/projects/VS2022/examples/core_2d_camera_platformer.vcxproj +0 -390
  155. package/vendor/raylib/projects/VS2022/examples/core_3d_camera_first_person.vcxproj +0 -390
  156. package/vendor/raylib/projects/VS2022/examples/core_3d_camera_free.vcxproj +0 -390
  157. package/vendor/raylib/projects/VS2022/examples/core_3d_camera_mode.vcxproj +0 -390
  158. package/vendor/raylib/projects/VS2022/examples/core_3d_picking.vcxproj +0 -390
  159. package/vendor/raylib/projects/VS2022/examples/core_basic_window.vcxproj +0 -390
  160. package/vendor/raylib/projects/VS2022/examples/core_custom_logging.vcxproj +0 -390
  161. package/vendor/raylib/projects/VS2022/examples/core_drop_files.vcxproj +0 -390
  162. package/vendor/raylib/projects/VS2022/examples/core_input_gamepad.vcxproj +0 -387
  163. package/vendor/raylib/projects/VS2022/examples/core_input_gestures.vcxproj +0 -387
  164. package/vendor/raylib/projects/VS2022/examples/core_input_keys.vcxproj +0 -387
  165. package/vendor/raylib/projects/VS2022/examples/core_input_mouse.vcxproj +0 -387
  166. package/vendor/raylib/projects/VS2022/examples/core_input_mouse_wheel.vcxproj +0 -387
  167. package/vendor/raylib/projects/VS2022/examples/core_input_multitouch.vcxproj +0 -387
  168. package/vendor/raylib/projects/VS2022/examples/core_loading_thread.vcxproj +0 -387
  169. package/vendor/raylib/projects/VS2022/examples/core_quat_conversion.vcxproj +0 -387
  170. package/vendor/raylib/projects/VS2022/examples/core_random_values.vcxproj +0 -387
  171. package/vendor/raylib/projects/VS2022/examples/core_scissor_test.vcxproj +0 -387
  172. package/vendor/raylib/projects/VS2022/examples/core_split_screen.vcxproj +0 -387
  173. package/vendor/raylib/projects/VS2022/examples/core_storage_values.vcxproj +0 -387
  174. package/vendor/raylib/projects/VS2022/examples/core_vr_simulator.vcxproj +0 -387
  175. package/vendor/raylib/projects/VS2022/examples/core_window_flags.vcxproj +0 -387
  176. package/vendor/raylib/projects/VS2022/examples/core_window_letterbox.vcxproj +0 -387
  177. package/vendor/raylib/projects/VS2022/examples/core_world_screen.vcxproj +0 -387
  178. package/vendor/raylib/projects/VS2022/examples/easings_testbed.vcxproj +0 -387
  179. package/vendor/raylib/projects/VS2022/examples/embedded_files_loading.vcxproj +0 -387
  180. package/vendor/raylib/projects/VS2022/examples/models_animation.vcxproj +0 -387
  181. package/vendor/raylib/projects/VS2022/examples/models_billboard.vcxproj +0 -387
  182. package/vendor/raylib/projects/VS2022/examples/models_box_collisions.vcxproj +0 -387
  183. package/vendor/raylib/projects/VS2022/examples/models_cubicmap.vcxproj +0 -387
  184. package/vendor/raylib/projects/VS2022/examples/models_first_person_maze.vcxproj +0 -387
  185. package/vendor/raylib/projects/VS2022/examples/models_geometric_shapes.vcxproj +0 -387
  186. package/vendor/raylib/projects/VS2022/examples/models_heightmap.vcxproj +0 -387
  187. package/vendor/raylib/projects/VS2022/examples/models_loading.vcxproj +0 -387
  188. package/vendor/raylib/projects/VS2022/examples/models_loading_gltf.vcxproj +0 -387
  189. package/vendor/raylib/projects/VS2022/examples/models_loading_vox.vcxproj +0 -387
  190. package/vendor/raylib/projects/VS2022/examples/models_mesh_generation.vcxproj +0 -387
  191. package/vendor/raylib/projects/VS2022/examples/models_mesh_picking.vcxproj +0 -387
  192. package/vendor/raylib/projects/VS2022/examples/models_orthographic_projection.vcxproj +0 -387
  193. package/vendor/raylib/projects/VS2022/examples/models_rlgl_solar_system.vcxproj +0 -387
  194. package/vendor/raylib/projects/VS2022/examples/models_skybox.vcxproj +0 -387
  195. package/vendor/raylib/projects/VS2022/examples/models_waving_cubes.vcxproj +0 -387
  196. package/vendor/raylib/projects/VS2022/examples/models_yaw_pitch_roll.vcxproj +0 -387
  197. package/vendor/raylib/projects/VS2022/examples/physics_demo.vcxproj +0 -387
  198. package/vendor/raylib/projects/VS2022/examples/physics_friction.vcxproj +0 -387
  199. package/vendor/raylib/projects/VS2022/examples/physics_movement.vcxproj +0 -387
  200. package/vendor/raylib/projects/VS2022/examples/physics_restitution.vcxproj +0 -387
  201. package/vendor/raylib/projects/VS2022/examples/physics_shatter.vcxproj +0 -387
  202. package/vendor/raylib/projects/VS2022/examples/raudio_standalone.vcxproj +0 -387
  203. package/vendor/raylib/projects/VS2022/examples/rlgl_standalone.vcxproj +0 -391
  204. package/vendor/raylib/projects/VS2022/examples/shaders_basic_lighting.vcxproj +0 -387
  205. package/vendor/raylib/projects/VS2022/examples/shaders_custom_uniform.vcxproj +0 -387
  206. package/vendor/raylib/projects/VS2022/examples/shaders_eratosthenes.vcxproj +0 -387
  207. package/vendor/raylib/projects/VS2022/examples/shaders_fog.vcxproj +0 -387
  208. package/vendor/raylib/projects/VS2022/examples/shaders_hot_reloading.vcxproj +0 -387
  209. package/vendor/raylib/projects/VS2022/examples/shaders_julia_set.vcxproj +0 -387
  210. package/vendor/raylib/projects/VS2022/examples/shaders_mesh_instancing.vcxproj +0 -387
  211. package/vendor/raylib/projects/VS2022/examples/shaders_model_shader.vcxproj +0 -387
  212. package/vendor/raylib/projects/VS2022/examples/shaders_multi_sample2d.vcxproj +0 -387
  213. package/vendor/raylib/projects/VS2022/examples/shaders_palette_switch.vcxproj +0 -387
  214. package/vendor/raylib/projects/VS2022/examples/shaders_postprocessing.vcxproj +0 -387
  215. package/vendor/raylib/projects/VS2022/examples/shaders_raymarching.vcxproj +0 -387
  216. package/vendor/raylib/projects/VS2022/examples/shaders_shapes_textures.vcxproj +0 -387
  217. package/vendor/raylib/projects/VS2022/examples/shaders_simple_mask.vcxproj +0 -387
  218. package/vendor/raylib/projects/VS2022/examples/shaders_spotlight.vcxproj +0 -387
  219. package/vendor/raylib/projects/VS2022/examples/shaders_texture_drawing.vcxproj +0 -387
  220. package/vendor/raylib/projects/VS2022/examples/shaders_texture_waves.vcxproj +0 -387
  221. package/vendor/raylib/projects/VS2022/examples/shapes_basic_shapes.vcxproj +0 -387
  222. package/vendor/raylib/projects/VS2022/examples/shapes_bouncing_ball.vcxproj +0 -387
  223. package/vendor/raylib/projects/VS2022/examples/shapes_collision_area.vcxproj +0 -387
  224. package/vendor/raylib/projects/VS2022/examples/shapes_colors_palette.vcxproj +0 -387
  225. package/vendor/raylib/projects/VS2022/examples/shapes_draw_circle_sector.vcxproj +0 -387
  226. package/vendor/raylib/projects/VS2022/examples/shapes_draw_rectangle_rounded.vcxproj +0 -387
  227. package/vendor/raylib/projects/VS2022/examples/shapes_draw_ring.vcxproj +0 -387
  228. package/vendor/raylib/projects/VS2022/examples/shapes_easings_ball_anim.vcxproj +0 -387
  229. package/vendor/raylib/projects/VS2022/examples/shapes_easings_box_anim.vcxproj +0 -387
  230. package/vendor/raylib/projects/VS2022/examples/shapes_easings_rectangle_array.vcxproj +0 -387
  231. package/vendor/raylib/projects/VS2022/examples/shapes_following_eyes.vcxproj +0 -387
  232. package/vendor/raylib/projects/VS2022/examples/shapes_lines_bezier.vcxproj +0 -387
  233. package/vendor/raylib/projects/VS2022/examples/shapes_logo_raylib.vcxproj +0 -387
  234. package/vendor/raylib/projects/VS2022/examples/shapes_logo_raylib_anim.vcxproj +0 -387
  235. package/vendor/raylib/projects/VS2022/examples/shapes_rectangle_scaling.vcxproj +0 -387
  236. package/vendor/raylib/projects/VS2022/examples/text_font_filters.vcxproj +0 -387
  237. package/vendor/raylib/projects/VS2022/examples/text_font_loading.vcxproj +0 -387
  238. package/vendor/raylib/projects/VS2022/examples/text_font_sdf.vcxproj +0 -387
  239. package/vendor/raylib/projects/VS2022/examples/text_font_spritefont.vcxproj +0 -387
  240. package/vendor/raylib/projects/VS2022/examples/text_format_text.vcxproj +0 -387
  241. package/vendor/raylib/projects/VS2022/examples/text_input_box.vcxproj +0 -387
  242. package/vendor/raylib/projects/VS2022/examples/text_raylib_fonts.vcxproj +0 -387
  243. package/vendor/raylib/projects/VS2022/examples/text_rectangle_bounds.vcxproj +0 -387
  244. package/vendor/raylib/projects/VS2022/examples/text_unicode.vcxproj +0 -387
  245. package/vendor/raylib/projects/VS2022/examples/text_writing_anim.vcxproj +0 -387
  246. package/vendor/raylib/projects/VS2022/examples/textures_background_scrolling.vcxproj +0 -387
  247. package/vendor/raylib/projects/VS2022/examples/textures_blend_modes.vcxproj +0 -387
  248. package/vendor/raylib/projects/VS2022/examples/textures_bunnymark.vcxproj +0 -387
  249. package/vendor/raylib/projects/VS2022/examples/textures_draw_tiled.vcxproj +0 -387
  250. package/vendor/raylib/projects/VS2022/examples/textures_image_drawing.vcxproj +0 -387
  251. package/vendor/raylib/projects/VS2022/examples/textures_image_generation.vcxproj +0 -387
  252. package/vendor/raylib/projects/VS2022/examples/textures_image_loading.vcxproj +0 -387
  253. package/vendor/raylib/projects/VS2022/examples/textures_image_processing.vcxproj +0 -387
  254. package/vendor/raylib/projects/VS2022/examples/textures_image_text.vcxproj +0 -387
  255. package/vendor/raylib/projects/VS2022/examples/textures_logo_raylib.vcxproj +0 -387
  256. package/vendor/raylib/projects/VS2022/examples/textures_mouse_painting.vcxproj +0 -387
  257. package/vendor/raylib/projects/VS2022/examples/textures_npatch_drawing.vcxproj +0 -387
  258. package/vendor/raylib/projects/VS2022/examples/textures_particles_blending.vcxproj +0 -387
  259. package/vendor/raylib/projects/VS2022/examples/textures_raw_data.vcxproj +0 -387
  260. package/vendor/raylib/projects/VS2022/examples/textures_rectangle.vcxproj +0 -387
  261. package/vendor/raylib/projects/VS2022/examples/textures_sprite_button.vcxproj +0 -387
  262. package/vendor/raylib/projects/VS2022/examples/textures_sprite_explosion.vcxproj +0 -387
  263. package/vendor/raylib/projects/VS2022/examples/textures_srcrec_dstrec.vcxproj +0 -387
  264. package/vendor/raylib/projects/VS2022/examples/textures_to_image.vcxproj +0 -387
  265. package/vendor/raylib/projects/VS2022/raylib/raylib.vcxproj +0 -340
  266. package/vendor/raylib/projects/VS2022/raylib.sln +0 -2274
package/CMakeLists.txt CHANGED
@@ -11,7 +11,7 @@
11
11
  # You should have received a copy of the GNU Affero General Public License
12
12
  # along with this program. If not, see https://www.gnu.org/licenses/.
13
13
 
14
- cmake_minimum_required(VERSION 3.11)
14
+ cmake_minimum_required(VERSION 3.12)
15
15
  project(koffi C CXX ASM)
16
16
 
17
17
  find_package(CNoke)
@@ -65,59 +65,3 @@ else()
65
65
  target_compile_options(koffi PRIVATE -fno-exceptions -Wno-missing-field-initializers
66
66
  -fno-strict-aliasing)
67
67
  endif()
68
-
69
- # ---- Raylib ----
70
-
71
- add_library(raylib SHARED
72
- vendor/raylib/src/rcore.c
73
- vendor/raylib/src/rshapes.c
74
- vendor/raylib/src/rtextures.c
75
- vendor/raylib/src/rtext.c
76
- vendor/raylib/src/rmodels.c
77
- vendor/raylib/src/utils.c
78
- vendor/raylib/src/rglfw.c
79
- vendor/raylib/src/raudio.c
80
- )
81
- set_target_properties(raylib PROPERTIES PREFIX "")
82
- target_include_directories(raylib PRIVATE vendor/raylib/src/external/glfw/include)
83
- target_compile_definitions(raylib PRIVATE PLATFORM_DESKTOP GRAPHICS_API_OPENGL_21
84
- BUILD_LIBTYPE_SHARED NDEBUG)
85
-
86
- if(MSVC)
87
- target_compile_options(raylib PRIVATE /wd4244 /wd4305)
88
- else()
89
- target_compile_options(raylib PRIVATE -Wno-sign-compare -Wno-old-style-declaration
90
- -Wno-unused-function -Wno-missing-field-initializers
91
- -Wno-unused-value -Wno-implicit-fallthrough -Wno-stringop-overflow
92
- -Wno-unused-result)
93
- endif()
94
-
95
- if(WIN32)
96
- target_compile_definitions(raylib PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
97
- target_link_libraries(raylib PRIVATE winmm)
98
- endif()
99
-
100
- if(CMAKE_SYSTEM_NAME MATCHES "BSD")
101
- target_include_directories(raylib PRIVATE /usr/local/include)
102
- endif()
103
-
104
- if(APPLE)
105
- target_compile_options(raylib PRIVATE -Wno-unknown-warning-option -Wno-macro-redefined)
106
- target_compile_definitions(raylib PRIVATE GL_SILENCE_DEPRECATION)
107
- set_source_files_properties(vendor/raylib/src/rglfw.c PROPERTIES COMPILE_FLAGS "-x objective-c")
108
- target_link_libraries(raylib PRIVATE "-framework Cocoa" "-framework IOKit" "-framework CoreFoundation" "-framework OpenGL")
109
- endif()
110
-
111
- # ---- SQLite ----
112
-
113
- add_library(sqlite3 SHARED vendor/sqlite3/sqlite3.c)
114
- set_target_properties(sqlite3 PROPERTIES PREFIX "")
115
-
116
- if(WIN32)
117
- target_compile_definitions(sqlite3 PRIVATE SQLITE_API=__declspec\(dllexport\))
118
- endif()
119
-
120
- # ---- Misc ----
121
-
122
- add_library(misc SHARED test/tests/misc.c)
123
- set_target_properties(misc PROPERTIES PREFIX "")
package/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
  * [Other platforms](#other-platforms)
7
7
  - [Get started](#get-started)
8
8
  - [Tests](#tests)
9
+ - [Benchmarks](#benchmarks)
9
10
 
10
11
  # Introduction
11
12
 
@@ -264,16 +265,16 @@ Here are some results from 2022-04-15 on my machine (AMD Ryzen™ 7 5800H 16G):
264
265
  $ time ./raylib_c 200
265
266
  Iterations: 200
266
267
 
267
- real 0m9,206s
268
- user 0m9,152s
269
- sys 0m0,040s
268
+ real 0m8,871s
269
+ user 0m8,792s
270
+ sys 0m0,016s
270
271
 
271
272
  $ time ./raylib_koffi.js 200
272
273
  Iterations: 200
273
274
 
274
- real 0m13,790s
275
- user 0m13,699s
276
- sys 0m0,044s
275
+ real 0m13,011s
276
+ user 0m12,923s
277
+ sys 0m0,032s
277
278
 
278
279
  $ time ./raylib_node_ffi.js 200
279
280
  Iterations: 200
@@ -0,0 +1,13 @@
1
+ #!/bin/sh -e
2
+
3
+ cd $(dirname $0)/..
4
+
5
+ echo "Install all dependencies..."
6
+ npm install
7
+
8
+ echo "Building dependencies..."
9
+ node ../cnoke/cnoke.js
10
+ node ../cnoke/cnoke.js -C test
11
+
12
+ echo "Building raylib_c..."
13
+ gcc -O2 -std=gnu99 -Wall -Wl,-rpath,$(realpath $(pwd)/test/build) -fPIC benchmark/raylib_c.c -o benchmark/raylib_c test/build/raylib.so -lm -pthread -ldl
Binary file
@@ -0,0 +1,83 @@
1
+ // This program is free software: you can redistribute it and/or modify
2
+ // it under the terms of the GNU Affero General Public License as published by
3
+ // the Free Software Foundation, either version 3 of the License, or
4
+ // (at your option) any later version.
5
+ //
6
+ // This program is distributed in the hope that it will be useful,
7
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
8
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
+ // GNU Affero General Public License for more details.
10
+ //
11
+ // You should have received a copy of the GNU Affero General Public License
12
+ // along with this program. If not, see https://www.gnu.org/licenses/.
13
+
14
+ #include <math.h>
15
+ #include <stdio.h>
16
+ #include <stdlib.h>
17
+ #include <limits.h>
18
+ #include "../vendor/raylib/src/raylib.h"
19
+
20
+ #define STRINGIFY(Value) # Value
21
+
22
+ static int ParseInt(const char *str)
23
+ {
24
+ char *end;
25
+ long long value = strtoll(str, &end, 10);
26
+
27
+ if (end == str || *end) {
28
+ fprintf(stderr, "Not a valid integer number\n");
29
+ return -1;
30
+ }
31
+ if (value < 1 || value == LLONG_MAX) {
32
+ fprintf(stderr, "Value must be between 1 and " STRINGIFY(LLONG_MAX) "\n");
33
+ return -1;
34
+ }
35
+
36
+ return (int)value;
37
+ }
38
+
39
+ int main(int argc, char **argv)
40
+ {
41
+ if (argc < 2) {
42
+ fprintf(stderr, "Missing number of iterations\n");
43
+ return 1;
44
+ }
45
+
46
+ int iterations = ParseInt(argv[1]);
47
+ if (iterations < 0)
48
+ return 1;
49
+ printf("Iterations: %d\n", iterations);
50
+
51
+ // We need to call InitWindow before using anything else (such as fonts)
52
+ SetTraceLogLevel(4); // Warnings
53
+ SetWindowState(0x80); // Hidden
54
+ InitWindow(640, 480, "Raylib Test");
55
+
56
+ Image img = GenImageColor(800, 600, (Color){ .r = 0, .g = 0, .b = 0, .a = 255 });
57
+ Font font = GetFontDefault();
58
+
59
+ for (int i = 0; i < iterations; i++) {
60
+ ImageClearBackground(&img, (Color){ .r = 0, .g = 0, .b = 0, .a = 255 });
61
+
62
+ for (int j = 0; j < 3600; j++) {
63
+ const char *text = "Hello World!";
64
+ int text_width = MeasureTextEx(font, text, 10, 1).x;
65
+
66
+ double angle = (j * 7) * PI / 180;
67
+ Color color = {
68
+ .r = 127.5 + 127.5 * sin(angle),
69
+ .g = 127.5 + 127.5 * sin(angle + PI / 2),
70
+ .b = 127.5 + 127.5 * sin(angle + PI),
71
+ .a = 255
72
+ };
73
+ Vector2 pos = {
74
+ .x = (img.width / 2 - text_width / 2) + j * 0.1 * cos(angle - PI / 2),
75
+ .y = (img.height / 2 - 16) + j * 0.1 * sin(angle - PI / 2)
76
+ };
77
+
78
+ ImageDrawTextEx(&img, font, text, pos, 10, 1, color);
79
+ }
80
+ }
81
+
82
+ return 0;
83
+ }
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env node
2
+
3
+ // This program is free software: you can redistribute it and/or modify
4
+ // it under the terms of the GNU Affero General Public License as published by
5
+ // the Free Software Foundation, either version 3 of the License, or
6
+ // (at your option) any later version.
7
+ //
8
+ // This program is distributed in the hope that it will be useful,
9
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ // GNU Affero General Public License for more details.
12
+ //
13
+ // You should have received a copy of the GNU Affero General Public License
14
+ // along with this program. If not, see https://www.gnu.org/licenses/.
15
+
16
+ const koffi = require('../build/koffi.node');
17
+ const path = require('path');
18
+
19
+ const Color = koffi.struct('Color', {
20
+ r: 'uchar',
21
+ g: 'uchar',
22
+ b: 'uchar',
23
+ a: 'uchar'
24
+ });
25
+
26
+ const Image = koffi.struct('Image', {
27
+ data: koffi.pointer('void'),
28
+ width: 'int',
29
+ height: 'int',
30
+ mipmaps: 'int',
31
+ format: 'int'
32
+ });
33
+
34
+ const GlyphInfo = koffi.struct('GlyphInfo', {
35
+ value: 'int',
36
+ offsetX: 'int',
37
+ offsetY: 'int',
38
+ advanceX: 'int',
39
+ image: Image
40
+ });
41
+
42
+ const Vector2 = koffi.struct('Vector2', {
43
+ x: 'float',
44
+ y: 'float'
45
+ });
46
+
47
+ const Rectangle = koffi.struct('Rectangle', {
48
+ x: 'float',
49
+ y: 'float',
50
+ width: 'float',
51
+ height: 'float'
52
+ });
53
+
54
+ const Texture = koffi.struct('Texture', {
55
+ id: 'uint',
56
+ width: 'int',
57
+ height: 'int',
58
+ mipmaps: 'int',
59
+ format: 'int'
60
+ });
61
+
62
+ const Font = koffi.struct('Font', {
63
+ baseSize: 'int',
64
+ glyphCount: 'int',
65
+ glyphPadding: 'int',
66
+ texture: Texture,
67
+ recs: koffi.pointer(Rectangle),
68
+ glyphs: koffi.pointer(GlyphInfo)
69
+ });
70
+
71
+ main();
72
+
73
+ function main() {
74
+ if (process.argv.length < 3)
75
+ throw new Error('Missing number of iterations');
76
+
77
+ let iterations = parseInt(process.argv[2], 10);
78
+ if (Number.isNaN(iterations))
79
+ throw new Error('Not a valid number');
80
+ if (iterations < 1)
81
+ throw new Error('Value must be positive');
82
+ console.log('Iterations:', iterations);
83
+
84
+ let lib_filename = path.dirname(__filename) + '/../test/build/raylib' + koffi.extension;
85
+ let lib = koffi.load(lib_filename);
86
+
87
+ const InitWindow = lib.cdecl('InitWindow', 'void', ['int', 'int', 'string']);
88
+ const SetTraceLogLevel = lib.cdecl('SetTraceLogLevel', 'void', ['int']);
89
+ const SetWindowState = lib.cdecl('SetWindowState', 'void', ['uint']);
90
+ const GenImageColor = lib.cdecl('GenImageColor', Image, ['int', 'int', Color]);
91
+ const GetFontDefault = lib.cdecl('GetFontDefault', Font, []);
92
+ const MeasureTextEx = lib.cdecl('MeasureTextEx', Vector2, [Font, 'string', 'float', 'float']);
93
+ const ImageClearBackground = lib.cdecl('ImageClearBackground', 'void', [koffi.pointer(Image), Color]);
94
+ const ImageDrawTextEx = lib.cdecl('ImageDrawTextEx', 'void', [koffi.pointer(Image), Font, 'string', Vector2, 'float', 'float', Color]);
95
+ const ExportImage = lib.cdecl('ExportImage', 'bool', [Image, 'string']);
96
+
97
+ // We need to call InitWindow before using anything else (such as fonts)
98
+ SetTraceLogLevel(4); // Warnings
99
+ SetWindowState(0x80); // Hidden
100
+ InitWindow(640, 480, "Raylib Test");
101
+
102
+ let img = GenImageColor(800, 600, { r: 0, g: 0, b: 0, a: 255 });
103
+ let font = GetFontDefault();
104
+
105
+ for (let i = 0; i < iterations; i++) {
106
+ ImageClearBackground(img, { r: 0, g: 0, b: 0, a: 255 });
107
+
108
+ for (let j = 0; j < 3600; j++) {
109
+ let text = 'Hello World!';
110
+ let text_width = MeasureTextEx(font, text, 10, 1).x;
111
+
112
+ let angle = (j * 7) * Math.PI / 180;
113
+ let color = {
114
+ r: 127.5 + 127.5 * Math.sin(angle),
115
+ g: 127.5 + 127.5 * Math.sin(angle + Math.PI / 2),
116
+ b: 127.5 + 127.5 * Math.sin(angle + Math.PI),
117
+ a: 255
118
+ };
119
+ let pos = {
120
+ x: (img.width / 2 - text_width / 2) + j * 0.1 * Math.cos(angle - Math.PI / 2),
121
+ y: (img.height / 2 - 16) + j * 0.1 * Math.sin(angle - Math.PI / 2)
122
+ };
123
+
124
+ ImageDrawTextEx(img, font, text, pos, 10, 1, color);
125
+ }
126
+ }
127
+ }
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+
3
+ // This program is free software: you can redistribute it and/or modify
4
+ // it under the terms of the GNU Affero General Public License as published by
5
+ // the Free Software Foundation, either version 3 of the License, or
6
+ // (at your option) any later version.
7
+ //
8
+ // This program is distributed in the hope that it will be useful,
9
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ // GNU Affero General Public License for more details.
12
+ //
13
+ // You should have received a copy of the GNU Affero General Public License
14
+ // along with this program. If not, see https://www.gnu.org/licenses/.
15
+
16
+ const ref = require('ref-napi');
17
+ const ffi = require('ffi-napi');
18
+ const struct = require('ref-struct-di')(ref);
19
+ const path = require('path');
20
+
21
+ const Color = struct({
22
+ r: 'uchar',
23
+ g: 'uchar',
24
+ b: 'uchar',
25
+ a: 'uchar'
26
+ });
27
+
28
+ const Image = struct({
29
+ data: ref.refType(ref.types.void),
30
+ width: 'int',
31
+ height: 'int',
32
+ mipmaps: 'int',
33
+ format: 'int'
34
+ });
35
+
36
+ const GlyphInfo = struct({
37
+ value: 'int',
38
+ offsetX: 'int',
39
+ offsetY: 'int',
40
+ advanceX: 'int',
41
+ image: Image
42
+ });
43
+
44
+ const Vector2 = struct({
45
+ x: 'float',
46
+ y: 'float'
47
+ });
48
+
49
+ const Vector3 = struct({
50
+ x: 'float',
51
+ y: 'float',
52
+ z: 'float'
53
+ });
54
+
55
+ const Vector4 = struct({
56
+ x: 'float',
57
+ y: 'float',
58
+ z: 'float',
59
+ w: 'float'
60
+ });
61
+
62
+ const Rectangle = struct({
63
+ x: 'float',
64
+ y: 'float',
65
+ width: 'float',
66
+ height: 'float'
67
+ });
68
+
69
+ const Texture = struct({
70
+ id: 'uint',
71
+ width: 'int',
72
+ height: 'int',
73
+ mipmaps: 'int',
74
+ format: 'int'
75
+ });
76
+
77
+ const Font = struct({
78
+ baseSize: 'int',
79
+ glyphCount: 'int',
80
+ glyphPadding: 'int',
81
+ texture: Texture,
82
+ recs: ref.refType(Rectangle),
83
+ glyphs: ref.refType(GlyphInfo)
84
+ });
85
+
86
+ main();
87
+
88
+ function main() {
89
+ if (process.argv.length < 3)
90
+ throw new Error('Missing number of iterations');
91
+
92
+ let iterations = parseInt(process.argv[2], 10);
93
+ if (Number.isNaN(iterations))
94
+ throw new Error('Not a valid number');
95
+ if (iterations < 1)
96
+ throw new Error('Value must be positive');
97
+ console.log('Iterations:', iterations);
98
+
99
+ let lib_filename = path.dirname(__filename) + '/../test/build/raylib' + koffi.extension;
100
+
101
+ const r = ffi.Library(lib_filename, {
102
+ InitWindow: ['void', ['int', 'int', 'string']],
103
+ SetTraceLogLevel: ['void', ['int']],
104
+ SetWindowState: ['void', ['uint']],
105
+ GenImageColor: [Image, ['int', 'int', Color]],
106
+ GetFontDefault: [Font, []],
107
+ MeasureTextEx: [Vector2, [Font, 'string', 'float', 'float']],
108
+ ImageClearBackground: ['void', [ref.refType(Image), Color]],
109
+ ImageDrawTextEx: ['void', [ref.refType(Image), Font, 'string', Vector2, 'float', 'float', Color]],
110
+ ExportImage: ['bool', [Image, 'string']]
111
+ });
112
+
113
+ // We need to call InitWindow before using anything else (such as fonts)
114
+ r.SetTraceLogLevel(4); // Warnings
115
+ r.SetWindowState(0x80); // Hidden
116
+ r.InitWindow(640, 480, "Raylib Test");
117
+
118
+ let img = r.GenImageColor(800, 600, new Color({ r: 0, g: 0, b: 0, a: 255 }));
119
+ let imgp = img.ref();
120
+ let font = r.GetFontDefault();
121
+
122
+ for (let i = 0; i < iterations; i++) {
123
+ r.ImageClearBackground(imgp, new Color({ r: 0, g: 0, b: 0, a: 255 }));
124
+
125
+ for (let j = 0; j < 3600; j++) {
126
+ let text = 'Hello World!';
127
+ let text_width = r.MeasureTextEx(font, text, 10, 1).x;
128
+
129
+ let angle = (j * 7) * Math.PI / 180;
130
+ let color = new Color({
131
+ r: 127.5 + 127.5 * Math.sin(angle),
132
+ g: 127.5 + 127.5 * Math.sin(angle + Math.PI / 2),
133
+ b: 127.5 + 127.5 * Math.sin(angle + Math.PI),
134
+ a: 255
135
+ });
136
+ let pos = new Vector2({
137
+ x: (img.width / 2 - text_width / 2) + j * 0.1 * Math.cos(angle - Math.PI / 2),
138
+ y: (img.height / 2 - 16) + j * 0.1 * Math.sin(angle - Math.PI / 2)
139
+ });
140
+
141
+ r.ImageDrawTextEx(imgp, font, text, pos, 10, 1, color);
142
+ }
143
+ }
144
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koffi",
3
- "version": "0.9.20",
3
+ "version": "0.9.23",
4
4
  "description": "Fast and simple FFI (foreign function interface) for Node.js",
5
5
  "keywords": [
6
6
  "foreign",
@@ -18,7 +18,7 @@
18
18
  "author": "Niels Martignène <niels.martignene@protonmail.com>",
19
19
  "main": "src/index.js",
20
20
  "scripts": {
21
- "install": "cnoke koffi",
21
+ "install": "cnoke",
22
22
  "test": "node test/test.js"
23
23
  },
24
24
  "license": "AGPL-3.0",
@@ -28,12 +28,14 @@
28
28
  "devDependencies": {
29
29
  "chalk": "^4.1.2",
30
30
  "ffi-napi": "^4.0.3",
31
+ "minimatch": "^5.0.1",
31
32
  "node-ssh": "^12.0.3",
32
33
  "ref-napi": "^3.0.3",
33
34
  "ref-struct-di": "^1.1.1"
34
35
  },
35
36
  "files": [
36
37
  "src",
38
+ "benchmark",
37
39
  "test/files",
38
40
  "test/registry",
39
41
  "test/tests",
package/src/call_arm32.cc CHANGED
@@ -63,8 +63,8 @@ Napi::Function::Callback AnalyseFunction(InstanceData *, FunctionInfo *func)
63
63
  if (IsHFA(func->ret.type)) {
64
64
  func->ret.vec_count = func->ret.type->members.len *
65
65
  (func->ret.type->members[0].type->size / 4);
66
- } else if (func->ret.type->size <= 4) {
67
- func->ret.gpr_count = 1;
66
+ } else if (func->ret.type->primitive != PrimitiveKind::Record) {
67
+ func->ret.gpr_count = (func->ret.type->size >= 4) ? 2 : 1;
68
68
  } else {
69
69
  func->ret.use_memory = true;
70
70
  }
@@ -267,7 +267,8 @@ static Napi::Value TranslateCall(const Napi::CallbackInfo &info)
267
267
  if (RG_LIKELY(param.gpr_count)) {
268
268
  *(gpr_ptr++) = (uint32_t)b;
269
269
  } else {
270
- *(args_ptr++) = (uint8_t)b;
270
+ *args_ptr = (uint8_t)b;
271
+ args_ptr += 4;
271
272
  }
272
273
  } break;
273
274
  case PrimitiveKind::Int8:
@@ -286,9 +287,8 @@ static Napi::Value TranslateCall(const Napi::CallbackInfo &info)
286
287
  if (RG_LIKELY(param.gpr_count)) {
287
288
  *(gpr_ptr++) = (uint32_t)v;
288
289
  } else {
289
- args_ptr = AlignUp(args_ptr, param.type->align);
290
290
  memcpy(args_ptr, &v, param.type->size); // Little Endian
291
- args_ptr += param.type->size;
291
+ args_ptr += 4;
292
292
  }
293
293
  } break;
294
294
  case PrimitiveKind::Int64:
@@ -320,7 +320,6 @@ static Napi::Value TranslateCall(const Napi::CallbackInfo &info)
320
320
  if (RG_LIKELY(param.vec_count)) {
321
321
  memcpy(vec_ptr++, &f, 4);
322
322
  } else {
323
- args_ptr = AlignUp(args_ptr, 4);
324
323
  memcpy(args_ptr, &f, 4);
325
324
  args_ptr += 4;
326
325
  }
@@ -358,7 +357,6 @@ static Napi::Value TranslateCall(const Napi::CallbackInfo &info)
358
357
  if (RG_LIKELY(param.gpr_count)) {
359
358
  *(gpr_ptr++) = (uint64_t)str;
360
359
  } else {
361
- args_ptr = AlignUp(args_ptr, 4);
362
360
  *(const char **)args_ptr = str;
363
361
  args_ptr += 4;
364
362
  }
@@ -390,7 +388,6 @@ static Napi::Value TranslateCall(const Napi::CallbackInfo &info)
390
388
  if (RG_LIKELY(param.gpr_count)) {
391
389
  *(gpr_ptr++) = (uint64_t)ptr;
392
390
  } else {
393
- args_ptr = AlignUp(args_ptr, 4);
394
391
  *(void **)args_ptr = ptr;
395
392
  args_ptr += 4;
396
393
  }
package/src/call_arm64.cc CHANGED
@@ -123,7 +123,7 @@ Napi::Function::Callback AnalyseFunction(InstanceData *, FunctionInfo *func)
123
123
  } else {
124
124
  gpr_avail = 0;
125
125
  }
126
- } else if (gpr_avail) {
126
+ } else {
127
127
  // Big types (more than 16 bytes) are replaced by a pointer
128
128
  if (gpr_avail) {
129
129
  param.gpr_count = 1;
@@ -255,7 +255,12 @@ static Napi::Value TranslateCall(const Napi::CallbackInfo &info)
255
255
  if (RG_LIKELY(param.gpr_count)) {
256
256
  *(gpr_ptr++) = (uint64_t)b;
257
257
  } else {
258
- *(args_ptr++) = (uint8_t)b;
258
+ *args_ptr = (uint8_t)b;
259
+ #ifdef __APPLE__
260
+ args_ptr++;
261
+ #else
262
+ args_ptr += 8;
263
+ #endif
259
264
  }
260
265
  } break;
261
266
  case PrimitiveKind::Int8:
@@ -278,7 +283,11 @@ static Napi::Value TranslateCall(const Napi::CallbackInfo &info)
278
283
  } else {
279
284
  args_ptr = AlignUp(args_ptr, param.type->align);
280
285
  memcpy(args_ptr, &v, param.type->size); // Little Endian
286
+ #ifdef __APPLE__
281
287
  args_ptr += param.type->size;
288
+ #else
289
+ args_ptr += 8;
290
+ #endif
282
291
  }
283
292
  } break;
284
293
  case PrimitiveKind::Float32: {
@@ -294,7 +303,11 @@ static Napi::Value TranslateCall(const Napi::CallbackInfo &info)
294
303
  } else {
295
304
  args_ptr = AlignUp(args_ptr, 4);
296
305
  memcpy(args_ptr, &f, 4);
306
+ #ifdef __APPLE__
297
307
  args_ptr += 4;
308
+ #else
309
+ args_ptr += 8;
310
+ #endif
298
311
  }
299
312
  } break;
300
313
  case PrimitiveKind::Float64: {
@@ -387,9 +400,7 @@ static Napi::Value TranslateCall(const Napi::CallbackInfo &info)
387
400
  return env.Null();
388
401
  gpr_ptr += param.gpr_count;
389
402
  } else if (param.type->size) {
390
- int16_t align = (param.type->align <= 4) ? 4 : 8;
391
-
392
- args_ptr = AlignUp(args_ptr, align);
403
+ args_ptr = AlignUp(args_ptr, 8);
393
404
  if (!call.PushObject(obj, param.type, args_ptr))
394
405
  return env.Null();
395
406
  args_ptr += AlignLen(param.type->size, 8);
@@ -11,16 +11,22 @@
11
11
  // You should have received a copy of the GNU Affero General Public License
12
12
  // along with this program. If not, see https://www.gnu.org/licenses/.
13
13
 
14
+ #ifdef __APPLE__
15
+ #define SYMBOL(Symbol) _ ## Symbol
16
+ #else
17
+ #define SYMBOL(Symbol) Symbol
18
+ #endif
19
+
14
20
  // These three are the same, but they differ (in the C side) by their return type.
15
21
  // Unlike the three next functions, these ones don't forward XMM argument registers.
16
- .global ForwardCallGG
17
- .global ForwardCallF
18
- .global ForwardCallDDDD
22
+ .global SYMBOL(ForwardCallGG)
23
+ .global SYMBOL(ForwardCallF)
24
+ .global SYMBOL(ForwardCallDDDD)
19
25
 
20
26
  // The X variants are slightly slower, and are used when XMM arguments must be forwarded.
21
- .global ForwardCallXGG
22
- .global ForwardCallXF
23
- .global ForwardCallXDDDD
27
+ .global SYMBOL(ForwardCallXGG)
28
+ .global SYMBOL(ForwardCallXF)
29
+ .global SYMBOL(ForwardCallXDDDD)
24
30
 
25
31
  // Copy function pointer to r9, in order to save it through argument forwarding.
26
32
  // Save RSP in r29 (non-volatile), and use carefully assembled stack provided by caller.
@@ -76,34 +82,34 @@
76
82
  ldr d0, [x1, 72]
77
83
  .endm
78
84
 
79
- ForwardCallGG:
85
+ SYMBOL(ForwardCallGG):
80
86
  prologue
81
87
  forward_int
82
88
  epilogue
83
89
 
84
- ForwardCallF:
90
+ SYMBOL(ForwardCallF):
85
91
  prologue
86
92
  forward_int
87
93
  epilogue
88
94
 
89
- ForwardCallDDDD:
95
+ SYMBOL(ForwardCallDDDD):
90
96
  prologue
91
97
  forward_int
92
98
  epilogue
93
99
 
94
- ForwardCallXGG:
100
+ SYMBOL(ForwardCallXGG):
95
101
  prologue
96
102
  forward_vec
97
103
  forward_int
98
104
  epilogue
99
105
 
100
- ForwardCallXF:
106
+ SYMBOL(ForwardCallXF):
101
107
  prologue
102
108
  forward_vec
103
109
  forward_int
104
110
  epilogue
105
111
 
106
- ForwardCallXDDDD:
112
+ SYMBOL(ForwardCallXDDDD):
107
113
  prologue
108
114
  forward_vec
109
115
  forward_int