Remove rb_iseq_each
This commit is contained in:
parent
679ef34586
commit
1cc97412cd
Notes:
git
2022-09-02 07:21:29 +09:00
33
iseq.c
33
iseq.c
@ -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
|
static VALUE
|
||||||
update_each_insn_value(void *ctx, VALUE obj)
|
update_each_insn_value(void *ctx, VALUE obj)
|
||||||
{
|
{
|
||||||
|
4
iseq.h
4
iseq.h
@ -187,10 +187,6 @@ void rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc,
|
|||||||
VALUE exception, VALUE body);
|
VALUE exception, VALUE body);
|
||||||
void rb_iseq_mark_insn_storage(struct iseq_compile_data_storage *arena);
|
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_load(VALUE data, VALUE parent, VALUE opt);
|
||||||
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
|
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);
|
unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos);
|
||||||
|
@ -288,7 +288,6 @@ fn main() {
|
|||||||
// From iseq.h
|
// From iseq.h
|
||||||
.allowlist_function("rb_vm_insn_addr2opcode")
|
.allowlist_function("rb_vm_insn_addr2opcode")
|
||||||
.allowlist_function("rb_iseqw_to_iseq")
|
.allowlist_function("rb_iseqw_to_iseq")
|
||||||
.allowlist_function("rb_iseq_each")
|
|
||||||
.allowlist_function("rb_iseq_method_name")
|
.allowlist_function("rb_iseq_method_name")
|
||||||
|
|
||||||
// From builtin.h
|
// From builtin.h
|
||||||
|
@ -979,22 +979,6 @@ pub type ruby_vminsn_type = u32;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn rb_vm_insn_addr2opcode(addr: *const ::std::os::raw::c_void) -> ::std::os::raw::c_int;
|
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" {
|
extern "C" {
|
||||||
pub fn rb_iseqw_to_iseq(iseqw: VALUE) -> *const rb_iseq_t;
|
pub fn rb_iseqw_to_iseq(iseqw: VALUE) -> *const rb_iseq_t;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user