Repository navigation
Description
scripts/runtime_abi_check.py (#11398) compares every runtime declaration, call site, pending declare and NativeModSig row in perry-codegen against the runtime's real #[no_mangle] extern "C" signature. Besides the wasm32 worklist, it reports 33 mismatches that are wrong on native targets today:
- class (float vs int/pointer): the value travels in the wrong register class (xmm vs gpr), so the callee reads garbage.
- width: upper bits are undefined.
- arity: the callee reads unset argument registers.
Hand-verified examples:
js_typed_feedback_array_set_index_or_string(perry-codegen/src/expr/index_set.rs:912) passes 4 args; the runtime reads a 5th,strict: i32.js_is_truthyis declared returningi64atlower_call/native/native_ui_appshell_branch.rs:159, but it returnsi32.- The
js_lodash_pad*/trim*/randomdeclarations are one parameter short. js_json_get_bool/js_http_request_has_header/js_cheerio_selection_isare declareddoubleover aboolreturn.
Caveat for native_table arity rows: the dispatcher pads to the table's arity and appends extra JS arguments, so such a row is a live bug only for calls that omit the runtime's extra parameters.
class
js_cheerio_selection_has_class(native_table): return: codegen f64, runtime bool —perry-codegen/src/lower_call/native_table/media.rs:333vsperry-stdlib/src/cheerio.rs:318js_cheerio_selection_is(declare): return: codegen f64, runtime bool —perry-codegen/src/runtime_decls/stdlib_ffi/third_party.rs:296vsperry-stdlib/src/cheerio.rs:346js_http_agent_free_sockets(native_table): return: codegen i64, runtime f64 —perry-codegen/src/lower_call/native_table/http_client.rs:597vsperry-ext-http/src/agent.rs:1444js_http_agent_requests(native_table): return: codegen i64, runtime f64 —perry-codegen/src/lower_call/native_table/http_client.rs:615vsperry-ext-http/src/agent.rs:1452js_http_agent_sockets(native_table): return: codegen i64, runtime f64 —perry-codegen/src/lower_call/native_table/http_client.rs:579vsperry-ext-http/src/agent.rs:1436js_http_request_has_header(declare): return: codegen f64, runtime bool —perry-codegen/src/runtime_decls/stdlib_ffi/net_http.rs:120vsperry-stdlib/src/framework/request.rs:102js_http_request_is_method(declare): return: codegen f64, runtime bool —perry-codegen/src/runtime_decls/stdlib_ffi/net_http.rs:124vsperry-stdlib/src/framework/request.rs:130js_json_get_bool(declare): return: codegen f64, runtime bool —perry-codegen/src/runtime_decls/stdlib_ffi/language_core.rs:82vsperry-runtime/src/json/stringify_api.rs:481js_json_stringify_bool(declare): param 0: codegen f64, runtime bool —perry-codegen/src/runtime_decls/stdlib_ffi/language_core.rs:86vsperry-runtime/src/json/stringify_api.rs:397js_lodash_size(declare): param 0: codegen i64, runtime f64 —perry-codegen/src/runtime_decls/stdlib_ffi/utilities.rs:63vsperry-stdlib/src/lodash.rs:862js_net_server_address(native_table): param 0: codegen i64, runtime f64 —perry-codegen/src/lower_call/native_table/net_events.rs:783vsperry-runtime/src/net.rs:121js_nodemailer_create_transport(native_table): param 0: codegen i64, runtime f64 —perry-codegen/src/lower_call/native_table/utils_crypto.rs:5vsperry-stdlib/src/nodemailer.rs:129js_process_initgroups(native_table): param 0: codegen i64, runtime f64 —perry-codegen/src/lower_call/native_table/node_core_process.rs:576vsperry-runtime/src/process/credentials.rs:243js_process_setgroups(native_table): param 0: codegen i64, runtime f64 —perry-codegen/src/lower_call/native_table/node_core_process.rs:566vsperry-runtime/src/process/credentials.rs:204js_sqlite_stmt_get(declare): return: codegen i64, runtime f64 —perry-codegen/src/runtime_decls/stdlib_ffi/data_stores.rs:16vsperry-stdlib/src/sqlite/better.rs:249js_tls_socket_set_key_cert(native_table): param 1: codegen i64, runtime f64 —perry-codegen/src/lower_call/native_table/tls_events.rs:290vsperry-stdlib/src/tls/socket_api.rs:280js_ws_server_emit(native_table): return: codegen f64, runtime i32 —perry-codegen/src/lower_call/native_table/ws_events.rs:136vsperry-ext-ws/src/server.rs:355
width
js_color_parse_channel(pending_declare): param 1: codegen i64, runtime i32 —perry-codegen/src/lower_call/ui_styling.rs:428vsperry-runtime/src/color_parse.rs:82js_is_truthy(pending_declare): return: codegen i64, runtime i32 —perry-codegen/src/lower_call/native/native_ui_appshell_branch.rs:159vsperry-runtime/src/value/truthy.rs:16js_ws_on(native_table): return: codegen i32, runtime i64 —perry-codegen/src/lower_call/native_table/ws_events.rs:30vsperry-ui-android/src/ws.rs:339
arity
js_cheerio_selection_children(native_table): codegen 1, runtime 2 —perry-codegen/src/lower_call/native_table/media.rs:315vsperry-stdlib/src/cheerio.rs:251js_dgram_socket_event_names(native_table): codegen 1, runtime 2 —perry-codegen/src/lower_call/native_table/node_core/dgram_fs_os.rs:158vsperry-runtime/src/dgram/ffi.rs:113js_lodash_pad/pad_end/pad_start/random(declare): codegen 2, runtime 3 —perry-codegen/src/runtime_decls/stdlib_ffi/utilities.rs:56-59vsperry-stdlib/src/lodash.rsjs_lodash_trim/trim_end/trim_start(declare): codegen 1, runtime 2 —perry-codegen/src/runtime_decls/stdlib_ffi/utilities.rs:73-75vsperry-stdlib/src/lodash.rsjs_module_create_require_devirt(native_table): codegen 2, runtime 1 —…/node_core/module_sea_tls_test.rs:5vsperry-runtime/src/module_require.rs:980js_module_find_package_json(native_table): codegen 2, runtime 3 —…/node_core/module_sea_tls_test.rs:196vsperry-runtime/src/process/node_module.rs:531js_sharp_from_buffer(declare): codegen 2, runtime 1 —perry-codegen/src/runtime_decls/stdlib_ffi/third_party.rs:82vsperry-stdlib/src/sharp.rs:50js_typed_feedback_array_set_index_or_string(call): codegen 4, runtime 5 —perry-codegen/src/expr/index_set.rs:912vsperry-runtime/src/typed_feedback.rs:2757
Reproduce: python3 scripts/runtime_abi_check.py --list class (and width, arity). Once these are fixed, those three categories can become a ratchet.
Metadata
Metadata
Assignees
Labels
No labels
Activity