1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Remove rb_iseq_each

This commit is contained in:
John Hawthorn 2022-07-26 18:19:44 -07:00
parent 679ef34586
commit 1cc97412cd
Notes: git 2022-09-02 07:21:29 +09:00
4 changed files with 0 additions and 54 deletions

33
iseq.c
View file

@ -295,39 +295,6 @@ rb_iseq_each_value(const rb_iseq_t *iseq, iseq_value_itr_t * func, void *data)
}
}
// 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)
{

4
iseq.h
View file

@ -187,10 +187,6 @@ void rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc,
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);

View file

@ -288,7 +288,6 @@ fn main() {
// 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

View file

@ -979,22 +979,6 @@ pub type ruby_vminsn_type = u32;
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;
}