ruby-changes:73367
From: John <ko1@a...>
Date: Fri, 2 Sep 2022 07:21:18 +0900 (JST)
Subject: [ruby-changes:73367] 1cc97412cd (master): Remove rb_iseq_each
https://git.ruby-lang.org/ruby.git/commit/?id=1cc97412cd From 1cc97412cd8168d897b1b361c8fa2cf792a51729 Mon Sep 17 00:00:00 2001 From: John Hawthorn <john@h...> Date: Tue, 26 Jul 2022 18:19:44 -0700 Subject: Remove rb_iseq_each --- iseq.c | 33 --------------------------------- iseq.h | 4 ---- yjit/bindgen/src/main.rs | 1 - yjit/src/cruby_bindings.inc.rs | 16 ---------------- 4 files changed, 54 deletions(-) diff --git a/iseq.c b/iseq.c index dca41a146d..4892d93df1 100644 --- a/iseq.c +++ b/iseq.c @@ -295,39 +295,6 @@ rb_iseq_each_value(const rb_iseq_t *iseq, iseq_value_itr_t * func, void *data) https://github.com/ruby/ruby/blob/trunk/iseq.c#L295 } } -// Similar to rb_iseq_each_value, except that this walks through each -// instruction instead of the associated VALUEs. The provided iterator should -// return a boolean that indicates whether or not to continue iterating. -void -rb_iseq_each(const rb_iseq_t *iseq, size_t start_index, rb_iseq_each_i iterator, void *data) -{ - unsigned int size; - VALUE *code; - size_t index; - - rb_vm_insns_translator_t *const translator = -#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE - (FL_TEST((VALUE)iseq, ISEQ_TRANSLATED)) ? rb_vm_insn_addr2insn2 : -#endif - rb_vm_insn_normalizing_translator; // Always pass non-trace opcodes. - - const struct rb_iseq_constant_body *const body = ISEQ_BODY(iseq); - - size = body->iseq_size; - code = body->iseq_encoded; - - for (index = start_index; index < size;) { - void *addr = (void *) code[index]; - VALUE insn = translator(addr); - - if (!iterator(code, insn, index, data)) { - break; - } - - index += insn_len(insn); - } -} - static VALUE update_each_insn_value(void *ctx, VALUE obj) { diff --git a/iseq.h b/iseq.h index fa328e9a84..98cf71d52c 100644 --- a/iseq.h +++ b/iseq.h @@ -187,10 +187,6 @@ void rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc, https://github.com/ruby/ruby/blob/trunk/iseq.h#L187 VALUE exception, VALUE body); void rb_iseq_mark_insn_storage(struct iseq_compile_data_storage *arena); -/* iseq.c */ -typedef bool rb_iseq_each_i(VALUE *code, VALUE insn, size_t index, void *data); -void rb_iseq_each(const rb_iseq_t *iseq, size_t start_index, rb_iseq_each_i iterator, void *data); - VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt); VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc); unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos); diff --git a/yjit/bindgen/src/main.rs b/yjit/bindgen/src/main.rs index df4083638d..eaf030a1de 100644 --- a/yjit/bindgen/src/main.rs +++ b/yjit/bindgen/src/main.rs @@ -288,7 +288,6 @@ fn main() { https://github.com/ruby/ruby/blob/trunk/yjit/bindgen/src/main.rs#L288 // From iseq.h .allowlist_function("rb_vm_insn_addr2opcode") .allowlist_function("rb_iseqw_to_iseq") - .allowlist_function("rb_iseq_each") .allowlist_function("rb_iseq_method_name") // From builtin.h diff --git a/yjit/src/cruby_bindings.inc.rs b/yjit/src/cruby_bindings.inc.rs index cedc3216b8..9869998788 100644 --- a/yjit/src/cruby_bindings.inc.rs +++ b/yjit/src/cruby_bindings.inc.rs @@ -979,22 +979,6 @@ pub type ruby_vminsn_type = u32; https://github.com/ruby/ruby/blob/trunk/yjit/src/cruby_bindings.inc.rs#L979 extern "C" { pub fn rb_vm_insn_addr2opcode(addr: *const ::std::os::raw::c_void) -> ::std::os::raw::c_int; } -pub type rb_iseq_each_i = ::std::option::Option< - unsafe extern "C" fn( - code: *mut VALUE, - insn: VALUE, - index: size_t, - data: *mut ::std::os::raw::c_void, - ) -> bool, ->; -extern "C" { - pub fn rb_iseq_each( - iseq: *const rb_iseq_t, - start_index: size_t, - iterator: rb_iseq_each_i, - data: *mut ::std::os::raw::c_void, - ); -} extern "C" { pub fn rb_iseqw_to_iseq(iseqw: VALUE) -> *const rb_iseq_t; } -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/