From 0a245725d6718d8b01afe22d336a441aa1fbd308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Wed, 16 Sep 2026 10:17:43 +0200 Subject: [PATCH 1/4] exp: keepalive anchors as #[used(compiler)] instead of #[used] Plain #[used] on Mach-O sets N_NO_DEAD_STRIP, making every KEEP_* anchor an unconditional ld64 root. With codegen-units = 1 perry-runtime is a single archive member, so any runtime reference pulls all anchors and keeps the whole runtime surface alive. #[used(compiler)] keeps the anchor (and its target) in the archive for rustc/LTO without making it a linker root. Left as linker roots: mimalloc __mod_init_func, OHOS .init_array, build stamp. Local experiment branch; not for merge as-is. --- .../perry-runtime/src/array/element_shape.rs | 4 +- crates/perry-runtime/src/array/fill_extend.rs | 8 +- crates/perry-runtime/src/array/from_concat.rs | 6 +- crates/perry-runtime/src/array/generic.rs | 12 +- .../perry-runtime/src/array/generic_object.rs | 4 +- crates/perry-runtime/src/array/header.rs | 16 +- crates/perry-runtime/src/array/immutable.rs | 2 +- crates/perry-runtime/src/array/indexing.rs | 6 +- .../perry-runtime/src/array/iter_methods.rs | 6 +- crates/perry-runtime/src/array/join.rs | 2 +- .../perry-runtime/src/array/numeric_range.rs | 6 +- crates/perry-runtime/src/array/push_pop.rs | 6 +- crates/perry-runtime/src/array/sort.rs | 2 +- .../src/array/subclass_loop_guard.rs | 6 +- .../src/array/subclass_packed_index.rs | 2 +- crates/perry-runtime/src/bigint/convert.rs | 2 +- crates/perry-runtime/src/box.rs | 42 +++--- crates/perry-runtime/src/buffer/access.rs | 2 +- crates/perry-runtime/src/buffer/dataview.rs | 4 +- crates/perry-runtime/src/buffer/encode.rs | 2 +- crates/perry-runtime/src/buffer/query.rs | 2 +- crates/perry-runtime/src/buffer/u8_codec.rs | 12 +- .../perry-runtime/src/builtins/arithmetic.rs | 8 +- crates/perry-runtime/src/bun_compat/jsc.rs | 2 +- .../src/child_process/validate.rs | 10 +- crates/perry-runtime/src/closure/alloc.rs | 6 +- .../src/closure/dispatch/bound.rs | 2 +- crates/perry-runtime/src/closure/registry.rs | 6 +- crates/perry-runtime/src/closure/unbox.rs | 2 +- .../src/collection_iter_object.rs | 14 +- crates/perry-runtime/src/date.rs | 4 +- crates/perry-runtime/src/disposable.rs | 26 ++-- crates/perry-runtime/src/eh.rs | 2 +- crates/perry-runtime/src/embedded.rs | 8 +- .../perry-runtime/src/embedded/compressed.rs | 4 +- crates/perry-runtime/src/error.rs | 28 ++-- .../perry-runtime/src/error_subclass_stack.rs | 2 +- crates/perry-runtime/src/event_target.rs | 4 +- crates/perry-runtime/src/fs/validate.rs | 2 +- crates/perry-runtime/src/gc/barrier/mod.rs | 4 +- .../src/gc/layout/typed_shape.rs | 2 +- .../perry-runtime/src/intl/segments_view.rs | 10 +- crates/perry-runtime/src/iterator_helpers.rs | 2 +- crates/perry-runtime/src/json/parse_api.rs | 2 +- crates/perry-runtime/src/json/raw_json.rs | 4 +- crates/perry-runtime/src/lib.rs | 1 + crates/perry-runtime/src/map.rs | 40 ++--- crates/perry-runtime/src/module_require.rs | 8 +- .../src/module_require/import_meta_resolve.rs | 4 +- crates/perry-runtime/src/native_abi.rs | 42 +++--- crates/perry-runtime/src/node_sea.rs | 10 +- .../src/node_stream_keepalive.rs | 140 +++++++++--------- .../perry-runtime/src/node_submodules/zlib.rs | 10 +- crates/perry-runtime/src/node_v8.rs | 38 ++--- crates/perry-runtime/src/object/alloc.rs | 2 +- .../src/object/class_constructors.rs | 26 ++-- .../src/object/class_meta_registry.rs | 2 +- .../class_registry/construct/class_return.rs | 2 +- .../src/object/class_registry/registration.rs | 10 +- .../perry-runtime/src/object/descriptors.rs | 2 +- .../src/object/global_this/builtin_thunks.rs | 4 +- .../src/object/global_this/fetch_globals.rs | 8 +- crates/perry-runtime/src/object/groupby.rs | 4 +- .../perry-runtime/src/object/native_module.rs | 2 +- .../src/object/native_this_alias.rs | 4 +- .../src/object/object_ops/has_own.rs | 2 +- crates/perry-runtime/src/object/shapes.rs | 2 +- .../perry-runtime/src/object/this_binding.rs | 6 +- crates/perry-runtime/src/object/with_env.rs | 4 +- crates/perry-runtime/src/os.rs | 2 +- .../src/os/os_process_emitter.rs | 2 +- crates/perry-runtime/src/param_type_guard.rs | 2 +- crates/perry-runtime/src/path.rs | 4 +- crates/perry-runtime/src/path/value_args.rs | 4 +- crates/perry-runtime/src/process/env_misc.rs | 52 +++---- .../perry-runtime/src/promise/async_step.rs | 2 +- .../perry-runtime/src/promise/combinators.rs | 8 +- .../perry-runtime/src/promise/microtasks.rs | 4 +- crates/perry-runtime/src/promise/mod.rs | 18 +-- crates/perry-runtime/src/promise/rejection.rs | 4 +- crates/perry-runtime/src/proxy.rs | 18 +-- crates/perry-runtime/src/proxy/put_value.rs | 4 +- crates/perry-runtime/src/regex/escape.rs | 2 +- crates/perry-runtime/src/set.rs | 58 ++++---- crates/perry-runtime/src/string/locale.rs | 6 +- crates/perry-runtime/src/string/pad.rs | 2 +- crates/perry-runtime/src/string/raw.rs | 2 +- crates/perry-runtime/src/string/slice_ops.rs | 4 +- .../perry-runtime/src/string/suffix_cursor.rs | 6 +- .../perry-runtime/src/symbol/constructors.rs | 2 +- crates/perry-runtime/src/symbol/iterator.rs | 2 +- crates/perry-runtime/src/text.rs | 10 +- crates/perry-runtime/src/tls.rs | 24 +-- crates/perry-runtime/src/typed_feedback.rs | 8 +- .../src/typed_feedback/guards.rs | 22 +-- .../perry-runtime/src/typed_feedback/tests.rs | 2 +- .../perry-runtime/src/typed_feedback/trace.rs | 64 ++++---- crates/perry-runtime/src/typedarray/access.rs | 10 +- crates/perry-runtime/src/typedarray_props.rs | 2 +- crates/perry-runtime/src/url/abort.rs | 6 +- crates/perry-runtime/src/url/search_params.rs | 2 +- crates/perry-runtime/src/validators.rs | 6 +- crates/perry-runtime/src/value/dyn_index.rs | 8 +- .../perry-runtime/src/value/dynamic_arith.rs | 10 +- crates/perry-runtime/src/value/nanbox.rs | 2 +- crates/perry-runtime/src/yoga.rs | 2 +- .../perry-stdlib/src/events/constructors.rs | 14 +- crates/perry-stdlib/src/lib.rs | 1 + crates/perry-stdlib/src/sqlite/better.rs | 16 +- crates/perry-stdlib/src/tls.rs | 2 +- crates/perry-stdlib/src/worker_threads.rs | 30 ++-- .../src/worker_threads/direct_message.rs | 2 +- crates/perry-stdlib/src/zlib.rs | 6 +- 113 files changed, 570 insertions(+), 568 deletions(-) diff --git a/crates/perry-runtime/src/array/element_shape.rs b/crates/perry-runtime/src/array/element_shape.rs index 76358d587e..a451f63c32 100644 --- a/crates/perry-runtime/src/array/element_shape.rs +++ b/crates/perry-runtime/src/array/element_shape.rs @@ -828,12 +828,12 @@ pub extern "C" fn js_array_element_shape_check( // those two — and only those two — are anchored. The other four stay // unanchored and dead-strippable until something emits a call to them. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_ENSURE_ELEMENT_SHAPE: extern "C" fn(*mut ArrayHeader) -> i32 = js_array_ensure_element_shape; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_ENSURE_ELEMENT_SHAPE_ORDINARY: extern "C" fn(*mut ArrayHeader) -> i32 = js_array_ensure_element_shape_ordinary; diff --git a/crates/perry-runtime/src/array/fill_extend.rs b/crates/perry-runtime/src/array/fill_extend.rs index a3f1ed5c0e..32160f7361 100644 --- a/crates/perry-runtime/src/array/fill_extend.rs +++ b/crates/perry-runtime/src/array/fill_extend.rs @@ -240,23 +240,23 @@ pub extern "C" fn js_array_fill_f64_iota_len_extend(arr: *mut ArrayHeader) -> *m } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_FILL_F64_CONST_EXTEND: extern "C" fn( *mut ArrayHeader, u32, f64, ) -> *mut ArrayHeader = js_array_fill_f64_const_extend; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_FILL_F64_IOTA_EXTEND: extern "C" fn(*mut ArrayHeader, u32) -> *mut ArrayHeader = js_array_fill_f64_iota_extend; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_FILL_F64_CONST_LEN_EXTEND: extern "C" fn( *mut ArrayHeader, f64, ) -> *mut ArrayHeader = js_array_fill_f64_const_len_extend; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_FILL_F64_IOTA_LEN_EXTEND: extern "C" fn(*mut ArrayHeader) -> *mut ArrayHeader = js_array_fill_f64_iota_len_extend; diff --git a/crates/perry-runtime/src/array/from_concat.rs b/crates/perry-runtime/src/array/from_concat.rs index d61076e1c5..68d7ef5a40 100644 --- a/crates/perry-runtime/src/array/from_concat.rs +++ b/crates/perry-runtime/src/array/from_concat.rs @@ -197,7 +197,7 @@ pub extern "C" fn js_array_from_value(boxed: f64) -> *mut ArrayHeader { } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_FROM_VALUE: extern "C" fn(f64) -> *mut ArrayHeader = js_array_from_value; /// `Array.from(source, mapFn, thisArg)` — the mapped form. Throws for nullish @@ -223,7 +223,7 @@ pub extern "C" fn js_array_from_mapped( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_FROM_MAPPED: extern "C" fn(f64, f64, f64) -> *mut ArrayHeader = js_array_from_mapped; @@ -342,7 +342,7 @@ pub extern "C" fn js_array_concat_variadic( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_CONCAT_VARIADIC: extern "C" fn( *const ArrayHeader, *const f64, diff --git a/crates/perry-runtime/src/array/generic.rs b/crates/perry-runtime/src/array/generic.rs index c8726cc2bc..00c1add7c5 100644 --- a/crates/perry-runtime/src/array/generic.rs +++ b/crates/perry-runtime/src/array/generic.rs @@ -1314,7 +1314,7 @@ fn clamp_index(v: f64, len: i64) -> i64 { // (codegen-only reference) compile path (see #3320 — `#[no_mangle]` alone is // not enough once the bitcode is re-linked). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAYLIKE_CB: [extern "C" fn(f64, f64, f64) -> f64; 9] = [ js_arraylike_forEach, js_arraylike_map, @@ -1327,24 +1327,24 @@ static KEEP_ARRAYLIKE_CB: [extern "C" fn(f64, f64, f64) -> f64; 9] = [ js_arraylike_findLastIndex, ]; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAYLIKE_REDUCE: [extern "C" fn(f64, f64, i32, f64) -> f64; 2] = [js_arraylike_reduce, js_arraylike_reduceRight]; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAYLIKE_SEARCH: [extern "C" fn(f64, f64, f64, i32) -> f64; 3] = [ js_arraylike_indexOf, js_arraylike_lastIndexOf, js_arraylike_includes, ]; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAYLIKE_AT: extern "C" fn(f64, f64) -> f64 = js_arraylike_at; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAYLIKE_JOIN: extern "C" fn(f64, f64) -> f64 = js_arraylike_join; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAYLIKE_SLICE: extern "C" fn(f64, f64, i32, f64, i32) -> f64 = js_arraylike_slice; /// A receiver that reached a dense `ArrayHeader` entry point but is actually diff --git a/crates/perry-runtime/src/array/generic_object.rs b/crates/perry-runtime/src/array/generic_object.rs index 8428855b3b..e274bfd9cc 100644 --- a/crates/perry-runtime/src/array/generic_object.rs +++ b/crates/perry-runtime/src/array/generic_object.rs @@ -482,9 +482,9 @@ pub extern "C" fn js_arraylike_splice(recv: f64, args_ptr: *const f64, count: i3 } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAYLIKE_SORT: extern "C" fn(f64, f64) -> f64 = js_arraylike_sort; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAYLIKE_VARIADIC: [extern "C" fn(f64, *const f64, i32) -> f64; 2] = [js_arraylike_concat, js_arraylike_splice]; diff --git a/crates/perry-runtime/src/array/header.rs b/crates/perry-runtime/src/array/header.rs index e9cb8f72bf..41672ffddb 100644 --- a/crates/perry-runtime/src/array/header.rs +++ b/crates/perry-runtime/src/array/header.rs @@ -258,7 +258,7 @@ pub extern "C" fn js_tagged_template_get_or_init( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_TAGGED_TEMPLATE_GET_OR_INIT: extern "C" fn( u64, *mut ArrayHeader, @@ -1654,31 +1654,31 @@ pub extern "C" fn js_array_is_numeric_f64_layout(arr: *const ArrayHeader) -> i32 // These raw numeric-array helpers are called from generated code, so release/LTO // builds may otherwise internalize and strip the `#[no_mangle]` exports. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_NUMERIC_VALUE_TO_RAW_F64: extern "C" fn(f64) -> f64 = js_array_numeric_value_to_raw_f64; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_MARK_NUMERIC_F64_LAYOUT: extern "C" fn(*mut ArrayHeader) -> i32 = js_array_mark_numeric_f64_layout; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_CLEAR_NUMERIC_LAYOUT: extern "C" fn(*mut ArrayHeader) = js_array_clear_numeric_layout; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_NOTE_NUMERIC_WRITE: extern "C" fn(*mut ArrayHeader, u64) = js_array_note_numeric_write; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_DECLARE_ALL_POINTER_ELEMENTS: extern "C" fn(*mut ArrayHeader) = js_array_declare_all_pointer_elements; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_IS_NUMERIC_F64_LAYOUT: extern "C" fn(*const ArrayHeader) -> i32 = js_array_is_numeric_f64_layout; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_REFRESH_LOCAL_HEAD: extern "C" fn(f64) -> f64 = js_array_refresh_local_head; /// Calculate the byte size for an array with N elements capacity diff --git a/crates/perry-runtime/src/array/immutable.rs b/crates/perry-runtime/src/array/immutable.rs index c5666e6cab..3c3be29128 100644 --- a/crates/perry-runtime/src/array/immutable.rs +++ b/crates/perry-runtime/src/array/immutable.rs @@ -655,6 +655,6 @@ pub extern "C" fn js_arraylike_copy_within( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAYLIKE_COPY_WITHIN: extern "C" fn(f64, f64, f64, i32, f64) -> f64 = js_arraylike_copy_within; diff --git a/crates/perry-runtime/src/array/indexing.rs b/crates/perry-runtime/src/array/indexing.rs index a7fe90560f..1199056c5c 100644 --- a/crates/perry-runtime/src/array/indexing.rs +++ b/crates/perry-runtime/src/array/indexing.rs @@ -187,7 +187,7 @@ pub(crate) fn array_get_property_by_key( /// `#[no_mangle]` C export AND survive dead-stripping even when no Rust caller /// keeps it referenced — mirroring the neighbouring `js_array_push`. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_LENGTH: extern "C" fn(*const ArrayHeader) -> u32 = js_array_length; #[no_mangle] @@ -745,11 +745,11 @@ pub extern "C" fn js_array_numeric_set_f64_unboxed( // These raw numeric-array helpers are called from generated code, so release/LTO // builds may otherwise internalize and strip the `#[no_mangle]` exports. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_NUMERIC_GET_F64_UNBOXED: extern "C" fn(*mut ArrayHeader, u32) -> f64 = js_array_numeric_get_f64_unboxed; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_NUMERIC_SET_F64_UNBOXED: extern "C" fn(*mut ArrayHeader, u32, f64) -> i32 = js_array_numeric_set_f64_unboxed; diff --git a/crates/perry-runtime/src/array/iter_methods.rs b/crates/perry-runtime/src/array/iter_methods.rs index c8fa7668bb..ae54e8b858 100644 --- a/crates/perry-runtime/src/array/iter_methods.rs +++ b/crates/perry-runtime/src/array/iter_methods.rs @@ -1390,7 +1390,7 @@ pub extern "C" fn js_array_to_locale_string( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_TO_LOCALE_STRING: extern "C" fn( *const ArrayHeader, f64, @@ -1521,7 +1521,7 @@ pub extern "C" fn js_validate_array_callback(cb_boxed: f64) -> i64 { } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_VALIDATE_ARRAY_CALLBACK: extern "C" fn(f64) -> i64 = js_validate_array_callback; /// Validate a `map` callback (#4091). Identical to @@ -1545,6 +1545,6 @@ pub extern "C" fn js_validate_array_map_callback(arr: i64, cb_boxed: f64) -> i64 } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_VALIDATE_ARRAY_MAP_CALLBACK: extern "C" fn(i64, f64) -> i64 = js_validate_array_map_callback; diff --git a/crates/perry-runtime/src/array/join.rs b/crates/perry-runtime/src/array/join.rs index addf39e107..14fd61f0ee 100644 --- a/crates/perry-runtime/src/array/join.rs +++ b/crates/perry-runtime/src/array/join.rs @@ -786,7 +786,7 @@ pub extern "C" fn js_array_join_value( // Codegen lowers `arr.join(sep)` to this symbol. Keep it alive through the // auto-optimize whole-program-bitcode link. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_JOIN_VALUE: extern "C" fn(*const ArrayHeader, f64) -> *mut StringHeader = js_array_join_value; diff --git a/crates/perry-runtime/src/array/numeric_range.rs b/crates/perry-runtime/src/array/numeric_range.rs index 4f1b013100..3046362895 100644 --- a/crates/perry-runtime/src/array/numeric_range.rs +++ b/crates/perry-runtime/src/array/numeric_range.rs @@ -127,11 +127,11 @@ pub extern "C" fn js_array_numeric_range_add_len(receiver: f64, start: f64, delt } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_NUMERIC_RANGE_ADD: extern "C" fn(f64, f64, f64, f64) -> i64 = js_array_numeric_range_add; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_NUMERIC_RANGE_ADD_LEN: extern "C" fn(f64, f64, f64) -> i64 = js_array_numeric_range_add_len; @@ -242,6 +242,6 @@ pub unsafe extern "C" fn js_array_fill_range_strided_tagged( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ARRAY_FILL_RANGE_STRIDED_TAGGED: unsafe extern "C" fn(f64, f64, f64, f64, u64) -> i64 = js_array_fill_range_strided_tagged; diff --git a/crates/perry-runtime/src/array/push_pop.rs b/crates/perry-runtime/src/array/push_pop.rs index 1e205b2e49..de88a8949a 100644 --- a/crates/perry-runtime/src/array/push_pop.rs +++ b/crates/perry-runtime/src/array/push_pop.rs @@ -875,7 +875,7 @@ pub extern "C" fn js_array_push_u31_with_length( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_PUSH_U31_WITH_LENGTH: extern "C" fn( *mut ArrayHeader, u32, @@ -1000,7 +1000,7 @@ pub extern "C" fn js_array_numeric_push_f64_unboxed( // This raw numeric-array helper is called from generated code, so release/LTO // builds may otherwise internalize and strip the `#[no_mangle]` export. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_NUMERIC_PUSH_F64_UNBOXED: extern "C" fn( *mut ArrayHeader, f64, @@ -1882,6 +1882,6 @@ fn unshift_array_spec_path(arr: *mut ArrayHeader, items: &[f64]) -> *mut ArrayHe } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_UNSHIFT_VARIADIC: extern "C" fn(*mut ArrayHeader, *const f64, u32) -> *mut ArrayHeader = js_array_unshift_variadic; diff --git a/crates/perry-runtime/src/array/sort.rs b/crates/perry-runtime/src/array/sort.rs index 13c033196b..c9f4628791 100644 --- a/crates/perry-runtime/src/array/sort.rs +++ b/crates/perry-runtime/src/array/sort.rs @@ -715,7 +715,7 @@ pub extern "C" fn js_validate_array_comparator(cmp_boxed: f64) -> i64 { } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_VALIDATE_ARRAY_COMPARATOR: extern "C" fn(f64) -> i64 = js_validate_array_comparator; #[cold] diff --git a/crates/perry-runtime/src/array/subclass_loop_guard.rs b/crates/perry-runtime/src/array/subclass_loop_guard.rs index 7dbfdbadc7..93a035e6ef 100644 --- a/crates/perry-runtime/src/array/subclass_loop_guard.rs +++ b/crates/perry-runtime/src/array/subclass_loop_guard.rs @@ -663,17 +663,17 @@ fn revalidate_admitted_subclass_live( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_PACKED_ARRAYLIKE_LOOP_GUARD: extern "C" fn(f64, f64, i32, *mut u64) -> i32 = js_packed_arraylike_loop_guard; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_PACKED_ARRAYLIKE_LOOP_GUARD_LIVE: extern "C" fn(f64, f64, i32, *mut u64) -> i64 = js_packed_arraylike_loop_guard_live; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_PACKED_ARRAYLIKE_LOOP_REVALIDATE_LIVE: extern "C" fn( f64, f64, diff --git a/crates/perry-runtime/src/array/subclass_packed_index.rs b/crates/perry-runtime/src/array/subclass_packed_index.rs index 6872ec1f6d..00fe3be52d 100644 --- a/crates/perry-runtime/src/array/subclass_packed_index.rs +++ b/crates/perry-runtime/src/array/subclass_packed_index.rs @@ -152,7 +152,7 @@ pub extern "C" fn js_packed_arraylike_index_get( crate::value::js_dyn_index_get(receiver, index) } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_PACKED_ARRAYLIKE_INDEX_GET: extern "C" fn( f64, f64, diff --git a/crates/perry-runtime/src/bigint/convert.rs b/crates/perry-runtime/src/bigint/convert.rs index 582c163d3a..d2236956b6 100644 --- a/crates/perry-runtime/src/bigint/convert.rs +++ b/crates/perry-runtime/src/bigint/convert.rs @@ -66,7 +66,7 @@ pub extern "C" fn js_bigint_from_i128_parts(lo: u64, hi: i64) -> *mut BigIntHead } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BIGINT_FROM_I128_PARTS: extern "C" fn(u64, i64) -> *mut BigIntHeader = js_bigint_from_i128_parts; diff --git a/crates/perry-runtime/src/box.rs b/crates/perry-runtime/src/box.rs index 44079b511d..4eae4b605b 100644 --- a/crates/perry-runtime/src/box.rs +++ b/crates/perry-runtime/src/box.rs @@ -1253,10 +1253,10 @@ pub extern "C" fn js_tdz_suppress_end() { /// Keepalive anchors for the auto-optimize whole-program build (generated-code- /// only callees — without these the symbols dead-strip and the app link fails). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TDZ_SUPPRESS_BEGIN: extern "C" fn() = js_tdz_suppress_begin; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TDZ_SUPPRESS_END: extern "C" fn() = js_tdz_suppress_end; /// Compatibility wrapper for legacy f64-lowered boxed locals. @@ -1535,67 +1535,67 @@ fn is_registered_bool_box_ptr(ptr: *mut BoolBox) -> bool { } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOX_ALLOC_BITS: extern "C" fn(i64) -> *mut Box = js_box_alloc_bits; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOX_RELEASE: extern "C" fn(*mut Box) = js_box_release; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_I32_BOX_RELEASE: extern "C" fn(*mut I32Box) = js_i32_box_release; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOOL_BOX_RELEASE: extern "C" fn(*mut BoolBox) = js_bool_box_release; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOX_GET_BITS: extern "C" fn(*mut Box) -> i64 = js_box_get_bits; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOX_SET_BITS: extern "C" fn(*mut Box, i64) = js_box_set_bits; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOX_GET_BITS_TRUSTED: unsafe extern "C" fn(*mut Box) -> i64 = js_box_get_bits_trusted; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOX_GET_BITS_NAMED: extern "C" fn(*mut Box, f64) -> i64 = js_box_get_bits_named; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOX_GET_BITS_TRUSTED_NAMED: unsafe extern "C" fn(*mut Box, f64) -> i64 = js_box_get_bits_trusted_named; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOX_SET_BITS_TRUSTED_NO_BARRIER: unsafe extern "C" fn(*mut Box, i64) = js_box_set_bits_trusted_no_barrier; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOX_ALLOC: extern "C" fn(f64) -> *mut Box = js_box_alloc; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOX_GET: extern "C" fn(*mut Box) -> f64 = js_box_get; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOX_SET: extern "C" fn(*mut Box, f64) = js_box_set; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_I32_BOX_ALLOC: extern "C" fn(i32) -> *mut I32Box = js_i32_box_alloc; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_I32_BOX_GET: extern "C" fn(*mut I32Box) -> i32 = js_i32_box_get; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_I32_BOX_SET: extern "C" fn(*mut I32Box, i32) = js_i32_box_set; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOOL_BOX_ALLOC: extern "C" fn(i32) -> *mut BoolBox = js_bool_box_alloc; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOOL_BOX_GET: extern "C" fn(*mut BoolBox) -> i32 = js_bool_box_get; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BOOL_BOX_SET: extern "C" fn(*mut BoolBox, i32) = js_bool_box_set; #[cfg(test)] diff --git a/crates/perry-runtime/src/buffer/access.rs b/crates/perry-runtime/src/buffer/access.rs index 7b50411753..03a2c456ab 100644 --- a/crates/perry-runtime/src/buffer/access.rs +++ b/crates/perry-runtime/src/buffer/access.rs @@ -254,7 +254,7 @@ pub extern "C" fn js_buffer_index_get_value(buf_ptr: *const BufferHeader, index: // link is otherwise free to internalize and dead-strip it. The `#[used]` // anchor pins it (mirrors `KEEP_JS_TYPED_ARRAY_INDEX_GET_DYNAMIC`). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_BUFFER_INDEX_GET_VALUE: extern "C" fn(*const BufferHeader, i32) -> f64 = js_buffer_index_get_value; diff --git a/crates/perry-runtime/src/buffer/dataview.rs b/crates/perry-runtime/src/buffer/dataview.rs index c17c5970ef..b33f5be9bd 100644 --- a/crates/perry-runtime/src/buffer/dataview.rs +++ b/crates/perry-runtime/src/buffer/dataview.rs @@ -491,11 +491,11 @@ fn data_view_method_name<'a>(buf: &'a mut [u8; 16], prefix: &str, kind: DataView // Called from generated code — keep the exports alive under release/LTO. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_DATA_VIEW_GET_DIRECT: extern "C" fn(f64, f64, f64, i32, i32) -> f64 = js_data_view_get_direct; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_DATA_VIEW_SET_DIRECT: extern "C" fn(f64, f64, f64, f64, i32, i32) -> f64 = js_data_view_set_direct; diff --git a/crates/perry-runtime/src/buffer/encode.rs b/crates/perry-runtime/src/buffer/encode.rs index 4149d45e71..8cae2e0984 100644 --- a/crates/perry-runtime/src/buffer/encode.rs +++ b/crates/perry-runtime/src/buffer/encode.rs @@ -224,7 +224,7 @@ pub extern "C" fn js_value_to_string_with_encoding_or_radix( /// would internalize + dead-strip it without a `#[used]` reference (see /// project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_VALUE_TO_STRING_ENCODING_OR_RADIX: extern "C" fn(f64, i32, f64) -> *mut StringHeader = js_value_to_string_with_encoding_or_radix; diff --git a/crates/perry-runtime/src/buffer/query.rs b/crates/perry-runtime/src/buffer/query.rs index 474af7e231..08190989cc 100644 --- a/crates/perry-runtime/src/buffer/query.rs +++ b/crates/perry-runtime/src/buffer/query.rs @@ -63,7 +63,7 @@ pub unsafe extern "C" fn js_value_buffer_or_typedarray_data( // Referenced only from the prebuilt `perry-ext-http` archive, so the // auto-optimize LTO pass would otherwise dead-strip it. Pin it. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_VALUE_BUFFER_OR_TYPEDARRAY_DATA: unsafe extern "C" fn(f64, *mut u32) -> *const u8 = js_value_buffer_or_typedarray_data; diff --git a/crates/perry-runtime/src/buffer/u8_codec.rs b/crates/perry-runtime/src/buffer/u8_codec.rs index 5d25bd9d7e..2c2d806a48 100644 --- a/crates/perry-runtime/src/buffer/u8_codec.rs +++ b/crates/perry-runtime/src/buffer/u8_codec.rs @@ -563,20 +563,20 @@ pub extern "C" fn js_u8_set_from_hex(addr: i64, str_handle: i64) -> f64 { // rebuild would dead-strip them without an `#[used]` reference. See // project_auto_optimize_keepalive_3320. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_U8_TO_BASE64: extern "C" fn(i64, f64) -> *mut StringHeader = js_u8_to_base64; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_U8_TO_HEX: extern "C" fn(i64) -> *mut StringHeader = js_u8_to_hex; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_U8_FROM_BASE64: extern "C" fn(i64, f64) -> *mut BufferHeader = js_u8_from_base64; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_U8_FROM_HEX: extern "C" fn(i64) -> *mut BufferHeader = js_u8_from_hex; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_U8_SET_FROM_BASE64: extern "C" fn(i64, i64, f64) -> f64 = js_u8_set_from_base64; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_U8_SET_FROM_HEX: extern "C" fn(i64, i64) -> f64 = js_u8_set_from_hex; diff --git a/crates/perry-runtime/src/builtins/arithmetic.rs b/crates/perry-runtime/src/builtins/arithmetic.rs index f98306d20c..dda0c4d5a7 100644 --- a/crates/perry-runtime/src/builtins/arithmetic.rs +++ b/crates/perry-runtime/src/builtins/arithmetic.rs @@ -509,16 +509,16 @@ pub extern "C" fn js_rel_ge(x: f64, y: f64) -> f64 { // and leave `undefined _js_rel_lt …`. Pin them with `#[used]` statics — same // pattern as the write-barrier roots in `gc/barrier.rs`. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REL_LT: extern "C" fn(f64, f64) -> f64 = js_rel_lt; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REL_GT: extern "C" fn(f64, f64) -> f64 = js_rel_gt; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REL_LE: extern "C" fn(f64, f64) -> f64 = js_rel_le; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REL_GE: extern "C" fn(f64, f64) -> f64 = js_rel_ge; #[no_mangle] diff --git a/crates/perry-runtime/src/bun_compat/jsc.rs b/crates/perry-runtime/src/bun_compat/jsc.rs index 5e8f8a5b63..2235c6a8c8 100644 --- a/crates/perry-runtime/src/bun_compat/jsc.rs +++ b/crates/perry-runtime/src/bun_compat/jsc.rs @@ -12,7 +12,7 @@ use crate::string::js_string_from_bytes; use crate::value::JSValue; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_BUN_JSC_HEAP_STATS: extern "C" fn(f64) -> f64 = js_bun_jsc_heap_stats; fn object(scope: &RuntimeHandleScope, capacity: usize) -> RuntimeHandle<'_> { diff --git a/crates/perry-runtime/src/child_process/validate.rs b/crates/perry-runtime/src/child_process/validate.rs index 91d059fe5e..b1173e1e12 100644 --- a/crates/perry-runtime/src/child_process/validate.rs +++ b/crates/perry-runtime/src/child_process/validate.rs @@ -479,21 +479,21 @@ pub extern "C" fn js_child_process_validate_options(value: f64, sync: i32, allow /// otherwise drop them there; the classic link keeps them via the program's /// own undefined references and builds without the anchors. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CP_VALIDATE_COMMAND: unsafe extern "C" fn(f64, *const u8, u32) -> f64 = js_child_process_validate_command; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CP_VALIDATE_ARGS: extern "C" fn(f64) -> f64 = js_child_process_validate_args; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CP_VALIDATE_FORK_MODULE: extern "C" fn(f64) -> f64 = js_child_process_validate_fork_module; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CP_VALIDATE_OPTIONS: extern "C" fn(f64, i32, i32) -> f64 = js_child_process_validate_options; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CP_VALIDATE_SPAWN_ARGS: extern "C" fn(f64, i32, i32) -> f64 = js_child_process_validate_spawn_args; diff --git a/crates/perry-runtime/src/closure/alloc.rs b/crates/perry-runtime/src/closure/alloc.rs index 1cbb74dd93..78456744db 100644 --- a/crates/perry-runtime/src/closure/alloc.rs +++ b/crates/perry-runtime/src/closure/alloc.rs @@ -807,15 +807,15 @@ pub extern "C" fn js_closure_set_capture_ptr(closure: *mut ClosureHeader, index: } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CLOSURE_GET_CAPTURE_BITS: extern "C" fn(*const ClosureHeader, u32) -> u64 = js_closure_get_capture_bits; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CLOSURE_SET_CAPTURE_BITS: extern "C" fn(*mut ClosureHeader, u32, u64) = js_closure_set_capture_bits; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CLOSURE_SET_BOX_CAPTURE_PTR: extern "C" fn(*mut ClosureHeader, u32, i64) = js_closure_set_box_capture_ptr; diff --git a/crates/perry-runtime/src/closure/dispatch/bound.rs b/crates/perry-runtime/src/closure/dispatch/bound.rs index a994957db6..66ebb000ca 100644 --- a/crates/perry-runtime/src/closure/dispatch/bound.rs +++ b/crates/perry-runtime/src/closure/dispatch/bound.rs @@ -718,7 +718,7 @@ pub unsafe extern "C" fn js_function_bind( /// referenced from generated `.o` / other crates; this `#[used]` static /// survives the bitcode pipeline. See project_auto_optimize_keepalive_3320. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_FUNCTION_BIND: unsafe extern "C" fn(f64, *const f64, usize) -> f64 = js_function_bind; diff --git a/crates/perry-runtime/src/closure/registry.rs b/crates/perry-runtime/src/closure/registry.rs index 48a114cefe..2ed6d2ba16 100644 --- a/crates/perry-runtime/src/closure/registry.rs +++ b/crates/perry-runtime/src/closure/registry.rs @@ -835,12 +835,12 @@ pub(crate) fn lookup_closure_versioned_loop_direct( /// Keepalive anchor for the auto-optimize whole-program build — registration /// is referenced only by generated module-init code. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_REGISTER_CLOSURE_TRUSTED_DIRECT: extern "C" fn(*const u8, *const u8, u32, u64) = js_register_closure_trusted_direct; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_REGISTER_CLOSURE_VERSIONED_LOOP_DIRECT: extern "C" fn( *const u8, *const u8, @@ -861,7 +861,7 @@ pub extern "C" fn js_register_closure_strict_function(func_ptr: *const u8) { /// Keepalive anchor for the auto-optimize whole-program build — the strict /// registration is emitted only from generated module-init code. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_REGISTER_CLOSURE_STRICT_FUNCTION: extern "C" fn(*const u8) = js_register_closure_strict_function; diff --git a/crates/perry-runtime/src/closure/unbox.rs b/crates/perry-runtime/src/closure/unbox.rs index 243eea3b3e..2646d79520 100644 --- a/crates/perry-runtime/src/closure/unbox.rs +++ b/crates/perry-runtime/src/closure/unbox.rs @@ -64,7 +64,7 @@ pub extern "C-unwind" fn js_closure_unbox_callee_checked_rebind(callee: f64, rec /// Keepalive: generated code is the only caller (#6475). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CLOSURE_UNBOX_CALLEE_CHECKED_REBIND: extern "C-unwind" fn(f64, f64) -> i64 = js_closure_unbox_callee_checked_rebind; diff --git a/crates/perry-runtime/src/collection_iter_object.rs b/crates/perry-runtime/src/collection_iter_object.rs index 62864230e7..d69b652d05 100644 --- a/crates/perry-runtime/src/collection_iter_object.rs +++ b/crates/perry-runtime/src/collection_iter_object.rs @@ -178,22 +178,22 @@ pub extern "C" fn js_set_entries_iter_obj(set: *const SetHeader) -> i64 { // otherwise internalize + dead-strip the `#[no_mangle]` exports and break // the default compile path (see project_auto_optimize_keepalive). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_MAP_ENTRIES_ITER: extern "C" fn(*const MapHeader) -> i64 = js_map_entries_iter_obj; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_MAP_KEYS_ITER: extern "C" fn(*const MapHeader) -> i64 = js_map_keys_iter_obj; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_MAP_VALUES_ITER: extern "C" fn(*const MapHeader) -> i64 = js_map_values_iter_obj; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_VALUES_ITER: extern "C" fn(*const SetHeader) -> i64 = js_set_values_iter_obj; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_KEYS_ITER: extern "C" fn(*const SetHeader) -> i64 = js_set_keys_iter_obj; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_ENTRIES_ITER: extern "C" fn(*const SetHeader) -> i64 = js_set_entries_iter_obj; // #7564: the `{ value, done }` constructor was a local five-allocation copy @@ -464,7 +464,7 @@ pub unsafe extern "C-unwind" fn js_for_of_next(iter: f64) -> f64 { } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_FOR_OF_NEXT: unsafe extern "C-unwind" fn(f64) -> f64 = js_for_of_next; #[cfg(test)] diff --git a/crates/perry-runtime/src/date.rs b/crates/perry-runtime/src/date.rs index 57c2969063..6e2042ff18 100644 --- a/crates/perry-runtime/src/date.rs +++ b/crates/perry-runtime/src/date.rs @@ -843,7 +843,7 @@ pub extern "C" fn js_date_utc(args_ptr: *const f64, argc: i32) -> f64 { /// get dead-stripped by the auto-optimize whole-program LLVM bitcode rebuild /// without a `#[used]` reference (see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_DATE_UTC: extern "C" fn(*const f64, i32) -> f64 = js_date_utc; /// Coerce a NaN-boxed JS value to a number (ECMAScript ToNumber, restricted @@ -1054,7 +1054,7 @@ pub extern "C" fn js_date_apply_setter( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_DATE_APPLY_SETTER: extern "C" fn(f64, i32, i32, *const f64, i32) -> f64 = js_date_apply_setter; diff --git a/crates/perry-runtime/src/disposable.rs b/crates/perry-runtime/src/disposable.rs index 225ad6cc64..268d79fe71 100644 --- a/crates/perry-runtime/src/disposable.rs +++ b/crates/perry-runtime/src/disposable.rs @@ -543,52 +543,52 @@ pub extern "C" fn js_suppressed_error_new(error: f64, suppressed: f64, message: // --------------------------------------------------------------------------- #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_DISPOSABLE_STACK_NEW: extern "C" fn() -> *mut ObjectHeader = js_disposable_stack_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ASYNC_DISPOSABLE_STACK_NEW: extern "C" fn() -> *mut ObjectHeader = js_async_disposable_stack_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_DISPOSABLE_STACK_DISPOSED: extern "C" fn(*mut ObjectHeader) -> f64 = js_disposable_stack_disposed; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_DISPOSABLE_STACK_DEFER: extern "C" fn(*mut ObjectHeader, f64) -> f64 = js_disposable_stack_defer; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_DISPOSABLE_STACK_USE: extern "C" fn(*mut ObjectHeader, f64) -> f64 = js_disposable_stack_use; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ASYNC_DISPOSABLE_STACK_USE: extern "C" fn(*mut ObjectHeader, f64) -> f64 = js_async_disposable_stack_use; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_DISPOSABLE_STACK_ADOPT: extern "C" fn(*mut ObjectHeader, f64, f64) -> f64 = js_disposable_stack_adopt; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_DISPOSABLE_STACK_DISPOSE: extern "C" fn(*mut ObjectHeader) -> f64 = js_disposable_stack_dispose; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_DISPOSABLE_STACK_SYMBOL_DISPOSE: extern "C" fn(*mut ObjectHeader) -> f64 = js_disposable_stack_symbol_dispose; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_DISPOSABLE_STACK_MOVE: extern "C" fn(*mut ObjectHeader) -> f64 = js_disposable_stack_move; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ASYNC_DISPOSABLE_STACK_DISPOSE_ASYNC: extern "C" fn(*mut ObjectHeader) -> f64 = js_async_disposable_stack_dispose_async; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ASYNC_DISPOSABLE_STACK_SYMBOL_ASYNC_DISPOSE: extern "C" fn(*mut ObjectHeader) -> f64 = js_async_disposable_stack_symbol_async_dispose; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SUPPRESSED_ERROR_NEW: extern "C" fn(f64, f64, f64) -> f64 = js_suppressed_error_new; diff --git a/crates/perry-runtime/src/eh.rs b/crates/perry-runtime/src/eh.rs index 97c198cc44..17c9024438 100644 --- a/crates/perry-runtime/src/eh.rs +++ b/crates/perry-runtime/src/eh.rs @@ -474,7 +474,7 @@ unsafe fn read_encoded_pointer( // Keep the personality (and therefore this module's symbols) out of // dead-strip's reach in the static archives: generated code references // `perry_eh_personality` by name only. -#[used] +#[used(compiler)] static _KEEP_PERSONALITY: unsafe extern "C" fn( c_int, UnwindAction, diff --git a/crates/perry-runtime/src/embedded.rs b/crates/perry-runtime/src/embedded.rs index 7d98b59601..3b086395b5 100644 --- a/crates/perry-runtime/src/embedded.rs +++ b/crates/perry-runtime/src/embedded.rs @@ -490,13 +490,13 @@ pub extern "C" fn js_perry_read_embedded(path_value: f64) -> *mut crate::buffer: mod keep_embedded { use super::*; #[cfg(feature = "keepalive-anchors")] -#[used] static K0: unsafe extern "C" fn(*const u8, usize, *const u8, usize) = js_register_embedded_asset; +#[used(compiler)] static K0: unsafe extern "C" fn(*const u8, usize, *const u8, usize) = js_register_embedded_asset; #[cfg(feature = "keepalive-anchors")] -#[used] static K1: extern "C" fn(f64) -> *mut crate::buffer::BufferHeader = js_perry_read_embedded; +#[used(compiler)] static K1: extern "C" fn(f64) -> *mut crate::buffer::BufferHeader = js_perry_read_embedded; #[cfg(feature = "keepalive-anchors")] -#[used] static K2: extern "C" fn() -> *mut crate::array::ArrayHeader = js_perry_embedded_files; +#[used(compiler)] static K2: extern "C" fn() -> *mut crate::array::ArrayHeader = js_perry_embedded_files; #[cfg(feature = "keepalive-anchors")] -#[used] static K3: unsafe extern "C" fn(*const u8, usize, *const u8, usize) = js_register_embedded_text_asset; +#[used(compiler)] static K3: unsafe extern "C" fn(*const u8, usize, *const u8, usize) = js_register_embedded_text_asset; } #[cfg(test)] diff --git a/crates/perry-runtime/src/embedded/compressed.rs b/crates/perry-runtime/src/embedded/compressed.rs index d35381a6d7..a6e2ec17f4 100644 --- a/crates/perry-runtime/src/embedded/compressed.rs +++ b/crates/perry-runtime/src/embedded/compressed.rs @@ -119,7 +119,7 @@ pub unsafe extern "C" fn js_register_embedded_zstd_asset_lazy( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REGISTER_ZSTD_LAZY: unsafe extern "C" fn( *const u8, usize, @@ -130,7 +130,7 @@ static KEEP_REGISTER_ZSTD_LAZY: unsafe extern "C" fn( ) -> i32 = js_register_embedded_zstd_asset_lazy; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REGISTER_ZSTD: unsafe extern "C" fn( *const u8, usize, diff --git a/crates/perry-runtime/src/error.rs b/crates/perry-runtime/src/error.rs index ed21857657..db2d3189da 100644 --- a/crates/perry-runtime/src/error.rs +++ b/crates/perry-runtime/src/error.rs @@ -185,7 +185,7 @@ pub unsafe extern "C" fn js_set_call_location(file_ptr: *const u8, file_len: usi // Generated-code-only callee: anchor against the auto-optimize LTO dead-strip // (see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_CALL_LOCATION: unsafe extern "C" fn(*const u8, usize, u32) = js_set_call_location; @@ -554,7 +554,7 @@ pub unsafe extern "C" fn js_node_system_error_value( // otherwise dead-strip them (see project_auto_optimize_keepalive_3320). The // `#[used]` anchors pin them. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ERROR_VALUE_WITH_CODE: unsafe extern "C" fn( *const u8, usize, @@ -564,7 +564,7 @@ static KEEP_JS_ERROR_VALUE_WITH_CODE: unsafe extern "C" fn( ) -> f64 = js_error_value_with_code; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_NODE_SYSTEM_ERROR_VALUE: unsafe extern "C" fn( *const u8, usize, @@ -576,7 +576,7 @@ static KEEP_JS_NODE_SYSTEM_ERROR_VALUE: unsafe extern "C" fn( ) -> f64 = js_node_system_error_value; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_THROW_ERROR_WITH_CODE: unsafe extern "C" fn( *const u8, usize, @@ -1006,7 +1006,7 @@ pub extern "C" fn js_throw_eval_syntax_error(message: f64) -> f64 { // #1561-style force-keep: only generated IR calls this. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_THROW_EVAL_SYNTAX_ERROR: extern "C" fn(f64) -> f64 = js_throw_eval_syntax_error; #[no_mangle] @@ -1019,7 +1019,7 @@ pub extern "C" fn js_throw_restricted_function_property_assignment() -> f64 { // #1561-style force-keep: only generated IR calls this. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_THROW_RESTRICTED_FN_PROP_ASSIGN: extern "C" fn() -> f64 = js_throw_restricted_function_property_assignment; @@ -1109,7 +1109,7 @@ pub extern "C" fn js_throw_reference_error_tdz(name: f64) -> f64 { /// Keepalive anchor for the auto-optimize whole-program build (generated-code- /// and runtime-only callee). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_THROW_REFERENCE_ERROR_TDZ: extern "C" fn(f64) -> f64 = js_throw_reference_error_tdz; #[no_mangle] @@ -1120,7 +1120,7 @@ pub extern "C" fn js_throw_reference_error_unresolved_get() -> f64 { /// Keepalive anchor for the auto-optimize whole-program build (generated-code ///-only callee; see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_GLOBAL_GET_OR_THROW_UNRESOLVED: extern "C-unwind" fn(f64) -> f64 = js_global_get_or_throw_unresolved; @@ -1187,11 +1187,11 @@ const _: extern "C-unwind" fn(f64) -> f64 = js_global_get_or_throw_unresolved; /// Keepalive anchor for the auto-optimize whole-program build (generated-code ///-only callee; see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_GLOBAL_GET_OPTIONAL: extern "C" fn(f64) -> f64 = js_global_get_optional; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_GLOBAL_UPDATE: extern "C" fn(f64, f64, f64) -> f64 = js_global_update; /// `++x` / `x++` / `--x` / `x--` where `x` resolves to no lexical binding — @@ -1278,7 +1278,7 @@ pub extern "C" fn js_global_update(name_value: f64, is_increment: f64, is_prefix /// Keepalive anchor for the auto-optimize whole-program build (generated-code ///-only callee; see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_GLOBAL_ASSIGN_EXISTING_OR_THROW: extern "C" fn(f64, f64) -> f64 = js_global_assign_existing_or_throw; @@ -1924,21 +1924,21 @@ pub(crate) fn throw_immutable_write(kind: u32, key: &str) -> ! { // internalize+dead-strip pass drops them and the default `perry file.ts -o` // link fails (see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ERROR_NEW_KIND_WITH_OPTIONS: extern "C" fn( u32, *mut StringHeader, f64, ) -> *mut ErrorHeader = js_error_new_kind_with_options; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_AGGREGATEERROR_NEW_FULL: extern "C" fn( f64, *mut StringHeader, f64, ) -> *mut ErrorHeader = js_aggregateerror_new_full; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ERROR_IS_ERROR: extern "C" fn(f64) -> f64 = js_error_is_error; #[path = "error_stack_frames.rs"] diff --git a/crates/perry-runtime/src/error_subclass_stack.rs b/crates/perry-runtime/src/error_subclass_stack.rs index 3fd3f9d8d7..2dbd4f96de 100644 --- a/crates/perry-runtime/src/error_subclass_stack.rs +++ b/crates/perry-runtime/src/error_subclass_stack.rs @@ -306,7 +306,7 @@ pub extern "C" fn js_error_subclass_capture_stack(this_val: f64) { /// Generated-code-only callee (#9410): anchor against the auto-optimize LTO /// dead-strip. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ERROR_SUBCLASS_CAPTURE_STACK: extern "C" fn(f64) = js_error_subclass_capture_stack; #[cfg(test)] diff --git a/crates/perry-runtime/src/event_target.rs b/crates/perry-runtime/src/event_target.rs index 31d5c4b99d..4238375e38 100644 --- a/crates/perry-runtime/src/event_target.rs +++ b/crates/perry-runtime/src/event_target.rs @@ -327,7 +327,7 @@ pub extern "C" fn js_event_subclass_init( /// Keepalive anchor for the auto-optimize whole-program build — /// `js_event_subclass_init` is a generated-code-only callee. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_EVENT_SUBCLASS_INIT: extern "C" fn(f64, f64, f64, u32, u32) -> f64 = js_event_subclass_init; @@ -377,7 +377,7 @@ pub extern "C" fn js_dom_exception_subclass_init(this_value: f64, message: f64, /// Keepalive anchor for the auto-optimize whole-program build — /// `js_dom_exception_subclass_init` is a generated-code-only callee. -#[used] +#[used(compiler)] static KEEP_JS_DOM_EXCEPTION_SUBCLASS_INIT: extern "C" fn(f64, f64, f64) -> f64 = js_dom_exception_subclass_init; diff --git a/crates/perry-runtime/src/fs/validate.rs b/crates/perry-runtime/src/fs/validate.rs index d8c01b3973..d2fb0842f2 100644 --- a/crates/perry-runtime/src/fs/validate.rs +++ b/crates/perry-runtime/src/fs/validate.rs @@ -378,7 +378,7 @@ pub unsafe extern "C" fn js_validate_event_listener( /// via the stdlib/ext events validators, so without an anchor the bitcode /// internalizer drops it and the default `perry file.ts -o out` link fails. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_VALIDATE_EVENT_LISTENER: unsafe extern "C" fn(i64, *const u8, u32) -> i64 = js_validate_event_listener; diff --git a/crates/perry-runtime/src/gc/barrier/mod.rs b/crates/perry-runtime/src/gc/barrier/mod.rs index 1b4e1a2725..e9a66426a1 100644 --- a/crates/perry-runtime/src/gc/barrier/mod.rs +++ b/crates/perry-runtime/src/gc/barrier/mod.rs @@ -1962,10 +1962,10 @@ pub extern "C" fn js_write_barrier_root_nanbox(value_bits: u64) { // `#[used]` statics pin retained reference edges so both survive every link mode. // Same pattern as `node_stream_keepalive.rs` / `typedarray.rs`. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_WRITE_BARRIER_ROOT_HEAP_WORD: extern "C" fn(u64) = js_write_barrier_root_heap_word; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_WRITE_BARRIER_ROOT_NANBOX: extern "C" fn(u64) = js_write_barrier_root_nanbox; mod runtime_stores; diff --git a/crates/perry-runtime/src/gc/layout/typed_shape.rs b/crates/perry-runtime/src/gc/layout/typed_shape.rs index f07ea1c27d..5056959022 100644 --- a/crates/perry-runtime/src/gc/layout/typed_shape.rs +++ b/crates/perry-runtime/src/gc/layout/typed_shape.rs @@ -306,7 +306,7 @@ pub extern "C" fn js_register_imported_class_shape_slot( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_REGISTER_IMPORTED_CLASS_SHAPE_SLOT: extern "C" fn( u32, u32, diff --git a/crates/perry-runtime/src/intl/segments_view.rs b/crates/perry-runtime/src/intl/segments_view.rs index e95968f5a0..02ad1ab720 100644 --- a/crates/perry-runtime/src/intl/segments_view.rs +++ b/crates/perry-runtime/src/intl/segments_view.rs @@ -492,20 +492,20 @@ pub extern "C" fn js_segments_view_regexp_test(cursor: f64, regex: f64) -> f64 { // them before the lowering that needs them is ever compiled — the same reason // `js_for_of_next` carries `KEEP_JS_FOR_OF_NEXT`. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SEGMENTS_VIEW_OPEN: extern "C" fn(f64, f64) -> f64 = js_segments_view_open; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SEGMENTS_VIEW_NEXT: extern "C" fn(f64) -> f64 = js_segments_view_next; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SEGMENTS_VIEW_CODE_POINT_AT: extern "C" fn(f64, f64) -> f64 = js_segments_view_code_point_at; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SEGMENTS_VIEW_SEGMENT: extern "C" fn(f64) -> f64 = js_segments_view_segment; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SEGMENTS_VIEW_REGEXP_TEST: extern "C" fn(f64, f64) -> f64 = js_segments_view_regexp_test; diff --git a/crates/perry-runtime/src/iterator_helpers.rs b/crates/perry-runtime/src/iterator_helpers.rs index c5ecd50080..4d4043494f 100644 --- a/crates/perry-runtime/src/iterator_helpers.rs +++ b/crates/perry-runtime/src/iterator_helpers.rs @@ -247,7 +247,7 @@ pub extern "C" fn js_iterator_from(val_f64: f64) -> f64 { } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ITERATOR_FROM: extern "C" fn(f64) -> f64 = js_iterator_from; /// `.next()` on a helper iterator object. Pulls lazily from the source per the diff --git a/crates/perry-runtime/src/json/parse_api.rs b/crates/perry-runtime/src/json/parse_api.rs index e294c9f190..63885ee073 100644 --- a/crates/perry-runtime/src/json/parse_api.rs +++ b/crates/perry-runtime/src/json/parse_api.rs @@ -23,7 +23,7 @@ pub extern "C" fn js_json_text_to_string(value: f64) -> *mut StringHeader { // Anchor so the auto-optimize bitcode rebuild doesn't dead-strip this // codegen-only `#[no_mangle]` (see KEEP_RAW_JSON in json/raw_json.rs). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JSON_TEXT_TO_STRING: extern "C" fn(f64) -> *mut StringHeader = js_json_text_to_string; // ─── JSON.parse ─────────────────────────────────────────────────────────────── diff --git a/crates/perry-runtime/src/json/raw_json.rs b/crates/perry-runtime/src/json/raw_json.rs index 227c0a320a..a861b3bc4c 100644 --- a/crates/perry-runtime/src/json/raw_json.rs +++ b/crates/perry-runtime/src/json/raw_json.rs @@ -235,8 +235,8 @@ fn throw_raw_json_syntax_error() -> ! { // generated `.o`; the auto-optimize whole-program bitcode rebuild would // otherwise dead-strip them (see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_RAW_JSON: unsafe extern "C" fn(f64) -> f64 = js_json_raw_json; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_IS_RAW_JSON: unsafe extern "C" fn(f64) -> f64 = js_json_is_raw_json; diff --git a/crates/perry-runtime/src/lib.rs b/crates/perry-runtime/src/lib.rs index 53f61d03dd..838d2fb185 100644 --- a/crates/perry-runtime/src/lib.rs +++ b/crates/perry-runtime/src/lib.rs @@ -9,6 +9,7 @@ //! - Console and other global functions #![recursion_limit = "256"] +#![feature(used_with_arg)] // anchors are #[used(compiler)]: retained by rustc, not ld64 dead-strip roots /// Issue #62: route every Rust heap allocation through mimalloc instead of /// the system `malloc`. `gc_malloc`, arena block allocation, Vec/HashMap diff --git a/crates/perry-runtime/src/map.rs b/crates/perry-runtime/src/map.rs index 075be7ced6..7236eebea4 100644 --- a/crates/perry-runtime/src/map.rs +++ b/crates/perry-runtime/src/map.rs @@ -1650,7 +1650,7 @@ pub extern "C" fn js_map_find_key_index(map_boxed: f64, key: f64) -> f64 { unsafe { find_key_index(map, normalize_zero(key)) as f64 } } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_MAP_FIND_KEY_INDEX: extern "C" fn(f64, f64) -> f64 = js_map_find_key_index; /// C-ABI, for the `for…of` fast path (`perry-hir`'s @@ -1672,7 +1672,7 @@ pub extern "C" fn js_map_cursor_next(map_boxed: f64, cursor: f64, epoch: f64) -> } } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_MAP_CURSOR_NEXT: extern "C" fn(f64, f64, f64) -> f64 = js_map_cursor_next; /// C-ABI companion: the header's compaction epoch, which the loop stores @@ -1686,7 +1686,7 @@ pub extern "C" fn js_map_compaction_epoch(map_boxed: f64) -> f64 { map_compaction_epoch(map) as f64 } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_MAP_COMPACTION_EPOCH: extern "C" fn(f64) -> f64 = js_map_compaction_epoch; /// Live-extent accessor for iteration (`0..used` are the raw entry indices). @@ -2576,80 +2576,80 @@ pub extern "C" fn js_map_delete_number_key(map: *mut MapHeader, key: f64) -> i32 // generated LLVM IR. Keep roots prevent whole-program LTO/dead-strip from // removing the exported symbols when the Rust crate graph has no caller. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_SET_STRING_NUMBER: extern "C" fn( *mut MapHeader, *const StringHeader, f64, ) -> *mut MapHeader = js_map_set_string_number; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_SET_NUMBER_KEY: extern "C" fn(*mut MapHeader, f64, f64) -> *mut MapHeader = js_map_set_number_key; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_SET_STRING_KEY: extern "C" fn( *mut MapHeader, *const StringHeader, f64, ) -> *mut MapHeader = js_map_set_string_key; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_SET_STRING_I32: extern "C" fn( *mut MapHeader, *const StringHeader, i32, ) -> *mut MapHeader = js_map_set_string_i32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_SET_STRING_U32: extern "C" fn( *mut MapHeader, *const StringHeader, u32, ) -> *mut MapHeader = js_map_set_string_u32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_SET_STRING_F32: extern "C" fn( *mut MapHeader, *const StringHeader, f32, ) -> *mut MapHeader = js_map_set_string_f32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_SET_STRING_BOOL: extern "C" fn( *mut MapHeader, *const StringHeader, i32, ) -> *mut MapHeader = js_map_set_string_bool; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_SET_STRING_STRING: extern "C" fn( *mut MapHeader, *const StringHeader, *const StringHeader, ) -> *mut MapHeader = js_map_set_string_string; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_GET_STRING_KEY: extern "C" fn(*const MapHeader, *const StringHeader) -> f64 = js_map_get_string_key; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_GET_NUMBER_KEY: extern "C" fn(*const MapHeader, f64) -> f64 = js_map_get_number_key; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_HAS_STRING_KEY: extern "C" fn(*const MapHeader, *const StringHeader) -> i32 = js_map_has_string_key; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_HAS_NUMBER_KEY: extern "C" fn(*const MapHeader, f64) -> i32 = js_map_has_number_key; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_DELETE_STRING_KEY: extern "C" fn(*mut MapHeader, *const StringHeader) -> i32 = js_map_delete_string_key; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_DELETE_NUMBER_KEY: extern "C" fn(*mut MapHeader, f64) -> i32 = js_map_delete_number_key; @@ -2964,7 +2964,7 @@ pub extern "C" fn js_map_entry_key_raw_at(map: *const MapHeader, idx: u32) -> f6 } } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_MAP_ENTRY_KEY_RAW_AT: extern "C" fn(*const MapHeader, u32) -> f64 = js_map_entry_key_raw_at; @@ -3002,7 +3002,7 @@ pub extern "C" fn js_map_entry_value_raw_at(map: *const MapHeader, idx: u32) -> } } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_MAP_ENTRY_VALUE_RAW_AT: extern "C" fn(*const MapHeader, u32) -> f64 = js_map_entry_value_raw_at; @@ -3369,7 +3369,7 @@ pub extern "C" fn js_map_from_iterable(value: f64) -> *mut MapHeader { // internalize + dead-strip the `#[no_mangle]` export and break the default // compile path. The `#[used]` anchor pins it (see project_auto_optimize_keepalive). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MAP_FROM_ITERABLE: extern "C" fn(f64) -> *mut MapHeader = js_map_from_iterable; /// `Map.prototype.forEach(callback, thisArg)` — calls `callback` with the diff --git a/crates/perry-runtime/src/module_require.rs b/crates/perry-runtime/src/module_require.rs index 6b215be875..17d92d2018 100644 --- a/crates/perry-runtime/src/module_require.rs +++ b/crates/perry-runtime/src/module_require.rs @@ -1271,7 +1271,7 @@ pub extern "C" fn js_module_ambient_require() -> f64 { /// Keepalive anchor for the auto-optimize whole-program build (generated-code-only /// callee; see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_AMBIENT_REQUIRE: extern "C" fn() -> f64 = js_module_ambient_require; /// Synchronous ambient `require(spec)` resolution for the #5389 Tier 2 codegen @@ -1289,7 +1289,7 @@ pub extern "C" fn js_module_ambient_require_apply(spec: f64) -> f64 { /// Keepalive anchor for the auto-optimize whole-program build (generated-code-only /// callee; see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_AMBIENT_REQUIRE_APPLY: extern "C" fn(f64) -> f64 = js_module_ambient_require_apply; @@ -1445,7 +1445,7 @@ pub extern "C" fn js_module_dynamic_import_fallback(spec: f64, options: f64) -> /// Keepalive anchor (same pattern as the ambient-require anchors above). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_DYNAMIC_IMPORT_FALLBACK: extern "C" fn(f64, f64) -> f64 = js_module_dynamic_import_fallback; @@ -1467,7 +1467,7 @@ pub extern "C" fn js_module_dynamic_import_deferred(spec: f64, options: f64, msg /// Keepalive anchor (same pattern as the ambient-require anchors above). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_DYNAMIC_IMPORT_DEFERRED: extern "C" fn(f64, f64, f64) -> f64 = js_module_dynamic_import_deferred; diff --git a/crates/perry-runtime/src/module_require/import_meta_resolve.rs b/crates/perry-runtime/src/module_require/import_meta_resolve.rs index 7c2dc155eb..1f93ba4e2e 100644 --- a/crates/perry-runtime/src/module_require/import_meta_resolve.rs +++ b/crates/perry-runtime/src/module_require/import_meta_resolve.rs @@ -206,10 +206,10 @@ pub extern "C" fn js_import_meta_resolve_value(fallback: f64) -> f64 { } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_RESOLVE: extern "C" fn(f64, f64, f64) -> f64 = js_import_meta_resolve; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_RESOLVE_VALUE: extern "C" fn(f64) -> f64 = js_import_meta_resolve_value; #[cfg(test)] diff --git a/crates/perry-runtime/src/native_abi.rs b/crates/perry-runtime/src/native_abi.rs index 0741a398bf..9e157fe126 100644 --- a/crates/perry-runtime/src/native_abi.rs +++ b/crates/perry-runtime/src/native_abi.rs @@ -181,54 +181,54 @@ pub extern "C" fn js_typed_string_arg_to_raw(value: f64) -> i64 { // function-pointer references to prevent whole-program LTO/dead-strip from // removing the exported symbols. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_F64_ARG_GUARD: extern "C" fn(f64) -> i32 = js_typed_f64_arg_guard; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_F64_ARG_TO_RAW: extern "C" fn(f64) -> f64 = js_typed_f64_arg_to_raw; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_I32_ARG_GUARD: extern "C" fn(f64) -> i32 = js_typed_i32_arg_guard; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_I32_ARG_TO_RAW: extern "C" fn(f64) -> i32 = js_typed_i32_arg_to_raw; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_I1_ARG_GUARD: extern "C" fn(f64) -> i32 = js_typed_i1_arg_guard; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_I1_ARG_TO_RAW: extern "C" fn(f64) -> i32 = js_typed_i1_arg_to_raw; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_STRING_ARG_GUARD: extern "C" fn(f64) -> i32 = js_typed_string_arg_guard; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_STRING_ARG_TO_RAW: extern "C" fn(f64) -> i64 = js_typed_string_arg_to_raw; // Manifest calls are emitted from generated LLVM IR and therefore have no // Rust call graph edge in a release staticlib. Keep every newly public exact- // width boundary helper alive under whole-program LTO/dead stripping. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_NATIVE_ABI_CHECK_I8: extern "C" fn(f64) -> i8 = js_native_abi_check_i8; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_NATIVE_ABI_CHECK_I16: extern "C" fn(f64) -> i16 = js_native_abi_check_i16; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_NATIVE_ABI_CHECK_U8: extern "C" fn(f64) -> u8 = js_native_abi_check_u8; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_NATIVE_ABI_CHECK_U16: extern "C" fn(f64) -> u16 = js_native_abi_check_u16; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_NATIVE_ABI_CHECK_ISIZE: extern "C" fn(f64) -> isize = js_native_abi_check_isize; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_NATIVE_ABI_MATERIALIZE_I64: extern "C" fn(i64) -> f64 = js_native_abi_materialize_i64; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_NATIVE_ABI_MATERIALIZE_U64: extern "C" fn(u64) -> f64 = js_native_abi_materialize_u64; @@ -236,15 +236,15 @@ static KEEP_JS_NATIVE_ABI_MATERIALIZE_U64: extern "C" fn(u64) -> f64 = // from generated LLVM IR. Keep roots here so LTO cannot strip the symbols just // because the Rust crate graph has no ordinary caller. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_OBJECT_GET_FIELD_BY_PROPERTY_ID_F64: extern "C" fn(*const ObjectHeader, i64) -> f64 = crate::object::js_object_get_field_by_property_id_f64; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_OBJECT_SET_FIELD_BY_PROPERTY_ID: extern "C" fn(*mut ObjectHeader, i64, f64) = crate::object::js_object_set_field_by_property_id; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_NATIVE_CALL_METHOD_BY_ID: unsafe extern "C-unwind" fn( f64, i64, @@ -252,18 +252,18 @@ static KEEP_JS_NATIVE_CALL_METHOD_BY_ID: unsafe extern "C-unwind" fn( usize, ) -> f64 = crate::object::js_native_call_method_by_id; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_NATIVE_CALL_METHOD_APPLY_BY_ID: unsafe extern "C-unwind" fn(f64, i64, i64) -> f64 = crate::object::js_native_call_method_apply_by_id; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SPREAD_TAIL_FALLBACK_ARGS: unsafe extern "C-unwind" fn( *const f64, usize, f64, ) -> i64 = crate::object::js_spread_tail_fallback_args; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SHORT_PACKED_SPREAD_VALUES: unsafe extern "C" fn(f64, *mut f64) -> i32 = crate::array::js_short_packed_spread_values; diff --git a/crates/perry-runtime/src/node_sea.rs b/crates/perry-runtime/src/node_sea.rs index 745939bf1b..476873e874 100644 --- a/crates/perry-runtime/src/node_sea.rs +++ b/crates/perry-runtime/src/node_sea.rs @@ -8,19 +8,19 @@ use crate::value::{JSValue, TAG_FALSE}; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SEA_IS_SEA: extern "C" fn() -> f64 = js_sea_is_sea; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SEA_GET_ASSET: extern "C" fn(f64, f64) -> f64 = js_sea_get_asset; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SEA_GET_ASSET_AS_BLOB: extern "C" fn(f64, f64) -> f64 = js_sea_get_asset_as_blob; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SEA_GET_RAW_ASSET: extern "C" fn(f64) -> f64 = js_sea_get_raw_asset; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SEA_GET_ASSET_KEYS: extern "C" fn() -> f64 = js_sea_get_asset_keys; fn false_value() -> f64 { diff --git a/crates/perry-runtime/src/node_stream_keepalive.rs b/crates/perry-runtime/src/node_stream_keepalive.rs index a619f40587..9c1654d74f 100644 --- a/crates/perry-runtime/src/node_stream_keepalive.rs +++ b/crates/perry-runtime/src/node_stream_keepalive.rs @@ -10,248 +10,248 @@ // modes. See the same pattern in `value/dyn_index.rs` and `process.rs`. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_EMIT: extern "C" fn(i64, f64, f64) -> f64 = super::js_node_stream_method_emit; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_EMIT_ARGS: extern "C" fn(i64, f64, i64) -> f64 = super::js_node_stream_method_emit_args; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_READ: extern "C" fn(i64, f64) -> f64 = super::js_node_stream_method_read; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_PUSH: extern "C" fn(i64, f64) -> f64 = super::js_node_stream_method_push; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_UNSHIFT: extern "C" fn(i64, f64) -> f64 = super::js_node_stream_method_unshift; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_READABLE_HWM: extern "C" fn(i64) -> f64 = super::js_node_stream_method_readable_hwm; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_READABLE_LENGTH: extern "C" fn(i64) -> f64 = super::js_node_stream_method_readable_length; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_READABLE_OBJECT_MODE: extern "C" fn(i64) -> f64 = super::js_node_stream_method_readable_object_mode; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_READABLE: extern "C" fn(i64) -> f64 = super::js_node_stream_method_readable; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_READABLE_ENDED: extern "C" fn(i64) -> f64 = super::js_node_stream_method_readable_ended; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_READABLE_ENCODING: extern "C" fn(i64) -> f64 = super::js_node_stream_method_readable_encoding; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_WRITABLE_HWM: extern "C" fn(i64) -> f64 = super::js_node_stream_method_writable_hwm; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_WRITABLE_LENGTH: extern "C" fn(i64) -> f64 = super::js_node_stream_method_writable_length; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_WRITABLE_NEED_DRAIN: extern "C" fn(i64) -> f64 = super::js_node_stream_method_writable_need_drain; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_WRITABLE_OBJECT_MODE: extern "C" fn(i64) -> f64 = super::js_node_stream_method_writable_object_mode; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_READABLE_ABORTED: extern "C" fn(i64) -> f64 = super::js_node_stream_method_readable_aborted; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_CLOSED: extern "C" fn(i64) -> f64 = super::js_node_stream_method_closed; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_ERRORED: extern "C" fn(i64) -> f64 = super::js_node_stream_method_errored; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_READABLE_DID_READ: extern "C" fn(i64) -> f64 = super::js_node_stream_method_readable_did_read; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_WRITABLE_CORKED: extern "C" fn(i64) -> f64 = super::js_node_stream_method_writable_corked; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_WRITABLE: extern "C" fn(i64) -> f64 = super::js_node_stream_method_writable; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_WRITABLE_ENDED: extern "C" fn(i64) -> f64 = super::js_node_stream_method_writable_ended; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_WRITABLE_FINISHED: extern "C" fn(i64) -> f64 = super::js_node_stream_method_writable_finished; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_ALLOW_HALF_OPEN: extern "C" fn(i64) -> f64 = super::js_node_stream_method_allow_half_open; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_PAUSE: extern "C" fn(i64) -> f64 = super::js_node_stream_method_pause; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_RESUME: extern "C" fn(i64) -> f64 = super::js_node_stream_method_resume; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_SET_ENCODING: extern "C" fn(i64, f64) -> f64 = super::js_node_stream_method_set_encoding; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_DESTROY: extern "C" fn(i64, f64) -> f64 = super::js_node_stream_method_destroy; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_DESTROYED: extern "C" fn(i64) -> f64 = super::js_node_stream_method_destroyed; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_WRITE: extern "C" fn(i64, f64, f64, f64) -> f64 = super::js_node_stream_method_write; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_END: extern "C" fn(i64, f64) -> f64 = super::js_node_stream_method_end; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_END3: extern "C" fn(i64, f64, f64, f64) -> f64 = super::js_node_stream_method_end3; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_CORK: extern "C" fn(i64) -> f64 = super::js_node_stream_method_cork; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_UNCORK: extern "C" fn(i64) -> f64 = super::js_node_stream_method_uncork; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_SET_MAX_LISTENERS: extern "C" fn(i64, f64) -> f64 = super::js_node_stream_method_set_max_listeners; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_GET_MAX_LISTENERS: extern "C" fn(i64) -> f64 = super::js_node_stream_method_get_max_listeners; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_ON: extern "C" fn(i64, f64, f64) -> f64 = super::js_node_stream_method_on; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_ONCE: extern "C" fn(i64, f64, f64) -> f64 = super::js_node_stream_method_once; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_PREPEND_LISTENER: extern "C" fn(i64, f64, f64) -> f64 = super::js_node_stream_method_prepend_listener; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_PREPEND_ONCE_LISTENER: extern "C" fn(i64, f64, f64) -> f64 = super::js_node_stream_method_prepend_once_listener; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_OFF: extern "C" fn(i64, f64, f64) -> f64 = super::js_node_stream_method_off; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_REMOVE_LISTENER: extern "C" fn(i64, f64, f64) -> f64 = super::js_node_stream_method_remove_listener; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_REMOVE_ALL_LISTENERS: extern "C" fn(i64, f64) -> f64 = super::js_node_stream_method_remove_all_listeners; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_EVENT_NAMES: extern "C" fn(i64) -> i64 = super::js_node_stream_method_event_names; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_LISTENER_COUNT: extern "C" fn(i64, f64) -> f64 = super::js_node_stream_method_listener_count; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_LISTENERS: extern "C" fn(i64, f64) -> i64 = super::js_node_stream_method_listeners; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_METHOD_RAW_LISTENERS: extern "C" fn(i64, f64) -> i64 = super::js_node_stream_method_raw_listeners; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_READABLE_NEW: extern "C" fn(f64) -> f64 = super::js_node_stream_readable_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_WRITABLE_NEW: extern "C" fn(f64) -> f64 = super::js_node_stream_writable_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_DUPLEX_NEW: extern "C" fn(f64) -> f64 = super::js_node_stream_duplex_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_TRANSFORM_NEW: extern "C" fn(f64) -> f64 = super::js_node_stream_transform_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_PASSTHROUGH_NEW: extern "C" fn(f64) -> f64 = super::js_node_stream_passthrough_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_READABLE_FROM: extern "C" fn(f64) -> f64 = super::js_node_stream_readable_from; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_READABLE_FROM_OPTIONS: extern "C" fn(f64, f64) -> f64 = super::js_node_stream_readable_from_options; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_IS_DISTURBED: extern "C" fn(f64) -> f64 = super::js_node_stream_is_disturbed; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_IS_ERRORED: extern "C" fn(f64) -> f64 = super::js_node_stream_is_errored; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_IS_READABLE: extern "C" fn(f64) -> f64 = super::js_node_stream_is_readable; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_IS_WRITABLE: extern "C" fn(f64) -> f64 = super::js_node_stream_is_writable; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_IS_ARRAY_BUFFER_VIEW: extern "C" fn(f64) -> f64 = super::js_node_stream_is_array_buffer_view; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_IS_UINT8_ARRAY: extern "C" fn(f64) -> f64 = super::js_node_stream_is_uint8_array; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_IS_DESTROYED: extern "C" fn(f64) -> f64 = super::js_node_stream_is_destroyed; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_UINT8_ARRAY_TO_BUFFER: extern "C" fn(f64) -> f64 = super::js_node_stream_uint8_array_to_buffer; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_GET_DEFAULT_HWM: extern "C" fn(f64) -> f64 = super::js_node_stream_get_default_hwm; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_SET_DEFAULT_HWM: extern "C" fn(f64, f64) -> f64 = super::js_node_stream_set_default_hwm; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_ADD_ABORT_SIGNAL: extern "C" fn(f64, f64) -> f64 = super::js_node_stream_add_abort_signal; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_COMPOSE: extern "C" fn(*const crate::array::ArrayHeader) -> f64 = super::js_node_stream_compose; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_PIPELINE: extern "C" fn(*const crate::array::ArrayHeader) -> f64 = super::js_node_stream_pipeline; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_DUPLEX_PAIR: extern "C" fn(f64) -> f64 = super::js_node_stream_duplex_pair; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_TO_WEB: extern "C" fn(f64) -> f64 = super::js_node_stream_to_web; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NS_FROM_WEB: extern "C" fn(f64) -> f64 = super::js_node_stream_from_web; diff --git a/crates/perry-runtime/src/node_submodules/zlib.rs b/crates/perry-runtime/src/node_submodules/zlib.rs index 0b90f04a13..58d8340e84 100644 --- a/crates/perry-runtime/src/node_submodules/zlib.rs +++ b/crates/perry-runtime/src/node_submodules/zlib.rs @@ -292,17 +292,17 @@ pub extern "C" fn js_zlib_validate_callback(callback: f64) -> i64 { /// `project_auto_optimize_keepalive_3320`). Called only from generated `.o` / /// `perry-ext-zlib`, so without an explicit anchor the dead-stripper drops it. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ZLIB_RESOLVE_LEVEL: extern "C" fn(f64) -> i32 = js_zlib_resolve_level; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ZLIB_VALIDATE_PARAMS: extern "C" fn(f64, f64) -> i32 = js_zlib_validate_params; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ZLIB_VALIDATE_OPTIONS: extern "C" fn(f64, i32) = js_zlib_validate_options; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ZLIB_VALIDATE_BUFFER_ARG: extern "C" fn(i64) = js_zlib_validate_buffer_arg; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ZLIB_VALIDATE_CALLBACK: extern "C" fn(f64) -> i64 = js_zlib_validate_callback; diff --git a/crates/perry-runtime/src/node_v8.rs b/crates/perry-runtime/src/node_v8.rs index 62e0caa279..3c651066de 100644 --- a/crates/perry-runtime/src/node_v8.rs +++ b/crates/perry-runtime/src/node_v8.rs @@ -35,63 +35,63 @@ use crate::value::JSValue; // auto-optimize whole-program-LLVM build would dead-strip them without an // anchor (see node_stream_keepalive.rs). Pin each via a `#[used]` static. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_SERIALIZE: extern "C" fn(f64) -> f64 = js_v8_serialize; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_DESERIALIZE: extern "C" fn(f64) -> f64 = js_v8_deserialize; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_HEAP_STATS: extern "C" fn() -> f64 = js_v8_get_heap_statistics; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_CODE_STATS: extern "C" fn() -> f64 = js_v8_get_heap_code_statistics; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_SPACE_STATS: extern "C" fn() -> f64 = js_v8_get_heap_space_statistics; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_VERSION_TAG: extern "C" fn() -> f64 = js_v8_cached_data_version_tag; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_GET_HEAP_SNAPSHOT: extern "C" fn(f64) -> f64 = js_v8_get_heap_snapshot; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_WRITE_HEAP_SNAPSHOT: extern "C" fn(f64, f64) -> f64 = js_v8_write_heap_snapshot; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_GC_PROFILER_NEW: extern "C" fn() -> f64 = js_v8_gc_profiler_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_GC_PROFILER_START: extern "C" fn(f64) -> f64 = js_v8_gc_profiler_start; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_GC_PROFILER_STOP: extern "C" fn(f64) -> f64 = js_v8_gc_profiler_stop; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_GC_PROFILER_REPORT: extern "C" fn() -> f64 = js_v8_gc_profiler_report; // #3680: Serializer / Deserializer class constructors. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_SERIALIZER_NEW: extern "C" fn(f64) -> f64 = js_v8_serializer_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_DESERIALIZER_NEW: extern "C" fn(f64) -> f64 = js_v8_deserializer_new; // #3679: lifecycle / diagnostic-control surface. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_NOOP_UNDEFINED: extern "C" fn() -> f64 = js_v8_noop_undefined; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_IS_BUILDING_SNAPSHOT: extern "C" fn() -> f64 = js_v8_is_building_snapshot; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_NAMESPACE: extern "C" fn(*const u8, usize) -> f64 = js_v8_namespace; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_THROW_NOT_BUILDING: extern "C" fn() -> f64 = js_v8_throw_not_building_snapshot; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_V8_PROMISE_HOOK_REGISTER: extern "C" fn() -> f64 = js_v8_promise_hook_register; const TAG_UNDEFINED_BITS: u64 = 0x7FFC_0000_0000_0001; diff --git a/crates/perry-runtime/src/object/alloc.rs b/crates/perry-runtime/src/object/alloc.rs index 7003d1766f..5f0b4afe33 100644 --- a/crates/perry-runtime/src/object/alloc.rs +++ b/crates/perry-runtime/src/object/alloc.rs @@ -734,7 +734,7 @@ pub extern "C" fn js_object_alloc_class_dynamic_parent( /// generated-code-only callee, so the auto-optimize whole-program build would /// otherwise dead-strip it (see the FFI-symbol-link-break class). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_OBJECT_ALLOC_CLASS_DYNAMIC_PARENT: extern "C" fn( u32, u32, diff --git a/crates/perry-runtime/src/object/class_constructors.rs b/crates/perry-runtime/src/object/class_constructors.rs index c515904985..6286afc168 100644 --- a/crates/perry-runtime/src/object/class_constructors.rs +++ b/crates/perry-runtime/src/object/class_constructors.rs @@ -18,7 +18,7 @@ use super::ObjectHeader; /// refresh sites along every assignment path, including paths that skipped the /// corresponding class expression. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CLASS_OBJECT_REFRESH_CAPTURE_VALUES: extern "C" fn(f64, i64, f64) = js_class_object_refresh_capture_values; @@ -45,7 +45,7 @@ pub extern "C" fn js_class_object_refresh_capture_values( /// `undefined` slots and therefore never consults a later evaluation's /// name-keyed state. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CLASS_CAPTURE_VALUE_FOR_RECEIVER: extern "C" fn(f64, u32, u32) -> f64 = js_class_capture_value_for_receiver; @@ -176,7 +176,7 @@ pub extern "C" fn js_register_class_constructor_flags( /// Keepalive anchor (generated-code-only callee). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_REGISTER_CLASS_CONSTRUCTOR_FLAGS: extern "C" fn(i64, i64, i64) = js_register_class_constructor_flags; @@ -231,7 +231,7 @@ pub unsafe extern "C" fn js_class_register_capture_values( /// Keepalive anchor for the auto-optimize whole-program build — /// `js_class_register_capture_values` is a generated-code-only callee. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CLASS_REGISTER_CAPTURE_VALUES: unsafe extern "C" fn(u32, *const f64, usize) = js_class_register_capture_values; @@ -421,14 +421,14 @@ pub(crate) fn fallback_is_tag_stripped(fallback: f64) -> bool { /// Keepalive anchors (generated-code-only callees). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CLASS_CAPTURE_VALUE: extern "C" fn(u32, u32) -> f64 = js_class_capture_value; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_CLASS_CAPTURE_VALUE_OR: extern "C" fn(u32, u32, f64) -> f64 = js_class_capture_value_or; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_PARAM_OR_CLASS_CAPTURE_VALUE: extern "C" fn(f64, u32, u32) -> f64 = js_param_or_class_capture_value; @@ -627,7 +627,7 @@ pub unsafe extern "C" fn js_super_construct_apply( /// Keepalive anchor (generated-code-only callee). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SUPER_CONSTRUCT_APPLY: unsafe extern "C" fn(u32, f64, f64) -> f64 = js_super_construct_apply; @@ -805,7 +805,7 @@ unsafe fn call_displaced_native_base_method( /// Keepalive anchor (generated-code-only callee). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SUPER_METHOD_CALL_DYNAMIC: unsafe extern "C" fn( u32, *const u8, @@ -863,7 +863,7 @@ pub unsafe extern "C" fn js_super_method_call_dynamic_apply( /// Keepalive anchor (generated-code-only callee). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SUPER_METHOD_CALL_DYNAMIC_APPLY: unsafe extern "C" fn( u32, *const u8, @@ -1020,7 +1020,7 @@ pub unsafe extern "C" fn js_array_push_spread_any( /// Keepalive anchor (generated-code-only callee). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ARRAY_PUSH_SPREAD_ANY: unsafe extern "C" fn( *mut crate::array::ArrayHeader, f64, @@ -1139,13 +1139,13 @@ pub unsafe extern "C" fn js_error_subclass_default_init_with_options( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ERROR_SUBCLASS_DEFAULT_INIT_WITH_OPTIONS: unsafe extern "C" fn(f64, f64, f64) = js_error_subclass_default_init_with_options; /// Keepalive: generated code is the only caller (#6469). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ERROR_SUBCLASS_DEFAULT_INIT: unsafe extern "C" fn(f64, f64) = js_error_subclass_default_init; diff --git a/crates/perry-runtime/src/object/class_meta_registry.rs b/crates/perry-runtime/src/object/class_meta_registry.rs index eb81c7ccb2..3d348712a2 100644 --- a/crates/perry-runtime/src/object/class_meta_registry.rs +++ b/crates/perry-runtime/src/object/class_meta_registry.rs @@ -179,7 +179,7 @@ pub extern "C" fn js_register_class_generic_origin(class_id: u32, generic_id: u3 /// Keepalive anchor: emitted only from generated module-init code, so the /// whole-program auto-optimize bitcode pass would otherwise dead-strip it. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REGISTER_CLASS_GENERIC_ORIGIN: extern "C" fn(u32, u32) = js_register_class_generic_origin; diff --git a/crates/perry-runtime/src/object/class_registry/construct/class_return.rs b/crates/perry-runtime/src/object/class_registry/construct/class_return.rs index 36dca29f25..22345cce18 100644 --- a/crates/perry-runtime/src/object/class_registry/construct/class_return.rs +++ b/crates/perry-runtime/src/object/class_registry/construct/class_return.rs @@ -17,7 +17,7 @@ pub unsafe extern "C" fn js_builtin_subclass_construct( js_new_function_construct_with_new_target(target, args_ptr, args_len, new_target) } -#[used] +#[used(compiler)] static KEEP_JS_BUILTIN_SUBCLASS_CONSTRUCT: unsafe extern "C" fn( u32, *const u8, diff --git a/crates/perry-runtime/src/object/class_registry/registration.rs b/crates/perry-runtime/src/object/class_registry/registration.rs index a6dcfb9deb..77d0783efa 100644 --- a/crates/perry-runtime/src/object/class_registry/registration.rs +++ b/crates/perry-runtime/src/object/class_registry/registration.rs @@ -127,7 +127,7 @@ pub unsafe extern "C" fn js_register_class_string_member_order( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REGISTER_CLASS_STRING_MEMBER_ORDER: unsafe extern "C" fn( i64, *const u8, @@ -414,11 +414,11 @@ pub unsafe extern "C" fn js_register_class_static_setter( // caller), so the auto-optimize whole-program-LLVM build would dead-strip them // without an anchor. Pin each via a `#[used]` static (mirrors node_v8.rs). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REGISTER_STATIC_GETTER: unsafe extern "C" fn(i64, *const u8, i64, i64) = js_register_class_static_getter; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REGISTER_STATIC_SETTER: unsafe extern "C" fn(i64, *const u8, i64, i64) = js_register_class_static_setter; @@ -452,7 +452,7 @@ pub unsafe extern "C" fn js_register_class_method_bind_length( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REGISTER_METHOD_BIND_LENGTH: unsafe extern "C" fn(i64, *const u8, i64, i64) = js_register_class_method_bind_length; @@ -486,7 +486,7 @@ pub unsafe extern "C" fn js_register_class_static_method_bind_length( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REGISTER_STATIC_METHOD_BIND_LENGTH: unsafe extern "C" fn(i64, *const u8, i64, i64) = js_register_class_static_method_bind_length; diff --git a/crates/perry-runtime/src/object/descriptors.rs b/crates/perry-runtime/src/object/descriptors.rs index 28f77b966e..11b61e7f15 100644 --- a/crates/perry-runtime/src/object/descriptors.rs +++ b/crates/perry-runtime/src/object/descriptors.rs @@ -1913,7 +1913,7 @@ pub extern "C" fn js_object_create_with_props(proto_value: f64, props_value: f64 } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_OBJECT_CREATE_WITH_PROPS: extern "C" fn(f64, f64) -> f64 = js_object_create_with_props; /// `Object.getOwnPropertyDescriptor` handling for native-module namespace diff --git a/crates/perry-runtime/src/object/global_this/builtin_thunks.rs b/crates/perry-runtime/src/object/global_this/builtin_thunks.rs index 944af62286..1adb2efa93 100644 --- a/crates/perry-runtime/src/object/global_this/builtin_thunks.rs +++ b/crates/perry-runtime/src/object/global_this/builtin_thunks.rs @@ -530,13 +530,13 @@ extern "C" fn depd_wrapfunction_outer_thunk( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] #[cfg(not(panic = "abort"))] static KEEP_JS_FUNCTION_CTOR_FROM_STRINGS: extern "C-unwind" fn(*const f64, usize) -> f64 = js_function_ctor_from_strings; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] #[cfg(panic = "abort")] static KEEP_JS_FUNCTION_CTOR_FROM_STRINGS: extern "C" fn(*const f64, usize) -> f64 = js_function_ctor_from_strings; diff --git a/crates/perry-runtime/src/object/global_this/fetch_globals.rs b/crates/perry-runtime/src/object/global_this/fetch_globals.rs index 57693ddb65..1bdc321a4d 100644 --- a/crates/perry-runtime/src/object/global_this/fetch_globals.rs +++ b/crates/perry-runtime/src/object/global_this/fetch_globals.rs @@ -64,7 +64,7 @@ pub extern "C" fn js_module_top_this() -> f64 { /// rebuild would dead-strip it without this `#[used]` pin (see /// project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_TOP_THIS: extern "C" fn() -> f64 = js_module_top_this; /// Issue #611: lazily allocate `globalThis` for computed global access. @@ -527,11 +527,11 @@ pub extern "C" fn js_response_subclass_init(this_box: f64, body: f64, init: f64) // bitcode rebuild's dead-strip can't drop them (see // project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_REQUEST_SUBCLASS_INIT: extern "C" fn(f64, f64, f64) -> f64 = js_request_subclass_init; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_RESPONSE_SUBCLASS_INIT: extern "C" fn(f64, f64, f64) -> f64 = js_response_subclass_init; @@ -1008,7 +1008,7 @@ pub unsafe extern "C" fn js_fetch_or_value_super( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_FETCH_OR_VALUE_SUPER: unsafe extern "C" fn(f64, f64, *const f64, usize) -> f64 = js_fetch_or_value_super; diff --git a/crates/perry-runtime/src/object/groupby.rs b/crates/perry-runtime/src/object/groupby.rs index da54812c90..5cfdd22cd5 100644 --- a/crates/perry-runtime/src/object/groupby.rs +++ b/crates/perry-runtime/src/object/groupby.rs @@ -184,10 +184,10 @@ pub extern "C" fn js_map_group_by(items_value: f64, callback: f64) -> f64 { /// codegen-emitted `.o`. The auto-optimize whole-program LLVM rebuild /// dead-strips unreferenced `#[no_mangle]` symbols (see #3320), so pin them. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_OBJECT_GROUP_BY: extern "C" fn(f64, f64) -> f64 = js_object_group_by; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_MAP_GROUP_BY: extern "C" fn(f64, f64) -> f64 = js_map_group_by; /// NaN-box a heap address with `POINTER_TAG`. diff --git a/crates/perry-runtime/src/object/native_module.rs b/crates/perry-runtime/src/object/native_module.rs index aae9100a82..1ae26fe3e7 100644 --- a/crates/perry-runtime/src/object/native_module.rs +++ b/crates/perry-runtime/src/object/native_module.rs @@ -1462,7 +1462,7 @@ pub extern "C" fn js_class_method_bind_by_id(instance: f64, method_id: i64) -> f } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_CLASS_METHOD_BIND_BY_ID: extern "C" fn(f64, i64) -> f64 = js_class_method_bind_by_id; #[cfg(test)] diff --git a/crates/perry-runtime/src/object/native_this_alias.rs b/crates/perry-runtime/src/object/native_this_alias.rs index 849b35e650..47080e4a91 100644 --- a/crates/perry-runtime/src/object/native_this_alias.rs +++ b/crates/perry-runtime/src/object/native_this_alias.rs @@ -294,10 +294,10 @@ pub unsafe extern "C" fn js_https_server_construct_with_this( /// dead-strips `#[no_mangle]` fns referenced only from generated `.o` /// files. See the `KEEP_JS_FUNCTION_BIND` precedent in closure/dispatch.rs. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_HTTP_SERVER_CONSTRUCT_WITH_THIS: unsafe extern "C" fn(f64, f64, f64) -> f64 = js_http_server_construct_with_this; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_HTTPS_SERVER_CONSTRUCT_WITH_THIS: unsafe extern "C" fn(f64, f64, f64) -> f64 = js_https_server_construct_with_this; diff --git a/crates/perry-runtime/src/object/object_ops/has_own.rs b/crates/perry-runtime/src/object/object_ops/has_own.rs index 203ac1bd10..eb07574f9f 100644 --- a/crates/perry-runtime/src/object/object_ops/has_own.rs +++ b/crates/perry-runtime/src/object/object_ops/has_own.rs @@ -731,6 +731,6 @@ pub extern "C" fn js_object_property_is_enumerable(obj_value: f64, key_value: f6 } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROPERTY_IS_ENUMERABLE: extern "C" fn(f64, f64) -> f64 = js_object_property_is_enumerable; diff --git a/crates/perry-runtime/src/object/shapes.rs b/crates/perry-runtime/src/object/shapes.rs index de30fc8f15..329caeeb07 100644 --- a/crates/perry-runtime/src/object/shapes.rs +++ b/crates/perry-runtime/src/object/shapes.rs @@ -989,7 +989,7 @@ pub extern "C" fn js_shape_ordinary_inline_slot_for_key(shape_id: u32, key_bits: /// preheader), so the auto-optimize whole-program build would otherwise /// dead-strip it (see the FFI-symbol-link-break class). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SHAPE_ORDINARY_INLINE_SLOT_FOR_KEY: extern "C" fn(u32, u64) -> i32 = js_shape_ordinary_inline_slot_for_key; diff --git a/crates/perry-runtime/src/object/this_binding.rs b/crates/perry-runtime/src/object/this_binding.rs index a339420d52..a53ad4fa50 100644 --- a/crates/perry-runtime/src/object/this_binding.rs +++ b/crates/perry-runtime/src/object/this_binding.rs @@ -128,7 +128,7 @@ pub(crate) fn static_this_disarm() { /// subclass-receiver). // #1561-style force-keep: only generated IR calls this. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_STATIC_THIS_ARM_CLASSREF: extern "C" fn(u32) = js_static_this_arm_classref; #[no_mangle] @@ -144,7 +144,7 @@ pub extern "C" fn js_static_this_arm_classref(class_id: u32) { /// time) right before the direct call. // #1561-style force-keep: only generated IR calls this. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_STATIC_THIS_ARM_VALUE: extern "C" fn(f64) = js_static_this_arm_value; #[no_mangle] @@ -156,7 +156,7 @@ pub extern "C" fn js_static_this_arm_value(value: f64) { /// else the lexical class-ref the codegen passes in. // #1561-style force-keep: only generated IR calls this. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_STATIC_THIS_RESOLVE: extern "C" fn(f64) -> f64 = js_static_this_resolve; #[no_mangle] diff --git a/crates/perry-runtime/src/object/with_env.rs b/crates/perry-runtime/src/object/with_env.rs index 175765f3aa..6791753d3e 100644 --- a/crates/perry-runtime/src/object/with_env.rs +++ b/crates/perry-runtime/src/object/with_env.rs @@ -123,10 +123,10 @@ pub extern "C" fn js_with_implicit_unset() -> f64 { // #1561-style force-keep: only generated IR calls these. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_WITH_IMPLICIT_UNSET: extern "C" fn() -> f64 = js_with_implicit_unset; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_WITH_IMPLICIT_READ: extern "C" fn(f64, f64) -> f64 = js_with_implicit_read; /// `name` arrives as a NaN-boxed string (codegen lowers `Expr::String` args diff --git a/crates/perry-runtime/src/os.rs b/crates/perry-runtime/src/os.rs index 7d314e4786..2c8d90a7d7 100644 --- a/crates/perry-runtime/src/os.rs +++ b/crates/perry-runtime/src/os.rs @@ -1316,7 +1316,7 @@ fn options_request_buffer(opts_bits: i64) -> bool { } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_OS_USER_INFO_OPTIONS: extern "C" fn(i64) -> *mut ObjectHeader = js_os_user_info_options; fn js_os_user_info_impl(buffer_encoding: bool) -> *mut ObjectHeader { diff --git a/crates/perry-runtime/src/os/os_process_emitter.rs b/crates/perry-runtime/src/os/os_process_emitter.rs index e26071d01b..7d91e5a191 100644 --- a/crates/perry-runtime/src/os/os_process_emitter.rs +++ b/crates/perry-runtime/src/os/os_process_emitter.rs @@ -485,7 +485,7 @@ pub extern "C" fn js_process_emit_before_exit_pending() { // against the auto-optimize whole-program dead-strip (#4876), like the other // epilogue hooks. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROCESS_EMIT_BEFORE_EXIT_PENDING: extern "C" fn() = js_process_emit_before_exit_pending; crate::perry_thread_local! { diff --git a/crates/perry-runtime/src/param_type_guard.rs b/crates/perry-runtime/src/param_type_guard.rs index 1fe0df8457..d424da78d1 100644 --- a/crates/perry-runtime/src/param_type_guard.rs +++ b/crates/perry-runtime/src/param_type_guard.rs @@ -809,7 +809,7 @@ pub extern "C" fn js_param_type_guard(value: f64, descriptor: *const u8, length: } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_PARAM_TYPE_GUARD: extern "C" fn(f64, *const u8, u32) -> i32 = js_param_type_guard; #[cfg(test)] diff --git a/crates/perry-runtime/src/path.rs b/crates/perry-runtime/src/path.rs index 60cc0b2b88..f59be71803 100644 --- a/crates/perry-runtime/src/path.rs +++ b/crates/perry-runtime/src/path.rs @@ -830,11 +830,11 @@ pub extern "C" fn js_path_win32_relative_checked(from_f64: f64, to_f64: f64) -> /// Keepalive anchors: these are emitted only from generated code, so the /// whole-program auto-optimize bitcode pass would otherwise dead-strip them. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PATH_RELATIVE_CHECKED: extern "C" fn(f64, f64) -> *mut StringHeader = js_path_relative_checked; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PATH_WIN32_RELATIVE_CHECKED: extern "C" fn(f64, f64) -> *mut StringHeader = js_path_win32_relative_checked; diff --git a/crates/perry-runtime/src/path/value_args.rs b/crates/perry-runtime/src/path/value_args.rs index f924660469..523a7ae22c 100644 --- a/crates/perry-runtime/src/path/value_args.rs +++ b/crates/perry-runtime/src/path/value_args.rs @@ -53,7 +53,7 @@ pub extern "C" fn js_path_arg_header(value: f64) -> i64 { /// Keepalive anchor: emitted only from generated code, so the whole-program /// auto-optimize bitcode pass would otherwise dead-strip it. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PATH_ARG_HEADER: extern "C" fn(f64) -> i64 = js_path_arg_header; pub(crate) fn path_arg_header(value: f64) -> *const StringHeader { @@ -120,7 +120,7 @@ macro_rules! two_operand_value_entry { /// Keepalive anchor — see [`KEEP_PATH_ARG_HEADER`]. #[cfg(feature = "keepalive-anchors")] - #[used] + #[used(compiler)] static $keep: extern "C" fn(f64, f64) -> $ret = $value_fn; }; } diff --git a/crates/perry-runtime/src/process/env_misc.rs b/crates/perry-runtime/src/process/env_misc.rs index 785bb80e4f..e3023f35b9 100644 --- a/crates/perry-runtime/src/process/env_misc.rs +++ b/crates/perry-runtime/src/process/env_misc.rs @@ -153,7 +153,7 @@ pub extern "C" fn js_process_run_exit_sequence() { // Codegen-only symbol — anchor it against the auto-optimize whole-program // dead-strip (#4876), like `js_process_pending_exit_code` below. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROCESS_RUN_EXIT_SEQUENCE: extern "C" fn() = js_process_run_exit_sequence; /// Terminate without running process-wide cleanup after thread-local GC state @@ -972,7 +972,7 @@ pub extern "C" fn js_process_pending_exit_code() -> i32 { // auto-optimize whole-program dead-strip cannot drop it (same guard the // unhandled-rejection reporter uses, #4876). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROCESS_PENDING_EXIT_CODE: extern "C" fn() -> i32 = js_process_pending_exit_code; /// Set an environment variable. Backs `process.env.X = v` (#1344). @@ -1055,76 +1055,76 @@ pub extern "C" fn js_setenv(name_ptr: *const StringHeader, value: f64) { // below pin a retained reference edge so both survive every link mode. See // the same pattern in `value/dyn_index.rs`. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SETENV: extern "C" fn(*const StringHeader, f64) = js_setenv; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_REMOVEENV: extern "C" fn(*const StringHeader) = js_removeenv; // #3120: codegen emits `js_module_find_package_json` only from generated `.o`, // so pin a retained reference edge for the auto-optimize whole-program build. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_FIND_PACKAGE_JSON: extern "C" fn(f64, f64, f64) -> f64 = js_module_find_package_json; // node:module helper-state APIs are codegen-emitted from generated `.o`, so pin // retained reference edges for the auto-optimize whole-program build. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_ENABLE_COMPILE_CACHE: extern "C" fn(f64) -> f64 = js_module_enable_compile_cache; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_FLUSH_COMPILE_CACHE: extern "C" fn() -> f64 = js_module_flush_compile_cache; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_GET_COMPILE_CACHE_DIR: extern "C" fn() -> f64 = js_module_get_compile_cache_dir; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_GET_SOURCE_MAPS_SUPPORT: extern "C" fn() -> f64 = js_module_get_source_maps_support; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_SET_SOURCE_MAPS_SUPPORT: extern "C" fn(f64, f64) -> f64 = js_module_set_source_maps_support; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_STRIP_TYPESCRIPT_TYPES: extern "C" fn(f64, f64) -> f64 = js_module_strip_typescript_types; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_REGISTER: extern "C" fn(f64, f64, f64) -> f64 = js_module_register; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_REGISTER_HOOKS: extern "C" fn(f64) -> f64 = js_module_register_hooks; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_DYNAMIC_IMPORT_APPLY_HOOKS: extern "C" fn(f64) -> f64 = js_module_dynamic_import_apply_hooks; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_MODULE_NEW: extern "C" fn(f64, f64) -> f64 = js_module_module_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_FIND_PATH: extern "C" fn(f64, f64, f64) -> f64 = js_module_find_path; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_INIT_PATHS: extern "C" fn() -> f64 = js_module_init_paths; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_LOAD: extern "C" fn(f64, f64, f64) -> f64 = js_module_load; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_NODE_MODULE_PATHS: extern "C" fn(f64) -> f64 = js_module_node_module_paths; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_PRELOAD_MODULES: extern "C" fn(f64) -> f64 = js_module_preload_modules; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_RESOLVE_FILENAME: extern "C" fn(f64, f64, f64, f64) -> f64 = js_module_resolve_filename; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_MODULE_RESOLVE_LOOKUP_PATHS: extern "C" fn(f64, f64) -> f64 = js_module_resolve_lookup_paths; @@ -1522,17 +1522,17 @@ pub(super) fn read_js_string_lossy(value: f64) -> String { // whole-program build doesn't internalize + dead-strip them. Same rationale // as KEEP_JS_SETENV above. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_PROCESS_SOURCE_MAPS_ENABLED: extern "C" fn() -> f64 = js_process_source_maps_enabled; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_PROCESS_SET_SOURCE_MAPS_ENABLED: extern "C" fn(f64) -> f64 = js_process_set_source_maps_enabled; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_PROCESS_REF: extern "C" fn(f64) -> f64 = js_process_ref; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_PROCESS_UNREF: extern "C" fn(f64) -> f64 = js_process_unref; #[cfg(test)] diff --git a/crates/perry-runtime/src/promise/async_step.rs b/crates/perry-runtime/src/promise/async_step.rs index 974141af9b..a709b4592e 100644 --- a/crates/perry-runtime/src/promise/async_step.rs +++ b/crates/perry-runtime/src/promise/async_step.rs @@ -943,7 +943,7 @@ pub extern "C" fn js_async_generator_resume( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ASYNC_GENERATOR_RESUME: extern "C" fn(f64, f64, f64) -> f64 = js_async_generator_resume; diff --git a/crates/perry-runtime/src/promise/combinators.rs b/crates/perry-runtime/src/promise/combinators.rs index 536ad5e507..59c3de5f59 100644 --- a/crates/perry-runtime/src/promise/combinators.rs +++ b/crates/perry-runtime/src/promise/combinators.rs @@ -558,17 +558,17 @@ pub extern "C" fn js_promise_any_iterable(value: f64) -> *mut Promise { /// #2822/#3320: keepalive anchors so the whole-program LLVM (auto-optimize) /// build does not dead-strip these codegen-only `#[no_mangle]` entry points. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROMISE_ALL_ITERABLE: extern "C" fn(f64) -> *mut Promise = js_promise_all_iterable; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROMISE_RACE_ITERABLE: extern "C" fn(f64) -> *mut Promise = js_promise_race_iterable; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROMISE_ALL_SETTLED_ITERABLE: extern "C" fn(f64) -> *mut Promise = js_promise_all_settled_iterable; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROMISE_ANY_ITERABLE: extern "C" fn(f64) -> *mut Promise = js_promise_any_iterable; // Queue for scheduled promise resolutions diff --git a/crates/perry-runtime/src/promise/microtasks.rs b/crates/perry-runtime/src/promise/microtasks.rs index 6f42949582..6509e70195 100644 --- a/crates/perry-runtime/src/promise/microtasks.rs +++ b/crates/perry-runtime/src/promise/microtasks.rs @@ -132,7 +132,7 @@ pub extern "C" fn js_promise_run_before_exit_checkpoint() -> i32 { } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROMISE_RUN_BEFORE_EXIT_CHECKPOINT: extern "C" fn() -> i32 = js_promise_run_before_exit_checkpoint; @@ -140,7 +140,7 @@ static KEEP_PROMISE_RUN_BEFORE_EXIT_CHECKPOINT: extern "C" fn() -> i32 = // references this symbol — anchor it like the other codegen-only hooks so the // auto-optimize internalize+dead-strip pass can't drop it (#4876). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROMISE_RUN_MICROTASKS_EVENT_LOOP: extern "C" fn() -> i32 = js_promise_run_microtasks_event_loop; diff --git a/crates/perry-runtime/src/promise/mod.rs b/crates/perry-runtime/src/promise/mod.rs index 5f93d06ba9..75fca14189 100644 --- a/crates/perry-runtime/src/promise/mod.rs +++ b/crates/perry-runtime/src/promise/mod.rs @@ -498,31 +498,31 @@ pub fn scan_iter_result_root_mut(visitor: &mut crate::gc::RuntimeRootVisitor<'_> } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ITER_RESULT_SET: extern "C" fn(f64, i32) -> f64 = js_iter_result_set; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ITER_RESULT_SET_F64: extern "C" fn(f64, i32) -> f64 = js_iter_result_set_f64; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ITER_RESULT_SET_I32: extern "C" fn(i32, i32) -> f64 = js_iter_result_set_i32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ITER_RESULT_SET_I1: extern "C" fn(i32, i32) -> f64 = js_iter_result_set_i1; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ITER_RESULT_GET_VALUE: extern "C" fn() -> f64 = js_iter_result_get_value; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ITER_RESULT_GET_VALUE_F64: extern "C" fn() -> f64 = js_iter_result_get_value_f64; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ITER_RESULT_GET_VALUE_I32: extern "C" fn() -> i32 = js_iter_result_get_value_i32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ITER_RESULT_GET_VALUE_I1: extern "C" fn() -> i32 = js_iter_result_get_value_i1; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ITER_RESULT_GET_DONE: extern "C" fn() -> f64 = js_iter_result_get_done; /// Promise state diff --git a/crates/perry-runtime/src/promise/rejection.rs b/crates/perry-runtime/src/promise/rejection.rs index 459e1a587a..e4eacebf4a 100644 --- a/crates/perry-runtime/src/promise/rejection.rs +++ b/crates/perry-runtime/src/promise/rejection.rs @@ -104,7 +104,7 @@ pub extern "C" fn js_promise_mark_internally_handled(promise: *mut Promise) { /// PERRY_NO_AUTO_OPTIMIZE prebuilt-lib link (same pattern as the checkpoint /// hook anchors below). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROMISE_MARK_INTERNALLY_HANDLED: extern "C" fn(*mut Promise) = js_promise_mark_internally_handled; @@ -269,7 +269,7 @@ pub extern "C" fn js_promise_report_unhandled_rejections() { // fails with "undefined symbol". The classic link needs no anchor (see the // error.rs/combinators.rs anchors for the same pattern). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROMISE_REPORT_UNHANDLED_REJECTIONS: extern "C" fn() = js_promise_report_unhandled_rejections; diff --git a/crates/perry-runtime/src/proxy.rs b/crates/perry-runtime/src/proxy.rs index 3f26fd3bd5..5251672421 100644 --- a/crates/perry-runtime/src/proxy.rs +++ b/crates/perry-runtime/src/proxy.rs @@ -2375,7 +2375,7 @@ pub extern "C" fn js_proxy_revocable(target: f64, handler: f64) -> f64 { // #2846: retention anchor for `Proxy.revocable` (codegen-only callsite). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PROXY_REVOCABLE: extern "C" fn(f64, f64) -> f64 = js_proxy_revocable; // #2762: retention anchors for the Reflect-specific extensibility entry points. @@ -2383,35 +2383,35 @@ static KEEP_PROXY_REVOCABLE: extern "C" fn(f64, f64) -> f64 = js_proxy_revocable // crate graph), so the auto-optimize whole-program LLVM bitcode rebuild would // otherwise internalize and dead-strip them. See node_stream_keepalive.rs. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REFLECT_IS_EXTENSIBLE: extern "C" fn(f64) -> f64 = js_reflect_is_extensible; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REFLECT_PREVENT_EXTENSIONS: extern "C" fn(f64) -> f64 = js_reflect_prevent_extensions; // #2761: retention anchor for `Reflect.setPrototypeOf` (codegen-only callsite). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REFLECT_SET_PROTOTYPE_OF: extern "C" fn(f64, f64) -> f64 = js_reflect_set_prototype_of; // #2763/#2764/#2766/#2767: retention anchors for the Reflect entry points // whose only callsites are codegen-emitted. `js_reflect_get` gained a third // `receiver` arg (#2766) and must keep its new signature retained. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REFLECT_GET: extern "C" fn(f64, f64, f64) -> f64 = js_reflect_get; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REFLECT_GET_OWN_PROPERTY_DESCRIPTOR: extern "C" fn(f64, f64) -> f64 = js_reflect_get_own_property_descriptor; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REFLECT_HAS: extern "C" fn(f64, f64) -> f64 = js_reflect_has; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REFLECT_OWN_KEYS: extern "C" fn(f64) -> f64 = js_reflect_own_keys; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REFLECT_APPLY: extern "C" fn(f64, f64, f64) -> f64 = js_reflect_apply; /// #8194: death pruning for `REFLECT_METADATA`. diff --git a/crates/perry-runtime/src/proxy/put_value.rs b/crates/perry-runtime/src/proxy/put_value.rs index 9a6858ca65..afe7d8f90d 100644 --- a/crates/perry-runtime/src/proxy/put_value.rs +++ b/crates/perry-runtime/src/proxy/put_value.rs @@ -892,7 +892,7 @@ unsafe fn dyn_ic_try_store(target: f64, token: u64, slot: u32, value: f64) -> Op // #6088-style keep: codegen emits the only call; a whole-program bitcode // link would otherwise dead-strip the IC entry. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_PUT_VALUE_SET_DYN_IC: extern "C" fn( *mut WritePicCacheSlot, f64, @@ -960,7 +960,7 @@ pub extern "C" fn js_transition_ic_spill_append( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TRANSITION_IC_SPILL_APPEND: extern "C" fn(f64, i64, u32, f64) -> i32 = js_transition_ic_spill_append; diff --git a/crates/perry-runtime/src/regex/escape.rs b/crates/perry-runtime/src/regex/escape.rs index 214044fc13..8c8966fa3e 100644 --- a/crates/perry-runtime/src/regex/escape.rs +++ b/crates/perry-runtime/src/regex/escape.rs @@ -140,7 +140,7 @@ pub extern "C" fn js_regexp_escape(input: f64) -> f64 { /// `.o`, so the auto-optimize whole-program LLVM rebuild would dead-strip it /// without this `#[used]` reference (see #3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_REGEXP_ESCAPE: extern "C" fn(f64) -> f64 = js_regexp_escape; /// ECMA-262 22.2.6.10 EscapeRegExpPattern for a valid UTF-8 pattern. diff --git a/crates/perry-runtime/src/set.rs b/crates/perry-runtime/src/set.rs index 7ad76f0849..63892278a1 100644 --- a/crates/perry-runtime/src/set.rs +++ b/crates/perry-runtime/src/set.rs @@ -871,7 +871,7 @@ pub extern "C" fn js_set_find_value_index(set_boxed: f64, value: f64) -> f64 { unsafe { find_value_index(set, normalize_zero(value)) as f64 } } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_FIND_VALUE_INDEX: extern "C" fn(f64, f64) -> f64 = js_set_find_value_index; /// Members of a set this small are found faster by reading them than by @@ -1062,7 +1062,7 @@ pub extern "C" fn js_set_cursor_next(set_boxed: f64, cursor: f64, epoch: f64) -> } } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_CURSOR_NEXT: extern "C" fn(f64, f64, f64) -> f64 = js_set_cursor_next; /// C-ABI companion: the header's compaction epoch the loop stores after @@ -1076,7 +1076,7 @@ pub extern "C" fn js_set_compaction_epoch(set_boxed: f64) -> f64 { set_compaction_epoch(set) as f64 } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_COMPACTION_EPOCH: extern "C" fn(f64) -> f64 = js_set_compaction_epoch; unsafe fn compact_set_elements(set: *mut SetHeader) { @@ -1749,64 +1749,64 @@ pub extern "C" fn js_set_delete_bool(set: *mut SetHeader, value: i32) -> i32 { // generated LLVM IR. Keep roots prevent whole-program LTO/dead-strip from // removing the exported symbols when the Rust crate graph has no caller. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_ADD_STRING: extern "C" fn( *mut SetHeader, *const StringHeader, ) -> *mut SetHeader = js_set_add_string; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_ADD_NUMBER: extern "C" fn(*mut SetHeader, f64) -> *mut SetHeader = js_set_add_number; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_HAS_STRING: extern "C" fn(*const SetHeader, *const StringHeader) -> i32 = js_set_has_string; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_HAS_NUMBER: extern "C" fn(*const SetHeader, f64) -> i32 = js_set_has_number; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_DELETE_STRING: extern "C" fn(*mut SetHeader, *const StringHeader) -> i32 = js_set_delete_string; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_DELETE_NUMBER: extern "C" fn(*mut SetHeader, f64) -> i32 = js_set_delete_number; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_ADD_I32: extern "C" fn(*mut SetHeader, i32) -> *mut SetHeader = js_set_add_i32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_HAS_I32: extern "C" fn(*const SetHeader, i32) -> i32 = js_set_has_i32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_DELETE_I32: extern "C" fn(*mut SetHeader, i32) -> i32 = js_set_delete_i32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_ADD_U32: extern "C" fn(*mut SetHeader, u32) -> *mut SetHeader = js_set_add_u32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_HAS_U32: extern "C" fn(*const SetHeader, u32) -> i32 = js_set_has_u32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_DELETE_U32: extern "C" fn(*mut SetHeader, u32) -> i32 = js_set_delete_u32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_ADD_F32: extern "C" fn(*mut SetHeader, f32) -> *mut SetHeader = js_set_add_f32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_HAS_F32: extern "C" fn(*const SetHeader, f32) -> i32 = js_set_has_f32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_DELETE_F32: extern "C" fn(*mut SetHeader, f32) -> i32 = js_set_delete_f32; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_ADD_BOOL: extern "C" fn(*mut SetHeader, i32) -> *mut SetHeader = js_set_add_bool; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_HAS_BOOL: extern "C" fn(*const SetHeader, i32) -> i32 = js_set_has_bool; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SET_DELETE_BOOL: extern "C" fn(*mut SetHeader, i32) -> i32 = js_set_delete_bool; /// Clear all elements from the set @@ -1942,7 +1942,7 @@ pub extern "C" fn js_set_value_raw_at(set: *const SetHeader, i: u32) -> f64 { } } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_VALUE_RAW_AT: extern "C" fn(*const SetHeader, u32) -> f64 = js_set_value_raw_at; /// Convert a Set to an Array (for Array.from(set)) @@ -2581,28 +2581,28 @@ pub extern "C" fn js_set_is_disjoint_from(set: *const SetHeader, other: f64) -> // rebuild doesn't dead-strip these codegen-only `#[no_mangle]` entry points // (see project_auto_optimize_keepalive_3320 / PR #3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_UNION: extern "C" fn(*const SetHeader, f64) -> *mut SetHeader = js_set_union; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_INTERSECTION: extern "C" fn(*const SetHeader, f64) -> *mut SetHeader = js_set_intersection; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_DIFFERENCE: extern "C" fn(*const SetHeader, f64) -> *mut SetHeader = js_set_difference; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_SYMDIFF: extern "C" fn(*const SetHeader, f64) -> *mut SetHeader = js_set_symmetric_difference; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_IS_SUBSET: extern "C" fn(*const SetHeader, f64) -> i32 = js_set_is_subset_of; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_IS_SUPERSET: extern "C" fn(*const SetHeader, f64) -> i32 = js_set_is_superset_of; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SET_IS_DISJOINT: extern "C" fn(*const SetHeader, f64) -> i32 = js_set_is_disjoint_from; #[cfg(test)] diff --git a/crates/perry-runtime/src/string/locale.rs b/crates/perry-runtime/src/string/locale.rs index 45fbe12a19..f6dd943128 100644 --- a/crates/perry-runtime/src/string/locale.rs +++ b/crates/perry-runtime/src/string/locale.rs @@ -414,15 +414,15 @@ pub extern "C" fn js_string_validate_collator_args(locales: f64, options: f64) { // only from generated `.o`, so the whole-program auto-optimize bitcode rebuild // would otherwise dead-strip them (see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_LOCALE_LOWER: extern "C" fn(*const StringHeader, f64) -> *mut StringHeader = js_string_to_locale_lower_case; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_LOCALE_UPPER: extern "C" fn(*const StringHeader, f64) -> *mut StringHeader = js_string_to_locale_upper_case; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_VALIDATE_COLLATOR_ARGS: extern "C" fn(f64, f64) = js_string_validate_collator_args; #[cfg(test)] diff --git a/crates/perry-runtime/src/string/pad.rs b/crates/perry-runtime/src/string/pad.rs index 6e7fddbab2..5580c0223d 100644 --- a/crates/perry-runtime/src/string/pad.rs +++ b/crates/perry-runtime/src/string/pad.rs @@ -31,7 +31,7 @@ pub extern "C" fn js_string_pad_fill(value: f64) -> *mut StringHeader { // `.o`, so the whole-program auto-optimize bitcode rebuild would dead-strip it // without an anchor (see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_PAD_FILL: extern "C" fn(f64) -> *mut StringHeader = js_string_pad_fill; /// ToLength coercion (ECMA-262 §7.1.21) for `padStart`/`padEnd`'s target diff --git a/crates/perry-runtime/src/string/raw.rs b/crates/perry-runtime/src/string/raw.rs index f35ffc48f2..d0fe79a8b2 100644 --- a/crates/perry-runtime/src/string/raw.rs +++ b/crates/perry-runtime/src/string/raw.rs @@ -116,5 +116,5 @@ fn throw_raw_type_error() -> ! { /// LLVM rebuild would otherwise dead-strip this `#[no_mangle]` symbol and /// break linking (see PR #3320 / the `#[used]` keepalive pattern). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_STRING_RAW: extern "C" fn(f64, f64) -> *mut StringHeader = js_string_raw; diff --git a/crates/perry-runtime/src/string/slice_ops.rs b/crates/perry-runtime/src/string/slice_ops.rs index 921083a09a..feb740cde8 100644 --- a/crates/perry-runtime/src/string/slice_ops.rs +++ b/crates/perry-runtime/src/string/slice_ops.rs @@ -133,7 +133,7 @@ pub extern "C" fn js_string_substr( // so the whole-program auto-optimize bitcode rebuild would dead-strip it // without an anchor (see project_auto_optimize_keepalive_3320). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_SUBSTR: extern "C" fn(*const StringHeader, f64, f64) -> *mut StringHeader = js_string_substr; @@ -587,7 +587,7 @@ pub extern "C" fn js_string_position_to_index(pos_f64: f64) -> i32 { // generated `.o`, so the auto-optimize whole-program bitcode pass would // otherwise dead-strip it. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_POSITION_TO_INDEX: extern "C" fn(f64) -> i32 = js_string_position_to_index; /// Find the last index of a substring (-1 if not found). diff --git a/crates/perry-runtime/src/string/suffix_cursor.rs b/crates/perry-runtime/src/string/suffix_cursor.rs index 235dd4dfc4..ae9dd96903 100644 --- a/crates/perry-runtime/src/string/suffix_cursor.rs +++ b/crates/perry-runtime/src/string/suffix_cursor.rs @@ -105,12 +105,12 @@ pub unsafe extern "C" fn js_string_suffix_char_code_at( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_LENGTH: unsafe extern "C" fn(f64, *const SuffixCursor) -> f64 = js_string_suffix_length; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ADVANCE: unsafe extern "C" fn(f64, *mut SuffixCursor, i32) = js_string_suffix_advance; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_CHAR_CODE: unsafe extern "C" fn(f64, *const SuffixCursor, i32) -> f64 = js_string_suffix_char_code_at; diff --git a/crates/perry-runtime/src/symbol/constructors.rs b/crates/perry-runtime/src/symbol/constructors.rs index e071523a34..9547753b5c 100644 --- a/crates/perry-runtime/src/symbol/constructors.rs +++ b/crates/perry-runtime/src/symbol/constructors.rs @@ -186,7 +186,7 @@ fn is_well_known_symbol_member_name(name: &str) -> bool { // so LTO / whole-program-bitcode link modes are free to internalize and // dead-strip it. The `#[used]` reference edge keeps the export alive. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SYMBOL_COMPUTED_MEMBER: unsafe extern "C" fn(f64, f64) -> f64 = js_symbol_computed_member; diff --git a/crates/perry-runtime/src/symbol/iterator.rs b/crates/perry-runtime/src/symbol/iterator.rs index 2c732a05d3..a3cd46ba76 100644 --- a/crates/perry-runtime/src/symbol/iterator.rs +++ b/crates/perry-runtime/src/symbol/iterator.rs @@ -183,7 +183,7 @@ pub(crate) fn class_ref_resolves_iterator(val_f64: f64) -> bool { /// unchanged when it is an object. // #1561-style force-keep: only generated IR calls this. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_ITERATOR_RESULT_VALIDATE: extern "C" fn(f64) -> f64 = js_iterator_result_validate; #[no_mangle] diff --git a/crates/perry-runtime/src/text.rs b/crates/perry-runtime/src/text.rs index 78af01adfd..7054ed3c57 100644 --- a/crates/perry-runtime/src/text.rs +++ b/crates/perry-runtime/src/text.rs @@ -620,20 +620,20 @@ fn throw_invalid_encoded_data(encoding: &str) -> ! { /// would dead-strip them without `#[used]` retention (see /// [[project_auto_optimize_keepalive_3320]]). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_TEXT_DECODER_NEW: extern "C" fn(f64, f64, f64) -> i64 = js_text_decoder_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_TEXT_DECODER_DECODE: extern "C" fn(f64, f64) -> i64 = js_text_decoder_decode_llvm; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_TEXT_DECODER_ENCODING: extern "C" fn(f64) -> *mut StringHeader = js_text_decoder_encoding; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_TEXT_DECODER_FATAL: extern "C" fn(f64) -> f64 = js_text_decoder_fatal; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_TEXT_DECODER_IGNORE_BOM: extern "C" fn(f64) -> f64 = js_text_decoder_ignore_bom; /// TextDecoder / TextEncoder registry-handle property surface for VALUE diff --git a/crates/perry-runtime/src/tls.rs b/crates/perry-runtime/src/tls.rs index 6278371ec7..801e391bbd 100644 --- a/crates/perry-runtime/src/tls.rs +++ b/crates/perry-runtime/src/tls.rs @@ -1459,45 +1459,45 @@ pub extern "C" fn js_tls_check_server_identity(hostname: f64, cert: f64) -> f64 // these codegen-emitted `#[no_mangle]` runtime helpers (referenced from the // native dispatch table in perry-codegen). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_GET_CIPHERS: extern "C" fn() -> f64 = js_tls_get_ciphers; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_GET_CERTIFICATE_COMPRESSION_ALGORITHMS: extern "C" fn() -> f64 = js_tls_get_certificate_compression_algorithms; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_PREPARE_CONNECT: extern "C" fn() = js_tls_prepare_connect; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_VALIDATE_CONNECT_OPTIONS: extern "C" fn(f64) = js_tls_validate_connect_options; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_VALIDATE_POSITIONAL_CONNECT_OPTIONS: extern "C" fn(f64) = js_tls_validate_positional_connect_options; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_CLIENT_CHECK_IDENTITY: extern "C" fn(i64, f64) -> f64 = js_tls_client_check_identity; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_CLIENT_CHECK_IDENTITY_FROM_METADATA: unsafe extern "C" fn(i64) -> f64 = js_tls_client_check_identity_from_metadata; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_GET_CA_CERTIFICATES: extern "C" fn(f64) -> f64 = js_tls_get_ca_certificates; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_SET_DEFAULT_CA_CERTIFICATES: extern "C" fn(f64) -> f64 = js_tls_set_default_ca_certificates; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_CREATE_SECURE_CONTEXT: extern "C" fn(f64) -> f64 = js_tls_create_secure_context; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_SECURE_CONTEXT_NEW: extern "C" fn(f64) -> f64 = js_tls_secure_context_new; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TLS_CHECK_SERVER_IDENTITY: extern "C" fn(f64, f64) -> f64 = js_tls_check_server_identity; diff --git a/crates/perry-runtime/src/typed_feedback.rs b/crates/perry-runtime/src/typed_feedback.rs index ef136ddf02..38bc1e4d9f 100644 --- a/crates/perry-runtime/src/typed_feedback.rs +++ b/crates/perry-runtime/src/typed_feedback.rs @@ -1517,7 +1517,7 @@ pub extern "C" fn js_string_array_range_loop_guard( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_STRING_ARRAY_RANGE_LOOP_GUARD: extern "C" fn(f64, i32, i32) -> i32 = js_string_array_range_loop_guard; @@ -2139,7 +2139,7 @@ pub extern "C" fn js_typed_feedback_packed_f64_range_loop_guard( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_FEEDBACK_PACKED_F64_RANGE_LOOP_GUARD: extern "C" fn( u64, f64, @@ -2181,7 +2181,7 @@ pub extern "C" fn js_typed_feedback_packed_i32_array_loop_guard( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_FEEDBACK_PACKED_I32_ARRAY_LOOP_GUARD: extern "C" fn(u64, f64) -> i32 = js_typed_feedback_packed_i32_array_loop_guard; @@ -2219,7 +2219,7 @@ pub extern "C" fn js_typed_feedback_packed_u32_array_loop_guard( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_FEEDBACK_PACKED_U32_ARRAY_LOOP_GUARD: extern "C" fn(u64, f64) -> i32 = js_typed_feedback_packed_u32_array_loop_guard; diff --git a/crates/perry-runtime/src/typed_feedback/guards.rs b/crates/perry-runtime/src/typed_feedback/guards.rs index b165f6659a..b3deed3cc3 100644 --- a/crates/perry-runtime/src/typed_feedback/guards.rs +++ b/crates/perry-runtime/src/typed_feedback/guards.rs @@ -1340,25 +1340,25 @@ pub unsafe extern "C" fn js_object_own_method_cache_miss( mod keep_guard_symbols { use super::*; #[cfg(feature = "keepalive-anchors")] - #[used] static G0: extern "C" fn(u64, f64, u32, u32, *const crate::StringHeader, u32, i32) -> i32 = js_typed_feedback_class_field_get_guard; + #[used(compiler)] static G0: extern "C" fn(u64, f64, u32, u32, *const crate::StringHeader, u32, i32) -> i32 = js_typed_feedback_class_field_get_guard; #[cfg(feature = "keepalive-anchors")] - #[used] static G1: extern "C" fn(u64, f64, u32, u32, *const crate::StringHeader, u32, f64, i32) -> i32 = js_typed_feedback_class_field_set_guard; + #[used(compiler)] static G1: extern "C" fn(u64, f64, u32, u32, *const crate::StringHeader, u32, f64, i32) -> i32 = js_typed_feedback_class_field_set_guard; #[cfg(feature = "keepalive-anchors")] - #[used] static G1C: extern "C" fn(u64, u64, u64, f64) = js_class_field_set_fallback; + #[used(compiler)] static G1C: extern "C" fn(u64, u64, u64, f64) = js_class_field_set_fallback; #[cfg(feature = "keepalive-anchors")] - #[used] static G1D: extern "C" fn(u64, f64, u32, u32, *const crate::StringHeader, u32, f64, i32) = js_class_field_set_ic; + #[used(compiler)] static G1D: extern "C" fn(u64, f64, u32, u32, *const crate::StringHeader, u32, f64, i32) = js_class_field_set_ic; #[cfg(feature = "keepalive-anchors")] - #[used] static G1E: extern "C" fn(u64, f64, u32, u32, *const crate::StringHeader, u32, i32) -> f64 = js_class_field_get_ic; + #[used(compiler)] static G1E: extern "C" fn(u64, f64, u32, u32, *const crate::StringHeader, u32, i32) -> f64 = js_class_field_get_ic; #[cfg(feature = "keepalive-anchors")] - #[used] static G2: unsafe extern "C" fn(u64, f64, u32, u32, *const i8, usize, *const u8) -> i32 = js_typed_feedback_method_direct_call_guard; + #[used(compiler)] static G2: unsafe extern "C" fn(u64, f64, u32, u32, *const i8, usize, *const u8) -> i32 = js_typed_feedback_method_direct_call_guard; #[cfg(feature = "keepalive-anchors")] - #[used] static G3: extern "C" fn(u64, f64, *const u8, u32, u32) -> i32 = js_typed_feedback_closure_direct_call_guard; + #[used(compiler)] static G3: extern "C" fn(u64, f64, *const u8, u32, u32) -> i32 = js_typed_feedback_closure_direct_call_guard; #[cfg(feature = "keepalive-anchors")] - #[used] static G3B: extern "C" fn(f64, *const u8) -> u64 = js_closure_exact_func_guard; + #[used(compiler)] static G3B: extern "C" fn(f64, *const u8) -> u64 = js_closure_exact_func_guard; #[cfg(feature = "keepalive-anchors")] - #[used] static G3C: unsafe extern "C" fn(f64, u32, u32, *const i8, usize, *const u8, *mut MethodPicCacheSlot) -> u64 = js_object_own_method_cache_miss; + #[used(compiler)] static G3C: unsafe extern "C" fn(f64, u32, u32, *const i8, usize, *const u8, *mut MethodPicCacheSlot) -> u64 = js_object_own_method_cache_miss; #[cfg(feature = "keepalive-anchors")] - #[used] static G4: unsafe extern "C" fn(f64, u32, u32, u32) -> i32 = js_method_direct_shape_guard; + #[used(compiler)] static G4: unsafe extern "C" fn(f64, u32, u32, u32) -> i32 = js_method_direct_shape_guard; #[cfg(feature = "keepalive-anchors")] - #[used] static G4B: unsafe extern "C" fn(f64, *mut u32, u32) -> u32 = js_method_direct_shape_class; + #[used(compiler)] static G4B: unsafe extern "C" fn(f64, *mut u32, u32) -> u32 = js_method_direct_shape_class; } diff --git a/crates/perry-runtime/src/typed_feedback/tests.rs b/crates/perry-runtime/src/typed_feedback/tests.rs index 4975aa0193..94d10c9954 100644 --- a/crates/perry-runtime/src/typed_feedback/tests.rs +++ b/crates/perry-runtime/src/typed_feedback/tests.rs @@ -1116,7 +1116,7 @@ fn assert_lto_keepalive_anchor(src: &str, static_name: &str, signature: &str, ta let window = &src[start..end]; assert!( window.contains(r#"#[cfg(feature = "keepalive-anchors")]"#) - && window.contains(r#"#[used]"#), + && (window.contains(r#"#[used]"#) || window.contains(r#"#[used(compiler)]"#)), "keepalive static {static_name} for {target} lacks the keepalive-anchors \ gate and #[used] attribute" ); diff --git a/crates/perry-runtime/src/typed_feedback/trace.rs b/crates/perry-runtime/src/typed_feedback/trace.rs index 370d4a5ee2..c6b5019ce2 100644 --- a/crates/perry-runtime/src/typed_feedback/trace.rs +++ b/crates/perry-runtime/src/typed_feedback/trace.rs @@ -386,67 +386,67 @@ mod keep_typed_feedback { js_typed_feedback_native_call_method_by_id, }; #[cfg(feature = "keepalive-anchors")] -#[used] static K00: extern "C" fn(u64, u32, *const u8, usize, *const u8, usize, *const u8, usize, *const u8, usize, *const u8, usize, *const u8, usize) = js_typed_feedback_register_site; +#[used(compiler)] static K00: extern "C" fn(u64, u32, *const u8, usize, *const u8, usize, *const u8, usize, *const u8, usize, *const u8, usize, *const u8, usize) = js_typed_feedback_register_site; #[cfg(feature = "keepalive-anchors")] -#[used] static K01: extern "C" fn(u64) = js_typed_feedback_record_guard_pass; +#[used(compiler)] static K01: extern "C" fn(u64) = js_typed_feedback_record_guard_pass; #[cfg(feature = "keepalive-anchors")] -#[used] static K02: extern "C" fn(u64) = js_typed_feedback_record_guard_fail; +#[used(compiler)] static K02: extern "C" fn(u64) = js_typed_feedback_record_guard_fail; #[cfg(feature = "keepalive-anchors")] -#[used] static K03: extern "C" fn(u64) = js_typed_feedback_record_fallback_call; +#[used(compiler)] static K03: extern "C" fn(u64) = js_typed_feedback_record_fallback_call; #[cfg(feature = "keepalive-anchors")] -#[used] static K04: extern "C" fn(u64, *const ObjectHeader, *const crate::StringHeader) = js_typed_feedback_observe_property_get; +#[used(compiler)] static K04: extern "C" fn(u64, *const ObjectHeader, *const crate::StringHeader) = js_typed_feedback_observe_property_get; #[cfg(feature = "keepalive-anchors")] -#[used] static K05: extern "C" fn(u64, *mut ObjectHeader, *const crate::StringHeader) = js_typed_feedback_observe_property_set; +#[used(compiler)] static K05: extern "C" fn(u64, *mut ObjectHeader, *const crate::StringHeader) = js_typed_feedback_observe_property_set; #[cfg(feature = "keepalive-anchors")] -#[used] static K06: extern "C" fn(u64, *const ObjectHeader, *const crate::StringHeader) -> f64 = js_typed_feedback_object_get_field_by_name_f64; +#[used(compiler)] static K06: extern "C" fn(u64, *const ObjectHeader, *const crate::StringHeader) -> f64 = js_typed_feedback_object_get_field_by_name_f64; #[cfg(feature = "keepalive-anchors")] -#[used] static K07: extern "C" fn(u64, *mut ObjectHeader, *const crate::StringHeader, f64) = js_typed_feedback_object_set_field_by_name; +#[used(compiler)] static K07: extern "C" fn(u64, *mut ObjectHeader, *const crate::StringHeader, f64) = js_typed_feedback_object_set_field_by_name; #[cfg(feature = "keepalive-anchors")] -#[used] static K08: extern "C" fn(u64, *mut ObjectHeader, *const crate::StringHeader, f64) = js_typed_feedback_object_set_field_by_name_fast; +#[used(compiler)] static K08: extern "C" fn(u64, *mut ObjectHeader, *const crate::StringHeader, f64) = js_typed_feedback_object_set_field_by_name_fast; #[cfg(feature = "keepalive-anchors")] -#[used] static K09: unsafe extern "C-unwind" fn(u64, f64, *const i8, usize, *const f64, usize) -> f64 = js_typed_feedback_native_call_method; +#[used(compiler)] static K09: unsafe extern "C-unwind" fn(u64, f64, *const i8, usize, *const f64, usize) -> f64 = js_typed_feedback_native_call_method; #[cfg(feature = "keepalive-anchors")] -#[used] static K10: unsafe extern "C-unwind" fn(u64, f64, *const i8, usize, i64) -> f64 = js_typed_feedback_native_call_method_apply; +#[used(compiler)] static K10: unsafe extern "C-unwind" fn(u64, f64, *const i8, usize, i64) -> f64 = js_typed_feedback_native_call_method_apply; #[cfg(feature = "keepalive-anchors")] -#[used] static K11: extern "C" fn(u64, *const ArrayHeader, u32) -> f64 = js_typed_feedback_array_get_f64; +#[used(compiler)] static K11: extern "C" fn(u64, *const ArrayHeader, u32) -> f64 = js_typed_feedback_array_get_f64; #[cfg(feature = "keepalive-anchors")] -#[used] static K12: extern "C" fn(u64, f64, i32, i32) -> i32 = js_typed_feedback_plain_array_index_get_guard; +#[used(compiler)] static K12: extern "C" fn(u64, f64, i32, i32) -> i32 = js_typed_feedback_plain_array_index_get_guard; #[cfg(feature = "keepalive-anchors")] -#[used] static K13: extern "C" fn(u64, f64, i32, i32) -> i32 = js_typed_feedback_numeric_array_index_get_guard; +#[used(compiler)] static K13: extern "C" fn(u64, f64, i32, i32) -> i32 = js_typed_feedback_numeric_array_index_get_guard; #[cfg(feature = "keepalive-anchors")] -#[used] static K14: extern "C" fn(u64, f64) -> i32 = js_typed_feedback_packed_f64_array_loop_guard; +#[used(compiler)] static K14: extern "C" fn(u64, f64) -> i32 = js_typed_feedback_packed_f64_array_loop_guard; #[cfg(feature = "keepalive-anchors")] -#[used] static K15: extern "C" fn(u64, f64) -> i32 = js_typed_feedback_packed_u32_array_loop_guard; +#[used(compiler)] static K15: extern "C" fn(u64, f64) -> i32 = js_typed_feedback_packed_u32_array_loop_guard; #[cfg(feature = "keepalive-anchors")] -#[used] static K16: extern "C" fn(u64, f64, f64) -> f64 = js_typed_feedback_array_index_get_fallback_boxed; +#[used(compiler)] static K16: extern "C" fn(u64, f64, f64) -> f64 = js_typed_feedback_array_index_get_fallback_boxed; #[cfg(feature = "keepalive-anchors")] -#[used] static K17: extern "C" fn(u64, *mut ArrayHeader, u32, f64) = js_typed_feedback_array_set_f64; +#[used(compiler)] static K17: extern "C" fn(u64, *mut ArrayHeader, u32, f64) = js_typed_feedback_array_set_f64; #[cfg(feature = "keepalive-anchors")] -#[used] static K18: extern "C" fn(u64, *mut ArrayHeader, u32, f64) -> *mut ArrayHeader = js_typed_feedback_array_set_f64_extend; +#[used(compiler)] static K18: extern "C" fn(u64, *mut ArrayHeader, u32, f64) -> *mut ArrayHeader = js_typed_feedback_array_set_f64_extend; #[cfg(feature = "keepalive-anchors")] -#[used] static K19: extern "C" fn(u64, f64, i32, f64, i32) -> i32 = js_typed_feedback_plain_array_index_set_guard; +#[used(compiler)] static K19: extern "C" fn(u64, f64, i32, f64, i32) -> i32 = js_typed_feedback_plain_array_index_set_guard; #[cfg(feature = "keepalive-anchors")] -#[used] static K20: extern "C" fn(u64, f64, i32, f64, i32) -> i32 = js_typed_feedback_numeric_array_index_set_guard; +#[used(compiler)] static K20: extern "C" fn(u64, f64, i32, f64, i32) -> i32 = js_typed_feedback_numeric_array_index_set_guard; #[cfg(feature = "keepalive-anchors")] -#[used] static K21: extern "C" fn(u64, f64, f64) -> i32 = js_typed_feedback_numeric_array_push_guard; +#[used(compiler)] static K21: extern "C" fn(u64, f64, f64) -> i32 = js_typed_feedback_numeric_array_push_guard; #[cfg(feature = "keepalive-anchors")] -#[used] static K22: extern "C" fn(u64, f64, f64, f64, i32) -> f64 = js_typed_feedback_array_index_set_fallback_boxed; +#[used(compiler)] static K22: extern "C" fn(u64, f64, f64, f64, i32) -> f64 = js_typed_feedback_array_index_set_fallback_boxed; #[cfg(feature = "keepalive-anchors")] -#[used] static K23: extern "C" fn(u64, *const ArrayHeader, u32) = js_typed_feedback_observe_array_element; +#[used(compiler)] static K23: extern "C" fn(u64, *const ArrayHeader, u32) = js_typed_feedback_observe_array_element; #[cfg(feature = "keepalive-anchors")] -#[used] static K24: extern "C" fn(u64, *mut ArrayHeader, *const crate::StringHeader, f64) -> *mut ArrayHeader = js_typed_feedback_array_set_string_key; +#[used(compiler)] static K24: extern "C" fn(u64, *mut ArrayHeader, *const crate::StringHeader, f64) -> *mut ArrayHeader = js_typed_feedback_array_set_string_key; #[cfg(feature = "keepalive-anchors")] -#[used] static K25: extern "C" fn(u64, *mut ArrayHeader, f64, f64, i32) -> *mut ArrayHeader = js_typed_feedback_array_set_index_or_string; +#[used(compiler)] static K25: extern "C" fn(u64, *mut ArrayHeader, f64, f64, i32) -> *mut ArrayHeader = js_typed_feedback_array_set_index_or_string; #[cfg(feature = "keepalive-anchors")] -#[used] static K26: extern "C" fn(u64, i64, f64, f64) = js_typed_feedback_object_set_index_polymorphic; +#[used(compiler)] static K26: extern "C" fn(u64, i64, f64, f64) = js_typed_feedback_object_set_index_polymorphic; #[cfg(feature = "keepalive-anchors")] -#[used] static K27: extern "C" fn(u64, *mut ObjectHeader, u32, *const crate::StringHeader, f64) = js_typed_feedback_object_set_unboxed_f64_field; +#[used(compiler)] static K27: extern "C" fn(u64, *mut ObjectHeader, u32, *const crate::StringHeader, f64) = js_typed_feedback_object_set_unboxed_f64_field; #[cfg(feature = "keepalive-anchors")] -#[used] static K28: extern "C" fn(u64, f64) -> f64 = js_typed_feedback_observe_helper_return; +#[used(compiler)] static K28: extern "C" fn(u64, f64) -> f64 = js_typed_feedback_observe_helper_return; #[cfg(feature = "keepalive-anchors")] -#[used] static K29: extern "C" fn() = js_typed_feedback_maybe_dump_trace; +#[used(compiler)] static K29: extern "C" fn() = js_typed_feedback_maybe_dump_trace; #[cfg(feature = "keepalive-anchors")] -#[used] static K30: unsafe extern "C-unwind" fn(u64, f64, i64, *const f64, usize) -> f64 = js_typed_feedback_native_call_method_by_id; +#[used(compiler)] static K30: unsafe extern "C-unwind" fn(u64, f64, i64, *const f64, usize) -> f64 = js_typed_feedback_native_call_method_by_id; #[cfg(feature = "keepalive-anchors")] -#[used] static K31: unsafe extern "C-unwind" fn(u64, f64, i64, i64) -> f64 = js_typed_feedback_native_call_method_apply_by_id; +#[used(compiler)] static K31: unsafe extern "C-unwind" fn(u64, f64, i64, i64) -> f64 = js_typed_feedback_native_call_method_apply_by_id; } diff --git a/crates/perry-runtime/src/typedarray/access.rs b/crates/perry-runtime/src/typedarray/access.rs index 9dd609919d..c0d973ade4 100644 --- a/crates/perry-runtime/src/typedarray/access.rs +++ b/crates/perry-runtime/src/typedarray/access.rs @@ -172,7 +172,7 @@ pub extern "C" fn js_typed_array_read_int32(ta: *const TypedArrayHeader, index: // otherwise free to internalize and dead-strip it (it has no internal Rust // caller). The `#[used]` anchor pins it, mirroring the getter above. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_ARRAY_READ_INT32: extern "C" fn(*const TypedArrayHeader, i32) -> i32 = js_typed_array_read_int32; @@ -224,7 +224,7 @@ pub extern "C" fn js_typed_array_read_f64(ta: *const TypedArrayHeader, index: i3 // Codegen-only export (see the i32 sibling above): pin under whole-program LTO. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_ARRAY_READ_F64: extern "C" fn(*const TypedArrayHeader, i32) -> f64 = js_typed_array_read_f64; @@ -248,7 +248,7 @@ pub extern "C" fn js_u8_buffer_read_f64(target: *const TypedArrayHeader, index: // Codegen-only export: pin under whole-program LTO (mirrors the siblings). #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_U8_BUFFER_READ_F64: extern "C" fn(*const TypedArrayHeader, i32) -> f64 = js_u8_buffer_read_f64; @@ -279,7 +279,7 @@ pub extern "C" fn js_typed_array_index_get_dynamic(ta: *const TypedArrayHeader, // `perry-codegen/src/expr/index_get.rs`), so a whole-program bitcode link is // free to internalize and dead-strip it. The `#[used]` anchor pins it. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_ARRAY_INDEX_GET_DYNAMIC: extern "C" fn(*const TypedArrayHeader, f64) -> f64 = js_typed_array_index_get_dynamic; @@ -723,7 +723,7 @@ pub extern "C" fn js_uint8array_index_get_value( // auto-optimize — it has zero internal Rust callers (codegen emits the only // call), so a whole-program bitcode link is otherwise free to dead-strip it. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_UINT8ARRAY_INDEX_GET_VALUE: extern "C" fn(*const TypedArrayHeader, i32) -> f64 = js_uint8array_index_get_value; diff --git a/crates/perry-runtime/src/typedarray_props.rs b/crates/perry-runtime/src/typedarray_props.rs index a399e72322..45d9638740 100644 --- a/crates/perry-runtime/src/typedarray_props.rs +++ b/crates/perry-runtime/src/typedarray_props.rs @@ -935,7 +935,7 @@ pub extern "C" fn js_typed_array_index_set_dynamic( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_TYPED_ARRAY_INDEX_SET_DYNAMIC: extern "C" fn( *mut TypedArrayHeader, f64, diff --git a/crates/perry-runtime/src/url/abort.rs b/crates/perry-runtime/src/url/abort.rs index d69e7355d5..b02e628603 100644 --- a/crates/perry-runtime/src/url/abort.rs +++ b/crates/perry-runtime/src/url/abort.rs @@ -681,14 +681,14 @@ pub extern "C" fn js_abort_signal_any( // entry points (see project_auto_optimize_keepalive_3320). These are only // referenced from generated `.o`, so without `#[used]` they vanish. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ABORT_SIGNAL_ABORT: extern "C" fn(f64) -> *mut ObjectHeader = js_abort_signal_abort; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ABORT_SIGNAL_ANY: extern "C" fn(*mut crate::array::ArrayHeader) -> *mut ObjectHeader = js_abort_signal_any; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_ABORT_SIGNAL_THROW_IF_ABORTED: extern "C" fn(*mut ObjectHeader) -> f64 = js_abort_signal_throw_if_aborted; diff --git a/crates/perry-runtime/src/url/search_params.rs b/crates/perry-runtime/src/url/search_params.rs index d43d066cad..e20ea3e191 100644 --- a/crates/perry-runtime/src/url/search_params.rs +++ b/crates/perry-runtime/src/url/search_params.rs @@ -152,7 +152,7 @@ pub extern "C" fn js_url_search_params_subclass_init(this: f64, init: f64) -> f6 /// Reached only from codegen-emitted IR (the `Expr::SuperCall` URLSearchParams /// arm); pin it so the auto-optimize bitcode rebuild's dead-strip can't drop it. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_URL_SEARCH_PARAMS_SUBCLASS_INIT: extern "C" fn(f64, f64) -> f64 = js_url_search_params_subclass_init; diff --git a/crates/perry-runtime/src/validators.rs b/crates/perry-runtime/src/validators.rs index b4f3ccb698..fbaa8e31d7 100644 --- a/crates/perry-runtime/src/validators.rs +++ b/crates/perry-runtime/src/validators.rs @@ -424,14 +424,14 @@ pub unsafe extern "C" fn js_runtime_validate_integer_arg( } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_VALIDATE_STRING_ARG: unsafe extern "C" fn(f64, *const u8, u32) = js_runtime_validate_string_arg; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_VALIDATE_CRYPTO_KEY_ARG: unsafe extern "C" fn(f64, *const u8, u32) = js_runtime_validate_crypto_key_arg; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_VALIDATE_INTEGER_ARG: unsafe extern "C" fn(f64, *const u8, u32, f64, f64) = js_runtime_validate_integer_arg; diff --git a/crates/perry-runtime/src/value/dyn_index.rs b/crates/perry-runtime/src/value/dyn_index.rs index 14cfda78b6..1d7a6d69e3 100644 --- a/crates/perry-runtime/src/value/dyn_index.rs +++ b/crates/perry-runtime/src/value/dyn_index.rs @@ -856,17 +856,17 @@ pub extern "C" fn js_is_undefined_or_bare_nan(value: f64) -> i32 { // the anchors compile out there. Function-pointer types are `Sync`, so no // wrapper is needed. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_DYN_INDEX_GET: extern "C" fn(f64, f64) -> f64 = js_dyn_index_get; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_DYN_INDEX_SET: extern "C" fn(f64, f64, f64) -> f64 = js_dyn_index_set; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_DYN_INDEX_SET_STRICT: extern "C" fn(f64, f64, f64, i32) -> f64 = js_dyn_index_set_strict; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_IS_UNDEFINED_OR_BARE_NAN: extern "C" fn(f64) -> i32 = js_is_undefined_or_bare_nan; #[cfg(test)] diff --git a/crates/perry-runtime/src/value/dynamic_arith.rs b/crates/perry-runtime/src/value/dynamic_arith.rs index 3a639a5a08..7fe94c4829 100644 --- a/crates/perry-runtime/src/value/dynamic_arith.rs +++ b/crates/perry-runtime/src/value/dynamic_arith.rs @@ -974,19 +974,19 @@ pub unsafe extern "C" fn js_dynamic_ushr(a: f64, b: f64) -> f64 { } #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_DYNAMIC_POW: unsafe extern "C" fn(f64, f64) -> f64 = js_dynamic_pow; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_DYNAMIC_USHR: unsafe extern "C" fn(f64, f64) -> f64 = js_dynamic_ushr; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_DYNAMIC_BITNOT: unsafe extern "C" fn(f64) -> f64 = js_dynamic_bitnot; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_TO_NUMERIC: unsafe extern "C" fn(f64) -> f64 = js_to_numeric; #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_NUMERIC_STEP: unsafe extern "C" fn(f64, i32) -> f64 = js_numeric_step; #[cfg(test)] diff --git a/crates/perry-runtime/src/value/nanbox.rs b/crates/perry-runtime/src/value/nanbox.rs index e9cdd95451..3b9c0761ba 100644 --- a/crates/perry-runtime/src/value/nanbox.rs +++ b/crates/perry-runtime/src/value/nanbox.rs @@ -376,7 +376,7 @@ pub extern "C" fn js_switch_strict_equals(a: f64, b: f64) -> i32 { // #1561-style force-keep: only generated IR calls this — see // value/dyn_index.rs for the rationale. #[cfg(feature = "keepalive-anchors")] -#[used] +#[used(compiler)] static KEEP_JS_SWITCH_STRICT_EQUALS: extern "C" fn(f64, f64) -> i32 = js_switch_strict_equals; /// Check if a NaN-boxed f64 value represents a string. diff --git a/crates/perry-runtime/src/yoga.rs b/crates/perry-runtime/src/yoga.rs index 29c76446ed..3efc4c3d68 100644 --- a/crates/perry-runtime/src/yoga.rs +++ b/crates/perry-runtime/src/yoga.rs @@ -729,7 +729,7 @@ pub extern "C" fn js_yoga_get_computed_edge(id: f64, kind: f64, edge: f64) -> f6 macro_rules! keep { ($n:ident : $t:ty = $f:ident) => { #[cfg(feature = "keepalive-anchors")] - #[used] + #[used(compiler)] static $n: $t = $f; }; } diff --git a/crates/perry-stdlib/src/events/constructors.rs b/crates/perry-stdlib/src/events/constructors.rs index f95362821b..067051d0b9 100644 --- a/crates/perry-stdlib/src/events/constructors.rs +++ b/crates/perry-stdlib/src/events/constructors.rs @@ -153,23 +153,23 @@ pub(crate) fn event_emitter_async_resource_handle(handle: Handle) -> i64 { // link fails with `Undefined symbols: _js_event_emitter_new_with_options` // (see project_auto_optimize_keepalive_3320). Anchoring constructor shapes // keeps `new EventEmitter()` and `new EventEmitterAsyncResource()` compiling. -#[used] +#[used(compiler)] static KEEP_JS_EVENT_EMITTER_NEW: extern "C" fn() -> Handle = js_event_emitter_new; -#[used] +#[used(compiler)] static KEEP_JS_EVENT_EMITTER_NEW_WITH_OPTIONS: unsafe extern "C" fn(f64) -> Handle = js_event_emitter_new_with_options; -#[used] +#[used(compiler)] static KEEP_JS_EVENT_EMITTER_ASYNC_RESOURCE_NEW: unsafe extern "C" fn(f64) -> Handle = js_event_emitter_async_resource_new; -#[used] +#[used(compiler)] static KEEP_JS_EVENT_EMITTER_ASYNC_RESOURCE_ASYNC_ID: unsafe extern "C" fn(Handle) -> f64 = js_event_emitter_async_resource_async_id; -#[used] +#[used(compiler)] static KEEP_JS_EVENT_EMITTER_ASYNC_RESOURCE_TRIGGER_ASYNC_ID: unsafe extern "C" fn(Handle) -> f64 = js_event_emitter_async_resource_trigger_async_id; -#[used] +#[used(compiler)] static KEEP_JS_EVENT_EMITTER_ASYNC_RESOURCE_ASYNC_RESOURCE: unsafe extern "C" fn(Handle) -> f64 = js_event_emitter_async_resource_async_resource; -#[used] +#[used(compiler)] static KEEP_JS_EVENT_EMITTER_ASYNC_RESOURCE_EMIT_DESTROY: unsafe extern "C" fn(Handle) -> f64 = js_event_emitter_async_resource_emit_destroy; diff --git a/crates/perry-stdlib/src/lib.rs b/crates/perry-stdlib/src/lib.rs index b1288698b2..a928b637a9 100644 --- a/crates/perry-stdlib/src/lib.rs +++ b/crates/perry-stdlib/src/lib.rs @@ -12,6 +12,7 @@ //! - `compression` - zlib compression //! - `full` - Everything (default) +#![feature(used_with_arg)] // anchors are #[used(compiler)]: retained by rustc, not ld64 dead-strip roots // Re-export the updater crate so its #[no_mangle] FFI symbols are // retained in libperry_stdlib.a (Cargo would otherwise drop unused // rlib deps during the staticlib bundle step). diff --git a/crates/perry-stdlib/src/sqlite/better.rs b/crates/perry-stdlib/src/sqlite/better.rs index 421142cf76..6680e3a711 100644 --- a/crates/perry-stdlib/src/sqlite/better.rs +++ b/crates/perry-stdlib/src/sqlite/better.rs @@ -633,30 +633,30 @@ pub unsafe extern "C" fn js_sqlite_stmt_columns(stmt_handle: Handle) -> *mut Arr /// Without these, a `node:sqlite` program compiled under DEFAULT /// auto-optimize fails to link (`Undefined symbols: _js_sqlite_*`). /// See project_auto_optimize_keepalive_3320. -#[used] +#[used(compiler)] pub(crate) static KEEP_SQLITE_OPEN: unsafe extern "C" fn(*const StringHeader) -> Handle = js_sqlite_open; -#[used] +#[used(compiler)] pub(crate) static KEEP_SQLITE_EXEC: unsafe extern "C" fn(Handle, *const StringHeader) -> i32 = js_sqlite_exec; -#[used] +#[used(compiler)] pub(crate) static KEEP_SQLITE_PREPARE: unsafe extern "C" fn(Handle, *const StringHeader) -> Handle = js_sqlite_prepare; -#[used] +#[used(compiler)] pub(crate) static KEEP_SQLITE_STMT_RUN: unsafe extern "C" fn( Handle, *const ArrayHeader, ) -> *mut ObjectHeader = js_sqlite_stmt_run; -#[used] +#[used(compiler)] pub(crate) static KEEP_SQLITE_STMT_GET: unsafe extern "C" fn(Handle, *const ArrayHeader) -> f64 = js_sqlite_stmt_get; -#[used] +#[used(compiler)] pub(crate) static KEEP_SQLITE_STMT_ALL: unsafe extern "C" fn( Handle, *const ArrayHeader, ) -> *mut ArrayHeader = js_sqlite_stmt_all; -#[used] +#[used(compiler)] pub(crate) static KEEP_SQLITE_CLOSE: unsafe extern "C" fn(Handle) -> i32 = js_sqlite_close; -#[used] +#[used(compiler)] pub(crate) static KEEP_SQLITE_STMT_COLUMNS: unsafe extern "C" fn(Handle) -> *mut ArrayHeader = js_sqlite_stmt_columns; diff --git a/crates/perry-stdlib/src/tls.rs b/crates/perry-stdlib/src/tls.rs index 5361d60715..4aebd0c960 100644 --- a/crates/perry-stdlib/src/tls.rs +++ b/crates/perry-stdlib/src/tls.rs @@ -1852,7 +1852,7 @@ struct KeepTlsFfi( // SAFETY: the pointers are retained for linking only and are never read or // dereferenced, so sharing the static anchor between threads is sound. unsafe impl Sync for KeepTlsFfi {} -#[used] +#[used(compiler)] static KEEP_TLS_FFI: KeepTlsFfi<23> = KeepTlsFfi([ js_tls_create_server as *const (), js_tls_tlssocket_constructor as *const (), diff --git a/crates/perry-stdlib/src/worker_threads.rs b/crates/perry-stdlib/src/worker_threads.rs index d67fff9036..0a2285c9eb 100644 --- a/crates/perry-stdlib/src/worker_threads.rs +++ b/crates/perry-stdlib/src/worker_threads.rs @@ -1574,38 +1574,38 @@ fn scan_parent_port_event_roots_mut(visitor: &mut perry_runtime::gc::RuntimeRoot // `.o`. The auto-optimize whole-program-LLVM rebuild internalizes + dead-strips // unreferenced `#[no_mangle]` symbols, so anchor them here. See // [[project_auto_optimize_keepalive_3320]]. -#[used] +#[used(compiler)] static KEEP_WT_MESSAGE_CHANNEL_NEW: extern "C" fn() -> f64 = js_worker_threads_message_channel_new; -#[used] +#[used(compiler)] static KEEP_WT_BROADCAST_NEW: extern "C" fn(f64) -> f64 = js_worker_threads_broadcast_channel_new; -#[used] +#[used(compiler)] static KEEP_WT_RECEIVE_MESSAGE_ON_PORT: extern "C" fn(f64) -> f64 = js_worker_threads_receive_message_on_port; -#[used] +#[used(compiler)] static KEEP_WT_MARK_AS_UNCLONEABLE: extern "C" fn(f64) -> f64 = js_worker_threads_mark_as_uncloneable; -#[used] +#[used(compiler)] static KEEP_WT_WORKER_NEW: extern "C" fn(i64, f64) -> f64 = js_worker_threads_worker_new; -#[used] +#[used(compiler)] static KEEP_WT_WORKER_POST_MESSAGE: extern "C" fn(i64, f64) -> f64 = js_worker_threads_worker_post_message; -#[used] +#[used(compiler)] static KEEP_WT_WORKER_ON: extern "C" fn(i64, f64, i64) -> f64 = js_worker_threads_worker_on; -#[used] +#[used(compiler)] static KEEP_WT_WORKER_ONCE: extern "C" fn(i64, f64, i64) -> f64 = js_worker_threads_worker_once; -#[used] +#[used(compiler)] static KEEP_WT_WORKER_OFF: extern "C" fn(i64, f64, i64) -> f64 = js_worker_threads_worker_off; -#[used] +#[used(compiler)] static KEEP_WT_WORKER_ADD_EVENT_LISTENER: extern "C" fn(i64, f64, i64) -> f64 = worker_surface::js_worker_threads_worker_add_event_listener; -#[used] +#[used(compiler)] static KEEP_WT_WORKER_REMOVE_EVENT_LISTENER: extern "C" fn(i64, f64, i64) -> f64 = worker_surface::js_worker_threads_worker_remove_event_listener; -#[used] +#[used(compiler)] static KEEP_WT_WORKER_TERMINATE: extern "C" fn(i64) -> f64 = js_worker_threads_worker_terminate; -#[used] +#[used(compiler)] static KEEP_WT_WORKER_RELOAD: extern "C" fn(i64) -> f64 = js_worker_threads_worker_reload; -#[used] +#[used(compiler)] static KEEP_WT_WORKER_REF: extern "C" fn(i64) -> f64 = js_worker_threads_worker_ref; -#[used] +#[used(compiler)] static KEEP_WT_WORKER_UNREF: extern "C" fn(i64) -> f64 = js_worker_threads_worker_unref; diff --git a/crates/perry-stdlib/src/worker_threads/direct_message.rs b/crates/perry-stdlib/src/worker_threads/direct_message.rs index c28a00ebc1..3491935f27 100644 --- a/crates/perry-stdlib/src/worker_threads/direct_message.rs +++ b/crates/perry-stdlib/src/worker_threads/direct_message.rs @@ -85,7 +85,7 @@ pub extern "C" fn js_worker_threads_post_message_to_thread( perry_runtime::value::js_nanbox_pointer(promise as i64) } -#[used] +#[used(compiler)] static KEEP_WT_POST_MESSAGE_TO_THREAD: extern "C" fn(f64, f64, f64, f64) -> f64 = js_worker_threads_post_message_to_thread; diff --git a/crates/perry-stdlib/src/zlib.rs b/crates/perry-stdlib/src/zlib.rs index 1035e04c47..e35b1991c0 100644 --- a/crates/perry-stdlib/src/zlib.rs +++ b/crates/perry-stdlib/src/zlib.rs @@ -220,7 +220,7 @@ struct KeepZlibFfi( // SAFETY: a link-time keepalive anchor only — the pointers are never read or // dereferenced, so cross-thread sharing of the raw pointers is sound. unsafe impl Sync for KeepZlibFfi {} -#[used] +#[used(compiler)] static KEEP_ZLIB_FFI: KeepZlibFfi<21> = KeepZlibFfi([ js_zlib_create_deflate as *const (), js_zlib_create_deflate_raw as *const (), @@ -245,7 +245,7 @@ static KEEP_ZLIB_FFI: KeepZlibFfi<21> = KeepZlibFfi([ js_zlib_unzip_sync as *const (), ]); #[cfg(feature = "compression-brotli")] -#[used] +#[used(compiler)] static KEEP_ZLIB_BROTLI_FFI: KeepZlibFfi<6> = KeepZlibFfi([ js_zlib_brotli_compress as *const (), js_zlib_brotli_compress_sync as *const (), @@ -255,7 +255,7 @@ static KEEP_ZLIB_BROTLI_FFI: KeepZlibFfi<6> = KeepZlibFfi([ js_zlib_create_brotli_decompress as *const (), ]); #[cfg(feature = "compression-zstd")] -#[used] +#[used(compiler)] static KEEP_ZLIB_ZSTD_FFI: KeepZlibFfi<6> = KeepZlibFfi([ js_zlib_create_zstd_compress as *const (), js_zlib_create_zstd_decompress as *const (), From 744cbfafb1f7b613d9a496c96bfbabdee546b700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Thu, 17 Sep 2026 06:49:38 +0200 Subject: [PATCH 2/4] docs(changelog): fragment for #10382 --- .../10382-used-compiler-keepalive-anchors.md | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 changelog.d/10382-used-compiler-keepalive-anchors.md diff --git a/changelog.d/10382-used-compiler-keepalive-anchors.md b/changelog.d/10382-used-compiler-keepalive-anchors.md new file mode 100644 index 0000000000..15d06109bf --- /dev/null +++ b/changelog.d/10382-used-compiler-keepalive-anchors.md @@ -0,0 +1,33 @@ +The ~490 runtime keepalive anchors are declared `#[used(compiler)]` instead of +plain `#[used]`, so they stop acting as unconditional linker roots. + +`#[used]` sets `N_NO_DEAD_STRIP` on Mach-O and `SHF_GNU_RETAIN` on ELF, making +every anchor a `-dead_strip` root. `Cargo.toml` and `optimized_libs/freshness.rs` +argued the cost was bounded, because a linker only pulls in the archive members +that resolve an undefined reference — but `[profile.release]` sets +`codegen-units = 1`, so `perry-runtime` is a single 17.4 MB object. Pulling in +any runtime symbol pulls in all 504 `KEEP_*` statics, and each roots whatever it +points at. Measured with `ld64 -why_live`, a `console.log("yeah")` program +retained `fs`, `child_process`, `dgram`, `tls`, `node_vm`, `bun_ffi`, yoga and +taffy. + +`#[used(compiler)]` keeps the static through rustc and LLVM — the reason the +anchors exist, per #6917's revert — while leaving it strippable by the linker, +so the program's own undefined references decide what survives. + +Binary sizes fall 13–15% for ordinary programs, 7.3% for ext-routed ones, and +21.7% for `rich.ts` on the auto-optimize shipping path (9.86 MB to 7.72 MB). The +`perry` compiler binary itself drops from 100 MB to 87 MB, since it links the +runtime too. + +The archive stays complete: `libperry_runtime.a` exports the same 5611 +externally-defined symbols, all 504 `KEEP_*` statics are still present in the +object, and `[no dead strip]` roots fall from 553 to 2. + +Four anchors stay plain `#[used]` on purpose — `PERRY_RUNTIME_BUILD_STAMP_EMBEDDED`, +mimalloc's `__DATA,__mod_init_func` entry, OHOS's `.init_array` entry, and +`perry-ext-http`'s `FORCE_LINK_HTTP_SERVER` (#1652), which is intentional linker +retention. + +Requires `#![feature(used_with_arg)]` in `perry-runtime` and `perry-stdlib`; both +already require the pinned nightly. From eacdc902b3cf01bfe1545560ee8ce528712f93a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Thu, 17 Sep 2026 06:52:20 +0200 Subject: [PATCH 3/4] style: move the used_with_arg rationale above the attribute The trailing comment on `#![feature(used_with_arg)]` is long enough that rustfmt re-indents the following comment block to align after it, so `cargo fmt --check` fails. Same text, placed above the attribute. --- crates/perry-runtime/src/lib.rs | 3 ++- crates/perry-stdlib/src/lib.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/perry-runtime/src/lib.rs b/crates/perry-runtime/src/lib.rs index 838d2fb185..79d57a7807 100644 --- a/crates/perry-runtime/src/lib.rs +++ b/crates/perry-runtime/src/lib.rs @@ -9,7 +9,8 @@ //! - Console and other global functions #![recursion_limit = "256"] -#![feature(used_with_arg)] // anchors are #[used(compiler)]: retained by rustc, not ld64 dead-strip roots +// Anchors are `#[used(compiler)]`: retained by rustc, not ld64 dead-strip roots. +#![feature(used_with_arg)] /// Issue #62: route every Rust heap allocation through mimalloc instead of /// the system `malloc`. `gc_malloc`, arena block allocation, Vec/HashMap diff --git a/crates/perry-stdlib/src/lib.rs b/crates/perry-stdlib/src/lib.rs index a928b637a9..1c9346d525 100644 --- a/crates/perry-stdlib/src/lib.rs +++ b/crates/perry-stdlib/src/lib.rs @@ -12,7 +12,8 @@ //! - `compression` - zlib compression //! - `full` - Everything (default) -#![feature(used_with_arg)] // anchors are #[used(compiler)]: retained by rustc, not ld64 dead-strip roots +// Anchors are `#[used(compiler)]`: retained by rustc, not ld64 dead-strip roots. +#![feature(used_with_arg)] // Re-export the updater crate so its #[no_mangle] FFI symbols are // retained in libperry_stdlib.a (Cargo would otherwise drop unused // rlib deps during the staticlib bundle step). From 1471c223025fe5b2c6c5277f198a1cc268f0dd18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Thu, 17 Sep 2026 06:52:30 +0200 Subject: [PATCH 4/4] chore: release merge train 209 as v0.5.1587 --- CLAUDE.md | 2 +- Cargo.lock | 162 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 3 files changed, 83 insertions(+), 83 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index a87a61fe03..3e85cca7b9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,7 +8,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co Perry is a native TypeScript compiler written in Rust that compiles TypeScript source code directly to native executables. It uses SWC for TypeScript parsing and LLVM for code generation. -**Current Version:** 0.5.1586 +**Current Version:** 0.5.1587 ## TypeScript Parity Status diff --git a/Cargo.lock b/Cargo.lock index 291201d85d..2bf30b37a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5623,7 +5623,7 @@ checksum = "fc61f41aef38c94e922057977bcb33bf185ab42242188719991ecfdc0fa1fe6b" [[package]] name = "perry" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "base64 0.22.1", @@ -5687,7 +5687,7 @@ dependencies = [ [[package]] name = "perry-api-manifest" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-dispatch", "serde", @@ -5695,7 +5695,7 @@ dependencies = [ [[package]] name = "perry-audio-miniaudio" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "cc", "libc", @@ -5704,7 +5704,7 @@ dependencies = [ [[package]] name = "perry-codegen" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "aho-corasick", "anyhow", @@ -5721,7 +5721,7 @@ dependencies = [ [[package]] name = "perry-codegen-arkts" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "perry-hir", @@ -5729,7 +5729,7 @@ dependencies = [ [[package]] name = "perry-codegen-glance" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "perry-hir", @@ -5737,7 +5737,7 @@ dependencies = [ [[package]] name = "perry-codegen-js" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "perry-dispatch", @@ -5746,7 +5746,7 @@ dependencies = [ [[package]] name = "perry-codegen-swiftui" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "perry-hir", @@ -5754,7 +5754,7 @@ dependencies = [ [[package]] name = "perry-codegen-wasm" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "base64 0.22.1", @@ -5766,7 +5766,7 @@ dependencies = [ [[package]] name = "perry-codegen-wear-tiles" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "perry-hir", @@ -5774,7 +5774,7 @@ dependencies = [ [[package]] name = "perry-container-compose" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "async-trait", "clap", @@ -5798,14 +5798,14 @@ dependencies = [ [[package]] name = "perry-container-e2e" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", ] [[package]] name = "perry-diagnostics" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "serde", "serde_json", @@ -5813,7 +5813,7 @@ dependencies = [ [[package]] name = "perry-dispatch" -version = "0.5.1586" +version = "0.5.1587" [[package]] name = "perry-doc-fixture-my-bindings" @@ -5824,7 +5824,7 @@ dependencies = [ [[package]] name = "perry-doc-tests" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "clap", @@ -5839,7 +5839,7 @@ dependencies = [ [[package]] name = "perry-ext-ads" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "block2", "objc2", @@ -5849,7 +5849,7 @@ dependencies = [ [[package]] name = "perry-ext-argon2" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "argon2", "perry-ffi", @@ -5858,7 +5858,7 @@ dependencies = [ [[package]] name = "perry-ext-axios" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "reqwest", @@ -5867,7 +5867,7 @@ dependencies = [ [[package]] name = "perry-ext-bcrypt" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "bcrypt", "perry-ffi", @@ -5875,7 +5875,7 @@ dependencies = [ [[package]] name = "perry-ext-better-sqlite3" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "rusqlite", @@ -5883,7 +5883,7 @@ dependencies = [ [[package]] name = "perry-ext-cheerio" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "scraper", @@ -5891,7 +5891,7 @@ dependencies = [ [[package]] name = "perry-ext-commander" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "perry-runtime", @@ -5899,7 +5899,7 @@ dependencies = [ [[package]] name = "perry-ext-cron" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "chrono", "cron", @@ -5909,7 +5909,7 @@ dependencies = [ [[package]] name = "perry-ext-dayjs" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "chrono", "perry-ffi", @@ -5917,7 +5917,7 @@ dependencies = [ [[package]] name = "perry-ext-decimal" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "rust_decimal", @@ -5925,7 +5925,7 @@ dependencies = [ [[package]] name = "perry-ext-dotenv" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "serde_json", @@ -5933,7 +5933,7 @@ dependencies = [ [[package]] name = "perry-ext-ethers" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "rand 0.10.2", @@ -5941,7 +5941,7 @@ dependencies = [ [[package]] name = "perry-ext-events" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "perry-runtime", @@ -5949,14 +5949,14 @@ dependencies = [ [[package]] name = "perry-ext-exponential-backoff" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", ] [[package]] name = "perry-ext-fastify" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "bytes", "http-body-util", @@ -5973,7 +5973,7 @@ dependencies = [ [[package]] name = "perry-ext-fetch" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "bytes", "lazy_static", @@ -5986,7 +5986,7 @@ dependencies = [ [[package]] name = "perry-ext-http" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "base64 0.22.1", "bytes", @@ -6018,7 +6018,7 @@ dependencies = [ [[package]] name = "perry-ext-ioredis" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "lazy_static", "perry-ffi", @@ -6028,7 +6028,7 @@ dependencies = [ [[package]] name = "perry-ext-jsonwebtoken" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "base64 0.22.1", "jsonwebtoken", @@ -6039,7 +6039,7 @@ dependencies = [ [[package]] name = "perry-ext-lru-cache" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "lru", "perry-ffi", @@ -6048,7 +6048,7 @@ dependencies = [ [[package]] name = "perry-ext-moment" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "chrono", "perry-ffi", @@ -6056,7 +6056,7 @@ dependencies = [ [[package]] name = "perry-ext-mongodb" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "bson", "futures-util", @@ -6068,7 +6068,7 @@ dependencies = [ [[package]] name = "perry-ext-mysql2" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "chrono", "perry-ffi", @@ -6080,7 +6080,7 @@ dependencies = [ [[package]] name = "perry-ext-nanoid" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "nanoid", "perry-ffi", @@ -6089,7 +6089,7 @@ dependencies = [ [[package]] name = "perry-ext-net" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "bytes", "perry-ffi", @@ -6104,7 +6104,7 @@ dependencies = [ [[package]] name = "perry-ext-node-forge" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "const-oid 0.10.2", "der 0.8.2", @@ -6123,7 +6123,7 @@ dependencies = [ [[package]] name = "perry-ext-nodemailer" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "lettre", "perry-ffi", @@ -6133,7 +6133,7 @@ dependencies = [ [[package]] name = "perry-ext-parcel-watcher" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "notify", "perry-ffi", @@ -6145,7 +6145,7 @@ dependencies = [ [[package]] name = "perry-ext-pdf" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "printpdf", @@ -6153,7 +6153,7 @@ dependencies = [ [[package]] name = "perry-ext-pg" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "sqlx", @@ -6162,7 +6162,7 @@ dependencies = [ [[package]] name = "perry-ext-qs" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "perry-runtime", @@ -6171,7 +6171,7 @@ dependencies = [ [[package]] name = "perry-ext-ratelimit" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "governor", "perry-ffi", @@ -6179,7 +6179,7 @@ dependencies = [ [[package]] name = "perry-ext-sharp" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "fast_image_resize", "image", @@ -6190,7 +6190,7 @@ dependencies = [ [[package]] name = "perry-ext-streams" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "lazy_static", "perry-ffi", @@ -6199,7 +6199,7 @@ dependencies = [ [[package]] name = "perry-ext-typescript" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "perry-ffi", @@ -6219,7 +6219,7 @@ dependencies = [ [[package]] name = "perry-ext-undici" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "perry-runtime", @@ -6228,7 +6228,7 @@ dependencies = [ [[package]] name = "perry-ext-uuid" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "uuid", @@ -6236,7 +6236,7 @@ dependencies = [ [[package]] name = "perry-ext-validator" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-ffi", "perry-validation", @@ -6245,7 +6245,7 @@ dependencies = [ [[package]] name = "perry-ext-ws" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "futures-util", "lazy_static", @@ -6258,7 +6258,7 @@ dependencies = [ [[package]] name = "perry-ext-zlib" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "brotli", "flate2", @@ -6268,7 +6268,7 @@ dependencies = [ [[package]] name = "perry-ffi" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "dashmap 6.2.1", "once_cell", @@ -6278,7 +6278,7 @@ dependencies = [ [[package]] name = "perry-hir" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "perry-api-manifest", @@ -6298,11 +6298,11 @@ dependencies = [ [[package]] name = "perry-native-registration" -version = "0.5.1586" +version = "0.5.1587" [[package]] name = "perry-parser" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "perry-diagnostics", @@ -6315,7 +6315,7 @@ dependencies = [ [[package]] name = "perry-perex" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perex", "regex", @@ -6323,7 +6323,7 @@ dependencies = [ [[package]] name = "perry-runtime" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "ahash", "base64 0.22.1", @@ -6381,14 +6381,14 @@ dependencies = [ [[package]] name = "perry-runtime-static" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-runtime", ] [[package]] name = "perry-stdlib" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "aes 0.8.4", "aes 0.9.1", @@ -6477,21 +6477,21 @@ dependencies = [ [[package]] name = "perry-stdlib-static" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-stdlib", ] [[package]] name = "perry-transform" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "perry-hir", ] [[package]] name = "perry-ui" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "dirs", "perry-ffi", @@ -6501,7 +6501,7 @@ dependencies = [ [[package]] name = "perry-ui-android" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "base64 0.22.1", "jni", @@ -6516,7 +6516,7 @@ dependencies = [ [[package]] name = "perry-ui-geisterhand" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "rand 0.10.2", "serde", @@ -6526,7 +6526,7 @@ dependencies = [ [[package]] name = "perry-ui-gtk4" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "base64 0.22.1", "cairo-rs 0.22.9", @@ -6549,7 +6549,7 @@ dependencies = [ [[package]] name = "perry-ui-ios" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "base64 0.22.1", "block2", @@ -6566,7 +6566,7 @@ dependencies = [ [[package]] name = "perry-ui-macos" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "base64 0.22.1", "block2", @@ -6583,7 +6583,7 @@ dependencies = [ [[package]] name = "perry-ui-model" -version = "0.5.1586" +version = "0.5.1587" [[package]] name = "perry-ui-test" @@ -6594,11 +6594,11 @@ dependencies = [ [[package]] name = "perry-ui-testkit" -version = "0.5.1586" +version = "0.5.1587" [[package]] name = "perry-ui-tvos" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "base64 0.22.1", "block2", @@ -6615,7 +6615,7 @@ dependencies = [ [[package]] name = "perry-ui-visionos" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "base64 0.22.1", "block2", @@ -6632,7 +6632,7 @@ dependencies = [ [[package]] name = "perry-ui-watchos" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "block2", "libc", @@ -6646,7 +6646,7 @@ dependencies = [ [[package]] name = "perry-ui-windows" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "base64 0.22.1", "libc", @@ -6665,7 +6665,7 @@ dependencies = [ [[package]] name = "perry-ui-windows-winui" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "base64 0.22.1", "libc", @@ -6678,7 +6678,7 @@ dependencies = [ [[package]] name = "perry-updater" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "anyhow", "base64 0.22.1", @@ -6693,7 +6693,7 @@ dependencies = [ [[package]] name = "perry-validation" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "idna", "regex", @@ -6703,7 +6703,7 @@ dependencies = [ [[package]] name = "perry-wasm-host" -version = "0.5.1586" +version = "0.5.1587" dependencies = [ "wasmi", ] diff --git a/Cargo.toml b/Cargo.toml index 515f32311e..93b4774199 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -338,7 +338,7 @@ codegen-units = 1 codegen-units = 1 [workspace.package] -version = "0.5.1586" +version = "0.5.1587" edition = "2021" license = "MIT" repository = "https://github.com/PerryTS/perry"