diff options
author | Alan Wu <[email protected]> | 2024-07-03 19:10:57 -0400 |
---|---|---|
committer | Alan Wu <[email protected]> | 2024-07-03 19:10:57 -0400 |
commit | b160a78d6b466fc58e716be1f108edc57f6ec6e5 (patch) | |
tree | b83c98e5790f8bdb23928f960f7ada3e857bc400 /yjit/src/disasm.rs | |
parent | f5dfadf38bf1f712bd5dd768e0d78328cbc556b9 (diff) |
YJIT: Remove done TODO, fix indent
Type check now done in rb_iseqw_to_iseq().
Diffstat (limited to 'yjit/src/disasm.rs')
-rw-r--r-- | yjit/src/disasm.rs | 58 |
1 files changed, 23 insertions, 35 deletions
diff --git a/yjit/src/disasm.rs b/yjit/src/disasm.rs index fb5c46e7ce..da6c7b65a3 100644 --- a/yjit/src/disasm.rs +++ b/yjit/src/disasm.rs @@ -23,11 +23,6 @@ pub extern "C" fn rb_yjit_disasm_iseq(_ec: EcPtr, _ruby_self: VALUE, iseqw: VALU #[cfg(feature = "disasm")] { - // TODO: - //if unsafe { CLASS_OF(iseqw) != rb_cISeq } { - // return Qnil; - //} - if !yjit_enabled_p() { return Qnil; } @@ -264,43 +259,36 @@ pub fn unindent(string: &str, trim_lines: bool) -> String { /// Produce a list of instructions compiled for an isew #[no_mangle] pub extern "C" fn rb_yjit_insns_compiled(_ec: EcPtr, _ruby_self: VALUE, iseqw: VALUE) -> VALUE { - { - // TODO: - //if unsafe { CLASS_OF(iseqw) != rb_cISeq } { - // return Qnil; - //} - - if !yjit_enabled_p() { - return Qnil; - } - - // Get the iseq pointer from the wrapper - let iseq = unsafe { rb_iseqw_to_iseq(iseqw) }; + if !yjit_enabled_p() { + return Qnil; + } - // Get the list of instructions compiled - let insn_vec = insns_compiled(iseq); + // Get the iseq pointer from the wrapper + let iseq = unsafe { rb_iseqw_to_iseq(iseqw) }; - unsafe { - let insn_ary = rb_ary_new_capa((insn_vec.len() * 2) as i64); + // Get the list of instructions compiled + let insn_vec = insns_compiled(iseq); - // For each instruction compiled - for idx in 0..insn_vec.len() { - let op_name = &insn_vec[idx].0; - let insn_idx = insn_vec[idx].1; + unsafe { + let insn_ary = rb_ary_new_capa((insn_vec.len() * 2) as i64); - let op_sym = rust_str_to_sym(&op_name); + // For each instruction compiled + for idx in 0..insn_vec.len() { + let op_name = &insn_vec[idx].0; + let insn_idx = insn_vec[idx].1; - // Store the instruction index and opcode symbol - rb_ary_store( - insn_ary, - (2 * idx + 0) as i64, - VALUE::fixnum_from_usize(insn_idx as usize), - ); - rb_ary_store(insn_ary, (2 * idx + 1) as i64, op_sym); - } + let op_sym = rust_str_to_sym(&op_name); - insn_ary + // Store the instruction index and opcode symbol + rb_ary_store( + insn_ary, + (2 * idx + 0) as i64, + VALUE::fixnum_from_usize(insn_idx as usize), + ); + rb_ary_store(insn_ary, (2 * idx + 1) as i64, op_sym); } + + insn_ary } } |