koffi 2.1.0-beta.3 → 2.1.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.
- package/ChangeLog.md +2 -1
- package/build/qemu/2.1.0/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0/koffi_win32_x64.tar.gz +0 -0
- package/doc/benchmarks.md +14 -14
- package/doc/benchmarks.xlsx +0 -0
- package/doc/index.rst +2 -2
- package/doc/static/perf_linux_20220812.png +0 -0
- package/doc/static/perf_windows_20220812.png +0 -0
- package/doc/types.md +10 -12
- package/package.json +2 -2
- package/qemu/registry/machines.json +2 -2
- package/qemu/registry/sha256sum.txt +2 -2
- package/src/abi_arm32.cc +23 -55
- package/src/abi_arm64.cc +22 -54
- package/src/abi_riscv64.cc +20 -52
- package/src/abi_x64_sysv.cc +20 -52
- package/src/abi_x64_win.cc +20 -52
- package/src/abi_x86.cc +24 -56
- package/src/call.cc +117 -143
- package/src/call.hh +4 -4
- package/src/ffi.cc +16 -4
- package/src/util.hh +0 -20
- package/test/callbacks.js +3 -3
- package/test/misc.c +2 -2
- package/test/sync.js +2 -2
- package/vendor/libcc/libcc.cc +75 -55
- package/vendor/libcc/libcc.hh +306 -255
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj +226 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.filters +10 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android/raylib_android.NativeActivity/raylib_android.NativeActivity.vcxproj.user +4 -0
- package/vendor/raylib/projects/VS2019-Android/raylib_android.sln +75 -0
- package/vendor/raylib/projects/VS2022/examples/audio_module_playing.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/audio_multichannel_sound.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/audio_music_stream.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/audio_raw_stream.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/audio_sound_loading.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/audio_stream_effects.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_2d_camera.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_2d_camera_mouse_zoom.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_2d_camera_platformer.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_3d_camera_first_person.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_3d_camera_free.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_3d_camera_mode.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_3d_picking.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_basic_screen_manager.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_basic_window.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_custom_frame_control.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_custom_logging.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_drop_files.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_gamepad.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_gestures.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_keys.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_mouse.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_mouse_wheel.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_input_multitouch.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_loading_thread.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_random_values.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_scissor_test.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_split_screen.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_storage_values.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_vr_simulator.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_window_flags.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_window_letterbox.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/core_window_should_close.vcxproj +390 -0
- package/vendor/raylib/projects/VS2022/examples/core_world_screen.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/easings_testbed.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/embedded_files_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_animation.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_billboard.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_box_collisions.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_cubicmap.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_first_person_maze.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_geometric_shapes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_heightmap.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_loading_gltf.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_loading_vox.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_mesh_generation.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_mesh_picking.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_orthographic_projection.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_rlgl_solar_system.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_skybox.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_waving_cubes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/models_yaw_pitch_roll.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/rlgl_compute_shaders.vcxproj +391 -0
- package/vendor/raylib/projects/VS2022/examples/rlgl_standalone.vcxproj +391 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_basic_lighting.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_custom_uniform.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_eratosthenes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_fog.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_hot_reloading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_julia_set.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_mesh_instancing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_model_shader.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_multi_sample2d.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_palette_switch.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_postprocessing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_raymarching.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_shapes_textures.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_simple_mask.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_spotlight.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_texture_drawing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shaders_texture_waves.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_basic_shapes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_bouncing_ball.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_collision_area.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_colors_palette.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_draw_circle_sector.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_draw_rectangle_rounded.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_draw_ring.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_easings_ball_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_easings_box_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_easings_rectangle_array.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_following_eyes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_lines_bezier.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_logo_raylib.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_logo_raylib_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/shapes_rectangle_scaling.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_codepoints_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_draw_3d.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_font_filters.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_font_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_font_sdf.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_font_spritefont.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_format_text.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_input_box.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_raylib_fonts.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_rectangle_bounds.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_unicode.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/text_writing_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_background_scrolling.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_blend_modes.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_bunnymark.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_draw_tiled.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_fog_of_war.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_gif_player.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_image_drawing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_image_generation.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_image_loading.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_image_processing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_image_text.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_logo_raylib.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_mouse_painting.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_npatch_drawing.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_particles_blending.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_polygon.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_raw_data.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_sprite_anim.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_sprite_button.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_sprite_explosion.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_srcrec_dstrec.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/examples/textures_to_image.vcxproj +387 -0
- package/vendor/raylib/projects/VS2022/raylib/raylib.vcxproj +340 -0
- package/vendor/raylib/projects/VS2022/raylib.sln +2347 -0
- package/build/qemu/2.1.0-beta.3/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/2.1.0-beta.3/koffi_win32_x64.tar.gz +0 -0
- package/doc/dist/doctrees/benchmarks.doctree +0 -0
- package/doc/dist/doctrees/changes.doctree +0 -0
- package/doc/dist/doctrees/contribute.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/memory.doctree +0 -0
- package/doc/dist/doctrees/platforms.doctree +0 -0
- package/doc/dist/doctrees/start.doctree +0 -0
- package/doc/dist/doctrees/types.doctree +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 -161
- package/doc/dist/html/_sources/contribute.md.txt +0 -127
- package/doc/dist/html/_sources/functions.md.txt +0 -421
- 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 -541
- 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_linux_20220627.png +0 -0
- package/doc/dist/html/_static/perf_linux_20220628.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/perf_windows_20220627.png +0 -0
- package/doc/dist/html/_static/perf_windows_20220628.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 -571
- package/doc/dist/html/changes.html +0 -686
- package/doc/dist/html/contribute.html +0 -403
- package/doc/dist/html/functions.html +0 -718
- package/doc/dist/html/genindex.html +0 -253
- package/doc/dist/html/index.html +0 -359
- package/doc/dist/html/memory.html +0 -346
- package/doc/dist/html/objects.inv +0 -0
- package/doc/dist/html/platforms.html +0 -371
- package/doc/dist/html/search.html +0 -261
- package/doc/dist/html/searchindex.js +0 -1
- package/doc/dist/html/start.html +0 -384
- package/doc/dist/html/types.html +0 -1061
package/src/abi_arm64.cc
CHANGED
|
@@ -269,7 +269,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
269
269
|
#define PUSH_INTEGER(CType) \
|
|
270
270
|
do { \
|
|
271
271
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
272
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
272
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
273
273
|
return false; \
|
|
274
274
|
} \
|
|
275
275
|
\
|
|
@@ -286,7 +286,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
286
286
|
#define PUSH_INTEGER_SWAP(CType) \
|
|
287
287
|
do { \
|
|
288
288
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
289
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
289
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
290
290
|
return false; \
|
|
291
291
|
} \
|
|
292
292
|
\
|
|
@@ -304,7 +304,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
304
304
|
#define PUSH_INTEGER(CType) \
|
|
305
305
|
do { \
|
|
306
306
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
307
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
307
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
308
308
|
return false; \
|
|
309
309
|
} \
|
|
310
310
|
\
|
|
@@ -314,7 +314,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
314
314
|
#define PUSH_INTEGER_SWAP(CType) \
|
|
315
315
|
do { \
|
|
316
316
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
317
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
317
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
318
318
|
return false; \
|
|
319
319
|
} \
|
|
320
320
|
\
|
|
@@ -335,7 +335,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
335
335
|
|
|
336
336
|
case PrimitiveKind::Bool: {
|
|
337
337
|
if (RG_UNLIKELY(!value.IsBoolean())) {
|
|
338
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
338
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected boolean", GetValueType(instance, value));
|
|
339
339
|
return false;
|
|
340
340
|
}
|
|
341
341
|
|
|
@@ -368,16 +368,8 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
368
368
|
case PrimitiveKind::UInt64S: { PUSH_INTEGER_SWAP(uint64_t); } break;
|
|
369
369
|
case PrimitiveKind::String: {
|
|
370
370
|
const char *str;
|
|
371
|
-
if (
|
|
372
|
-
str = PushString(value);
|
|
373
|
-
if (RG_UNLIKELY(!str))
|
|
374
|
-
return false;
|
|
375
|
-
} else if (IsNullOrUndefined(value)) {
|
|
376
|
-
str = nullptr;
|
|
377
|
-
} else {
|
|
378
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
|
|
371
|
+
if (RG_UNLIKELY(!PushString(value, &str)))
|
|
379
372
|
return false;
|
|
380
|
-
}
|
|
381
373
|
|
|
382
374
|
#ifdef __APPLE__
|
|
383
375
|
args_ptr = param.gpr_count ? args_ptr : AlignUp(args_ptr, 8);
|
|
@@ -386,16 +378,8 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
386
378
|
} break;
|
|
387
379
|
case PrimitiveKind::String16: {
|
|
388
380
|
const char16_t *str16;
|
|
389
|
-
if (
|
|
390
|
-
str16 = PushString16(value);
|
|
391
|
-
if (RG_UNLIKELY(!str16))
|
|
392
|
-
return false;
|
|
393
|
-
} else if (IsNullOrUndefined(value)) {
|
|
394
|
-
str16 = nullptr;
|
|
395
|
-
} else {
|
|
396
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
|
|
381
|
+
if (RG_UNLIKELY(!PushString16(value, &str16)))
|
|
397
382
|
return false;
|
|
398
|
-
}
|
|
399
383
|
|
|
400
384
|
#ifdef __APPLE__
|
|
401
385
|
args_ptr = param.gpr_count ? args_ptr : AlignUp(args_ptr, 8);
|
|
@@ -404,7 +388,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
404
388
|
} break;
|
|
405
389
|
case PrimitiveKind::Pointer: {
|
|
406
390
|
void *ptr;
|
|
407
|
-
if (RG_UNLIKELY(!PushPointer(value, param, &ptr)))
|
|
391
|
+
if (RG_UNLIKELY(!PushPointer(value, param.type, param.directions, &ptr)))
|
|
408
392
|
return false;
|
|
409
393
|
|
|
410
394
|
#ifdef __APPLE__
|
|
@@ -414,7 +398,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
414
398
|
} break;
|
|
415
399
|
case PrimitiveKind::Record: {
|
|
416
400
|
if (RG_UNLIKELY(!IsObject(value))) {
|
|
417
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
401
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
|
|
418
402
|
return false;
|
|
419
403
|
}
|
|
420
404
|
|
|
@@ -461,7 +445,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
461
445
|
case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
|
|
462
446
|
case PrimitiveKind::Float32: {
|
|
463
447
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
464
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
448
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
465
449
|
return false;
|
|
466
450
|
}
|
|
467
451
|
|
|
@@ -488,7 +472,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
488
472
|
} break;
|
|
489
473
|
case PrimitiveKind::Float64: {
|
|
490
474
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
491
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
475
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
492
476
|
return false;
|
|
493
477
|
}
|
|
494
478
|
|
|
@@ -521,7 +505,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
521
505
|
} else if (IsNullOrUndefined(value)) {
|
|
522
506
|
ptr = nullptr;
|
|
523
507
|
} else {
|
|
524
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
508
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), param.type->name);
|
|
525
509
|
return false;
|
|
526
510
|
}
|
|
527
511
|
|
|
@@ -1077,7 +1061,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
1077
1061
|
#define RETURN_INTEGER(CType) \
|
|
1078
1062
|
do { \
|
|
1079
1063
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
1080
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
1064
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
1081
1065
|
return; \
|
|
1082
1066
|
} \
|
|
1083
1067
|
\
|
|
@@ -1087,7 +1071,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
1087
1071
|
#define RETURN_INTEGER_SWAP(CType) \
|
|
1088
1072
|
do { \
|
|
1089
1073
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
1090
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
1074
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
1091
1075
|
return; \
|
|
1092
1076
|
} \
|
|
1093
1077
|
\
|
|
@@ -1100,7 +1084,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
1100
1084
|
case PrimitiveKind::Void: {} break;
|
|
1101
1085
|
case PrimitiveKind::Bool: {
|
|
1102
1086
|
if (RG_UNLIKELY(!value.IsBoolean())) {
|
|
1103
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
1087
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected boolean", GetValueType(instance, value));
|
|
1104
1088
|
return;
|
|
1105
1089
|
}
|
|
1106
1090
|
|
|
@@ -1123,31 +1107,15 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
1123
1107
|
case PrimitiveKind::UInt64S: { RETURN_INTEGER_SWAP(uint64_t); } break;
|
|
1124
1108
|
case PrimitiveKind::String: {
|
|
1125
1109
|
const char *str;
|
|
1126
|
-
if (
|
|
1127
|
-
str = PushString(value);
|
|
1128
|
-
if (RG_UNLIKELY(!str))
|
|
1129
|
-
return;
|
|
1130
|
-
} else if (IsNullOrUndefined(value)) {
|
|
1131
|
-
str = nullptr;
|
|
1132
|
-
} else {
|
|
1133
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
|
|
1110
|
+
if (RG_UNLIKELY(!PushString(value, &str)))
|
|
1134
1111
|
return;
|
|
1135
|
-
}
|
|
1136
1112
|
|
|
1137
1113
|
out_reg->x0 = (uint64_t)str;
|
|
1138
1114
|
} break;
|
|
1139
1115
|
case PrimitiveKind::String16: {
|
|
1140
1116
|
const char16_t *str16;
|
|
1141
|
-
if (
|
|
1142
|
-
str16 = PushString16(value);
|
|
1143
|
-
if (RG_UNLIKELY(!str16))
|
|
1144
|
-
return;
|
|
1145
|
-
} else if (IsNullOrUndefined(value)) {
|
|
1146
|
-
str16 = nullptr;
|
|
1147
|
-
} else {
|
|
1148
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
|
|
1117
|
+
if (RG_UNLIKELY(!PushString16(value, &str16)))
|
|
1149
1118
|
return;
|
|
1150
|
-
}
|
|
1151
1119
|
|
|
1152
1120
|
out_reg->x0 = (uint64_t)str16;
|
|
1153
1121
|
} break;
|
|
@@ -1166,7 +1134,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
1166
1134
|
} else if (IsNullOrUndefined(value)) {
|
|
1167
1135
|
ptr = nullptr;
|
|
1168
1136
|
} else {
|
|
1169
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
1137
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
|
|
1170
1138
|
return;
|
|
1171
1139
|
}
|
|
1172
1140
|
|
|
@@ -1174,7 +1142,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
1174
1142
|
} break;
|
|
1175
1143
|
case PrimitiveKind::Record: {
|
|
1176
1144
|
if (RG_UNLIKELY(!IsObject(value))) {
|
|
1177
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
1145
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
|
|
1178
1146
|
return;
|
|
1179
1147
|
}
|
|
1180
1148
|
|
|
@@ -1193,7 +1161,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
1193
1161
|
case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
|
|
1194
1162
|
case PrimitiveKind::Float32: {
|
|
1195
1163
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
1196
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
1164
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
1197
1165
|
return;
|
|
1198
1166
|
}
|
|
1199
1167
|
|
|
@@ -1204,7 +1172,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
1204
1172
|
} break;
|
|
1205
1173
|
case PrimitiveKind::Float64: {
|
|
1206
1174
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
1207
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
1175
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
1208
1176
|
return;
|
|
1209
1177
|
}
|
|
1210
1178
|
|
|
@@ -1225,7 +1193,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
1225
1193
|
} else if (IsNullOrUndefined(value)) {
|
|
1226
1194
|
ptr = nullptr;
|
|
1227
1195
|
} else {
|
|
1228
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
1196
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
|
|
1229
1197
|
return;
|
|
1230
1198
|
}
|
|
1231
1199
|
|
package/src/abi_riscv64.cc
CHANGED
|
@@ -219,7 +219,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
219
219
|
#define PUSH_INTEGER(CType) \
|
|
220
220
|
do { \
|
|
221
221
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
222
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
222
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
223
223
|
return false; \
|
|
224
224
|
} \
|
|
225
225
|
\
|
|
@@ -229,7 +229,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
229
229
|
#define PUSH_INTEGER_SWAP(CType) \
|
|
230
230
|
do { \
|
|
231
231
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
232
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
232
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
233
233
|
return false; \
|
|
234
234
|
} \
|
|
235
235
|
\
|
|
@@ -249,7 +249,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
249
249
|
|
|
250
250
|
case PrimitiveKind::Bool: {
|
|
251
251
|
if (RG_UNLIKELY(!value.IsBoolean())) {
|
|
252
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
252
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected boolean", GetValueType(instance, value));
|
|
253
253
|
return false;
|
|
254
254
|
}
|
|
255
255
|
|
|
@@ -272,44 +272,28 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
272
272
|
case PrimitiveKind::UInt64S: { PUSH_INTEGER_SWAP(uint64_t); } break;
|
|
273
273
|
case PrimitiveKind::String: {
|
|
274
274
|
const char *str;
|
|
275
|
-
if (
|
|
276
|
-
str = PushString(value);
|
|
277
|
-
if (RG_UNLIKELY(!str))
|
|
278
|
-
return false;
|
|
279
|
-
} else if (IsNullOrUndefined(value)) {
|
|
280
|
-
str = nullptr;
|
|
281
|
-
} else {
|
|
282
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
|
|
275
|
+
if (RG_UNLIKELY(!PushString(value, &str)))
|
|
283
276
|
return false;
|
|
284
|
-
}
|
|
285
277
|
|
|
286
278
|
*(const char **)((param.gpr_count ? gpr_ptr : args_ptr)++) = str;
|
|
287
279
|
} break;
|
|
288
280
|
case PrimitiveKind::String16: {
|
|
289
281
|
const char16_t *str16;
|
|
290
|
-
if (
|
|
291
|
-
str16 = PushString16(value);
|
|
292
|
-
if (RG_UNLIKELY(!str16))
|
|
293
|
-
return false;
|
|
294
|
-
} else if (IsNullOrUndefined(value)) {
|
|
295
|
-
str16 = nullptr;
|
|
296
|
-
} else {
|
|
297
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
|
|
282
|
+
if (RG_UNLIKELY(!PushString16(value, &str16)))
|
|
298
283
|
return false;
|
|
299
|
-
}
|
|
300
284
|
|
|
301
285
|
*(const char16_t **)((param.gpr_count ? gpr_ptr : args_ptr)++) = str16;
|
|
302
286
|
} break;
|
|
303
287
|
case PrimitiveKind::Pointer: {
|
|
304
288
|
void *ptr;
|
|
305
|
-
if (RG_UNLIKELY(!PushPointer(value, param, &ptr)))
|
|
289
|
+
if (RG_UNLIKELY(!PushPointer(value, param.type, param.directions, &ptr)))
|
|
306
290
|
return false;
|
|
307
291
|
|
|
308
292
|
*(void **)((param.gpr_count ? gpr_ptr : args_ptr)++) = ptr;
|
|
309
293
|
} break;
|
|
310
294
|
case PrimitiveKind::Record: {
|
|
311
295
|
if (RG_UNLIKELY(!IsObject(value))) {
|
|
312
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
296
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
|
|
313
297
|
return false;
|
|
314
298
|
}
|
|
315
299
|
|
|
@@ -358,7 +342,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
358
342
|
case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
|
|
359
343
|
case PrimitiveKind::Float32: {
|
|
360
344
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
361
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
345
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
362
346
|
return false;
|
|
363
347
|
}
|
|
364
348
|
|
|
@@ -377,7 +361,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
377
361
|
} break;
|
|
378
362
|
case PrimitiveKind::Float64: {
|
|
379
363
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
380
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
364
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
381
365
|
return false;
|
|
382
366
|
}
|
|
383
367
|
|
|
@@ -405,7 +389,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
405
389
|
} else if (IsNullOrUndefined(value)) {
|
|
406
390
|
ptr = nullptr;
|
|
407
391
|
} else {
|
|
408
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
392
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), param.type->name);
|
|
409
393
|
return false;
|
|
410
394
|
}
|
|
411
395
|
|
|
@@ -785,7 +769,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
785
769
|
#define RETURN_INTEGER(CType) \
|
|
786
770
|
do { \
|
|
787
771
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
788
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
772
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
789
773
|
return; \
|
|
790
774
|
} \
|
|
791
775
|
\
|
|
@@ -795,7 +779,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
795
779
|
#define RETURN_INTEGER_SWAP(CType) \
|
|
796
780
|
do { \
|
|
797
781
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
798
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
782
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
799
783
|
return; \
|
|
800
784
|
} \
|
|
801
785
|
\
|
|
@@ -808,7 +792,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
808
792
|
case PrimitiveKind::Void: {} break;
|
|
809
793
|
case PrimitiveKind::Bool: {
|
|
810
794
|
if (RG_UNLIKELY(!value.IsBoolean())) {
|
|
811
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
795
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected boolean", GetValueType(instance, value));
|
|
812
796
|
return;
|
|
813
797
|
}
|
|
814
798
|
|
|
@@ -831,31 +815,15 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
831
815
|
case PrimitiveKind::UInt64S: { RETURN_INTEGER_SWAP(uint64_t); } break;
|
|
832
816
|
case PrimitiveKind::String: {
|
|
833
817
|
const char *str;
|
|
834
|
-
if (
|
|
835
|
-
str = PushString(value);
|
|
836
|
-
if (RG_UNLIKELY(!str))
|
|
837
|
-
return;
|
|
838
|
-
} else if (IsNullOrUndefined(value)) {
|
|
839
|
-
str = nullptr;
|
|
840
|
-
} else {
|
|
841
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
|
|
818
|
+
if (RG_UNLIKELY(!PushString(value, &str)))
|
|
842
819
|
return;
|
|
843
|
-
}
|
|
844
820
|
|
|
845
821
|
out_reg->a0 = (uint64_t)str;
|
|
846
822
|
} break;
|
|
847
823
|
case PrimitiveKind::String16: {
|
|
848
824
|
const char16_t *str16;
|
|
849
|
-
if (
|
|
850
|
-
str16 = PushString16(value);
|
|
851
|
-
if (RG_UNLIKELY(!str16))
|
|
852
|
-
return;
|
|
853
|
-
} else if (IsNullOrUndefined(value)) {
|
|
854
|
-
str16 = nullptr;
|
|
855
|
-
} else {
|
|
856
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
|
|
825
|
+
if (RG_UNLIKELY(!PushString16(value, &str16)))
|
|
857
826
|
return;
|
|
858
|
-
}
|
|
859
827
|
|
|
860
828
|
out_reg->a0 = (uint64_t)str16;
|
|
861
829
|
} break;
|
|
@@ -874,7 +842,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
874
842
|
} else if (IsNullOrUndefined(value)) {
|
|
875
843
|
ptr = nullptr;
|
|
876
844
|
} else {
|
|
877
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
845
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
|
|
878
846
|
return;
|
|
879
847
|
}
|
|
880
848
|
|
|
@@ -882,7 +850,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
882
850
|
} break;
|
|
883
851
|
case PrimitiveKind::Record: {
|
|
884
852
|
if (RG_UNLIKELY(!IsObject(value))) {
|
|
885
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
853
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
|
|
886
854
|
return;
|
|
887
855
|
}
|
|
888
856
|
|
|
@@ -901,7 +869,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
901
869
|
case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
|
|
902
870
|
case PrimitiveKind::Float32: {
|
|
903
871
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
904
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
872
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
905
873
|
return;
|
|
906
874
|
}
|
|
907
875
|
|
|
@@ -911,7 +879,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
911
879
|
} break;
|
|
912
880
|
case PrimitiveKind::Float64: {
|
|
913
881
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
914
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
882
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
915
883
|
return;
|
|
916
884
|
}
|
|
917
885
|
|
|
@@ -932,7 +900,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
932
900
|
} else if (IsNullOrUndefined(value)) {
|
|
933
901
|
ptr = nullptr;
|
|
934
902
|
} else {
|
|
935
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
903
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
|
|
936
904
|
return;
|
|
937
905
|
}
|
|
938
906
|
|
package/src/abi_x64_sysv.cc
CHANGED
|
@@ -307,7 +307,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
307
307
|
#define PUSH_INTEGER(CType) \
|
|
308
308
|
do { \
|
|
309
309
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
310
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
310
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
311
311
|
return false; \
|
|
312
312
|
} \
|
|
313
313
|
\
|
|
@@ -317,7 +317,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
317
317
|
#define PUSH_INTEGER_SWAP(CType) \
|
|
318
318
|
do { \
|
|
319
319
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
320
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
320
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
321
321
|
return false; \
|
|
322
322
|
} \
|
|
323
323
|
\
|
|
@@ -337,7 +337,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
337
337
|
|
|
338
338
|
case PrimitiveKind::Bool: {
|
|
339
339
|
if (RG_UNLIKELY(!value.IsBoolean())) {
|
|
340
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argmument %2, expected boolean", GetValueType(instance, value)
|
|
340
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argmument %2, expected boolean", GetValueType(instance, value));
|
|
341
341
|
return false;
|
|
342
342
|
}
|
|
343
343
|
|
|
@@ -360,44 +360,28 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
360
360
|
case PrimitiveKind::UInt64S: { PUSH_INTEGER_SWAP(uint64_t); } break;
|
|
361
361
|
case PrimitiveKind::String: {
|
|
362
362
|
const char *str;
|
|
363
|
-
if (
|
|
364
|
-
str = PushString(value);
|
|
365
|
-
if (RG_UNLIKELY(!str))
|
|
366
|
-
return false;
|
|
367
|
-
} else if (IsNullOrUndefined(value)) {
|
|
368
|
-
str = nullptr;
|
|
369
|
-
} else {
|
|
370
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
|
|
363
|
+
if (RG_UNLIKELY(!PushString(value, &str)))
|
|
371
364
|
return false;
|
|
372
|
-
}
|
|
373
365
|
|
|
374
366
|
*(const char **)((param.gpr_count ? gpr_ptr : args_ptr)++) = str;
|
|
375
367
|
} break;
|
|
376
368
|
case PrimitiveKind::String16: {
|
|
377
369
|
const char16_t *str16;
|
|
378
|
-
if (
|
|
379
|
-
str16 = PushString16(value);
|
|
380
|
-
if (RG_UNLIKELY(!str16))
|
|
381
|
-
return false;
|
|
382
|
-
} else if (IsNullOrUndefined(value)) {
|
|
383
|
-
str16 = nullptr;
|
|
384
|
-
} else {
|
|
385
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), param.offset + 1);
|
|
370
|
+
if (RG_UNLIKELY(!PushString16(value, &str16)))
|
|
386
371
|
return false;
|
|
387
|
-
}
|
|
388
372
|
|
|
389
373
|
*(const char16_t **)((param.gpr_count ? gpr_ptr : args_ptr)++) = str16;
|
|
390
374
|
} break;
|
|
391
375
|
case PrimitiveKind::Pointer: {
|
|
392
376
|
void *ptr;
|
|
393
|
-
if (RG_UNLIKELY(!PushPointer(value, param, &ptr)))
|
|
377
|
+
if (RG_UNLIKELY(!PushPointer(value, param.type, param.directions, &ptr)))
|
|
394
378
|
return false;
|
|
395
379
|
|
|
396
380
|
*(void **)((param.gpr_count ? gpr_ptr : args_ptr)++) = ptr;
|
|
397
381
|
} break;
|
|
398
382
|
case PrimitiveKind::Record: {
|
|
399
383
|
if (RG_UNLIKELY(!IsObject(value))) {
|
|
400
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
384
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
|
|
401
385
|
return false;
|
|
402
386
|
}
|
|
403
387
|
|
|
@@ -436,7 +420,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
436
420
|
case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
|
|
437
421
|
case PrimitiveKind::Float32: {
|
|
438
422
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
439
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
423
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
440
424
|
return false;
|
|
441
425
|
}
|
|
442
426
|
|
|
@@ -448,7 +432,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
448
432
|
} break;
|
|
449
433
|
case PrimitiveKind::Float64: {
|
|
450
434
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
451
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
435
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
452
436
|
return false;
|
|
453
437
|
}
|
|
454
438
|
|
|
@@ -469,7 +453,7 @@ bool CallData::Prepare(const Napi::CallbackInfo &info)
|
|
|
469
453
|
} else if (IsNullOrUndefined(value)) {
|
|
470
454
|
ptr = nullptr;
|
|
471
455
|
} else {
|
|
472
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
456
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), param.type->name);
|
|
473
457
|
return false;
|
|
474
458
|
}
|
|
475
459
|
|
|
@@ -833,7 +817,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
833
817
|
#define RETURN_INTEGER(CType) \
|
|
834
818
|
do { \
|
|
835
819
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
836
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
820
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
837
821
|
return; \
|
|
838
822
|
} \
|
|
839
823
|
\
|
|
@@ -843,7 +827,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
843
827
|
#define RETURN_INTEGER_SWAP(CType) \
|
|
844
828
|
do { \
|
|
845
829
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) { \
|
|
846
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
830
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value)); \
|
|
847
831
|
return; \
|
|
848
832
|
} \
|
|
849
833
|
\
|
|
@@ -856,7 +840,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
856
840
|
case PrimitiveKind::Void: {} break;
|
|
857
841
|
case PrimitiveKind::Bool: {
|
|
858
842
|
if (RG_UNLIKELY(!value.IsBoolean())) {
|
|
859
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
843
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected boolean", GetValueType(instance, value));
|
|
860
844
|
return;
|
|
861
845
|
}
|
|
862
846
|
|
|
@@ -879,31 +863,15 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
879
863
|
case PrimitiveKind::UInt64S: { RETURN_INTEGER_SWAP(uint64_t); } break;
|
|
880
864
|
case PrimitiveKind::String: {
|
|
881
865
|
const char *str;
|
|
882
|
-
if (
|
|
883
|
-
str = PushString(value);
|
|
884
|
-
if (RG_UNLIKELY(!str))
|
|
885
|
-
return;
|
|
886
|
-
} else if (IsNullOrUndefined(value)) {
|
|
887
|
-
str = nullptr;
|
|
888
|
-
} else {
|
|
889
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
|
|
866
|
+
if (RG_UNLIKELY(!PushString(value, &str)))
|
|
890
867
|
return;
|
|
891
|
-
}
|
|
892
868
|
|
|
893
869
|
out_reg->rax = (uint64_t)str;
|
|
894
870
|
} break;
|
|
895
871
|
case PrimitiveKind::String16: {
|
|
896
872
|
const char16_t *str16;
|
|
897
|
-
if (
|
|
898
|
-
str16 = PushString16(value);
|
|
899
|
-
if (RG_UNLIKELY(!str16))
|
|
900
|
-
return;
|
|
901
|
-
} else if (IsNullOrUndefined(value)) {
|
|
902
|
-
str16 = nullptr;
|
|
903
|
-
} else {
|
|
904
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value for return value, expected string", GetValueType(instance, value));
|
|
873
|
+
if (RG_UNLIKELY(!PushString16(value, &str16)))
|
|
905
874
|
return;
|
|
906
|
-
}
|
|
907
875
|
|
|
908
876
|
out_reg->rax = (uint64_t)str16;
|
|
909
877
|
} break;
|
|
@@ -922,7 +890,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
922
890
|
} else if (IsNullOrUndefined(value)) {
|
|
923
891
|
ptr = nullptr;
|
|
924
892
|
} else {
|
|
925
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
893
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
|
|
926
894
|
return;
|
|
927
895
|
}
|
|
928
896
|
|
|
@@ -930,7 +898,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
930
898
|
} break;
|
|
931
899
|
case PrimitiveKind::Record: {
|
|
932
900
|
if (RG_UNLIKELY(!IsObject(value))) {
|
|
933
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
901
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected object", GetValueType(instance, value));
|
|
934
902
|
return;
|
|
935
903
|
}
|
|
936
904
|
|
|
@@ -965,7 +933,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
965
933
|
case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
|
|
966
934
|
case PrimitiveKind::Float32: {
|
|
967
935
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
968
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
936
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
969
937
|
return;
|
|
970
938
|
}
|
|
971
939
|
|
|
@@ -976,7 +944,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
976
944
|
} break;
|
|
977
945
|
case PrimitiveKind::Float64: {
|
|
978
946
|
if (RG_UNLIKELY(!value.IsNumber() && !value.IsBigInt())) {
|
|
979
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
947
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected number", GetValueType(instance, value));
|
|
980
948
|
return;
|
|
981
949
|
}
|
|
982
950
|
|
|
@@ -997,7 +965,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, BackRegister
|
|
|
997
965
|
} else if (IsNullOrUndefined(value)) {
|
|
998
966
|
ptr = nullptr;
|
|
999
967
|
} else {
|
|
1000
|
-
ThrowError<Napi::TypeError>(env, "Unexpected %1 value
|
|
968
|
+
ThrowError<Napi::TypeError>(env, "Unexpected %1 value, expected %2", GetValueType(instance, value), type->name);
|
|
1001
969
|
return;
|
|
1002
970
|
}
|
|
1003
971
|
|