diff --git a/jit.c b/jit.c index a5e90f29fd..0709c6d8f0 100644 --- a/jit.c +++ b/jit.c @@ -484,3 +484,11 @@ rb_jit_vm_lock_then_barrier(unsigned int *recursive_lock_level, const char *file rb_vm_lock_enter(recursive_lock_level, file, line); rb_vm_barrier(); } + +// Release the VM lock. The lock level must point to the same integer used to +// acquire the lock. +void +rb_jit_vm_unlock(unsigned int *recursive_lock_level, const char *file, int line) +{ + rb_vm_lock_leave(recursive_lock_level, file, line); +} diff --git a/yjit.c b/yjit.c index 8c94b59dbf..bca0df96fd 100644 --- a/yjit.c +++ b/yjit.c @@ -686,14 +686,6 @@ rb_yjit_obj_written(VALUE old, VALUE young, const char *file, int line) rb_obj_written(old, Qundef, young, file, line); } -// Release the VM lock. The lock level must point to the same integer used to -// acquire the lock. -void -rb_yjit_vm_unlock(unsigned int *recursive_lock_level, const char *file, int line) -{ - rb_vm_lock_leave(recursive_lock_level, file, line); -} - void rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception) { diff --git a/yjit/bindgen/src/main.rs b/yjit/bindgen/src/main.rs index 543f9992d6..d30fb6c779 100644 --- a/yjit/bindgen/src/main.rs +++ b/yjit/bindgen/src/main.rs @@ -328,7 +328,6 @@ fn main() { .allowlist_function("rb_set_cfp_(pc|sp)") .allowlist_function("rb_c_method_tracing_currently_enabled") .allowlist_function("rb_full_cfunc_return") - .allowlist_function("rb_yjit_vm_unlock") .allowlist_function("rb_assert_(iseq|cme)_handle") .allowlist_function("rb_IMEMO_TYPE_P") .allowlist_function("rb_yjit_constcache_shareable") @@ -355,6 +354,7 @@ fn main() { .allowlist_function("rb_jit_shape_too_complex_p") .allowlist_function("rb_jit_multi_ractor_p") .allowlist_function("rb_jit_vm_lock_then_barrier") + .allowlist_function("rb_jit_vm_unlock") .allowlist_type("robject_offsets") // from vm_sync.h diff --git a/yjit/src/cruby.rs b/yjit/src/cruby.rs index 493a92bff5..36baecd535 100644 --- a/yjit/src/cruby.rs +++ b/yjit/src/cruby.rs @@ -697,7 +697,7 @@ where } }; - unsafe { rb_yjit_vm_unlock(&mut recursive_lock_level, file, line) }; + unsafe { rb_jit_vm_unlock(&mut recursive_lock_level, file, line) }; ret } diff --git a/yjit/src/cruby_bindings.inc.rs b/yjit/src/cruby_bindings.inc.rs index f7971310f3..4d52b675a0 100644 --- a/yjit/src/cruby_bindings.inc.rs +++ b/yjit/src/cruby_bindings.inc.rs @@ -1226,11 +1226,6 @@ extern "C" { file: *const ::std::os::raw::c_char, line: ::std::os::raw::c_int, ); - pub fn rb_yjit_vm_unlock( - recursive_lock_level: *mut ::std::os::raw::c_uint, - file: *const ::std::os::raw::c_char, - line: ::std::os::raw::c_int, - ); pub fn rb_object_shape_count() -> VALUE; pub fn rb_yjit_shape_obj_too_complex_p(obj: VALUE) -> bool; pub fn rb_yjit_shape_capacity(shape_id: shape_id_t) -> attr_index_t; @@ -1328,4 +1323,9 @@ extern "C" { file: *const ::std::os::raw::c_char, line: ::std::os::raw::c_int, ); + pub fn rb_jit_vm_unlock( + recursive_lock_level: *mut ::std::os::raw::c_uint, + file: *const ::std::os::raw::c_char, + line: ::std::os::raw::c_int, + ); } diff --git a/zjit.c b/zjit.c index 25f840232d..7b4952a93e 100644 --- a/zjit.c +++ b/zjit.c @@ -181,13 +181,6 @@ rb_zjit_constcache_shareable(const struct iseq_inline_constant_cache_entry *ice) return (ice->flags & IMEMO_CONST_CACHE_SHAREABLE) != 0; } -// Release the VM lock. The lock level must point to the same integer used to -// acquire the lock. -void -rb_zjit_vm_unlock(unsigned int *recursive_lock_level, const char *file, int line) -{ - rb_vm_lock_leave(recursive_lock_level, file, line); -} bool rb_zjit_mark_writable(void *mem_block, uint32_t mem_size) diff --git a/zjit/bindgen/src/main.rs b/zjit/bindgen/src/main.rs index 859dab1862..e57d0ae015 100644 --- a/zjit/bindgen/src/main.rs +++ b/zjit/bindgen/src/main.rs @@ -347,7 +347,6 @@ fn main() { .allowlist_function("rb_set_cfp_(pc|sp)") .allowlist_function("rb_c_method_tracing_currently_enabled") .allowlist_function("rb_full_cfunc_return") - .allowlist_function("rb_zjit_vm_unlock") .allowlist_function("rb_assert_(iseq|cme)_handle") .allowlist_function("rb_IMEMO_TYPE_P") .allowlist_function("rb_iseq_reset_jit_func") @@ -368,6 +367,7 @@ fn main() { .allowlist_function("rb_jit_shape_too_complex_p") .allowlist_function("rb_jit_multi_ractor_p") .allowlist_function("rb_jit_vm_lock_then_barrier") + .allowlist_function("rb_jit_vm_unlock") .allowlist_type("robject_offsets") // from vm_sync.h diff --git a/zjit/src/cruby.rs b/zjit/src/cruby.rs index 394bb7bb0f..4208af03f5 100644 --- a/zjit/src/cruby.rs +++ b/zjit/src/cruby.rs @@ -845,7 +845,7 @@ where } }; - unsafe { rb_zjit_vm_unlock(&mut recursive_lock_level, file, line) }; + unsafe { rb_jit_vm_unlock(&mut recursive_lock_level, file, line) }; ret } diff --git a/zjit/src/cruby_bindings.inc.rs b/zjit/src/cruby_bindings.inc.rs index fb642aba87..88b9097697 100644 --- a/zjit/src/cruby_bindings.inc.rs +++ b/zjit/src/cruby_bindings.inc.rs @@ -921,11 +921,6 @@ unsafe extern "C" { pub fn rb_zjit_profile_disable(iseq: *const rb_iseq_t); pub fn rb_vm_base_ptr(cfp: *mut rb_control_frame_struct) -> *mut VALUE; pub fn rb_zjit_constcache_shareable(ice: *const iseq_inline_constant_cache_entry) -> bool; - pub fn rb_zjit_vm_unlock( - recursive_lock_level: *mut ::std::os::raw::c_uint, - file: *const ::std::os::raw::c_char, - line: ::std::os::raw::c_int, - ); pub fn rb_zjit_mark_writable(mem_block: *mut ::std::os::raw::c_void, mem_size: u32) -> bool; pub fn rb_zjit_mark_executable(mem_block: *mut ::std::os::raw::c_void, mem_size: u32); pub fn rb_zjit_mark_unused(mem_block: *mut ::std::os::raw::c_void, mem_size: u32) -> bool; @@ -1029,4 +1024,9 @@ unsafe extern "C" { file: *const ::std::os::raw::c_char, line: ::std::os::raw::c_int, ); + pub fn rb_jit_vm_unlock( + recursive_lock_level: *mut ::std::os::raw::c_uint, + file: *const ::std::os::raw::c_char, + line: ::std::os::raw::c_int, + ); }