refactor(nyrt): consolidate ny_release_strong into lifecycle module
Phase 29y.1 cleanup: Eliminate duplicate ny_release_strong implementation. Changes: - Remove duplicate ny_release_strong from lib.rs (11 lines) - Consolidate into ffi/lifecycle.rs (rename shim → legacy name) - Maintain backward compatibility with existing LLVM lowering Verification: - quick: 154/154 PASS - integration phase29y: 2/2 PASS 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -57,18 +57,16 @@ pub extern "C" fn nyrt_handle_release_h(handle: i64) {
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Compatibility shim for existing code
|
||||
// Legacy name (backward compatibility)
|
||||
// ============================================================================
|
||||
|
||||
/// ny_release_strong: Compatibility shim
|
||||
/// ny_release_strong: Legacy name (backward compatibility)
|
||||
///
|
||||
/// Legacy name for nyrt_handle_release_h.
|
||||
/// New code should use nyrt_handle_release_h directly.
|
||||
/// Original name from Phase 287. Kept for backward compatibility with existing
|
||||
/// LLVM lowering code. Equivalent to nyrt_handle_release_h.
|
||||
///
|
||||
/// # Deprecation
|
||||
/// This function is kept for backward compatibility with existing LLVM lowering.
|
||||
/// Future phases will migrate callers to nyrt_handle_release_h.
|
||||
/// New code should prefer nyrt_handle_release_h for clarity.
|
||||
#[no_mangle]
|
||||
pub extern "C" fn ny_release_strong_shim(handle: i64) {
|
||||
pub extern "C" fn ny_release_strong(handle: i64) {
|
||||
nyrt_handle_release_h(handle);
|
||||
}
|
||||
|
||||
@ -713,17 +713,6 @@ pub extern "C" fn ny_check_safepoint() {
|
||||
nyash_rust::runtime::global_hooks::safepoint_and_poll();
|
||||
}
|
||||
|
||||
// export: ny_release_strong(handle: i64) -> void
|
||||
// Phase 287: Release strong reference for variable overwrite semantics
|
||||
#[no_mangle]
|
||||
pub extern "C" fn ny_release_strong(handle: i64) {
|
||||
if handle > 0 {
|
||||
// Drop the handle - this decrements the reference count
|
||||
// and may trigger deallocation if count reaches zero
|
||||
nyash_rust::runtime::host_handles::drop_handle(handle as u64);
|
||||
}
|
||||
}
|
||||
|
||||
#[export_name = "nyash.string.birth_h"]
|
||||
pub extern "C" fn nyash_string_birth_h_export() -> i64 {
|
||||
// Create a new StringBox via unified plugin host; return runtime handle as i64
|
||||
|
||||
Reference in New Issue
Block a user