ZJIT: Profile opt_and and opt_or instructions

This commit is contained in:
Stan Lo 2025-07-09 16:18:04 +01:00 committed by Max Bernstein
parent b146eae3b5
commit 10b582dab6
3 changed files with 7 additions and 1 deletions

View file

@ -1481,6 +1481,7 @@ opt_and
(CALL_DATA cd) (CALL_DATA cd)
(VALUE recv, VALUE obj) (VALUE recv, VALUE obj)
(VALUE val) (VALUE val)
// attr bool zjit_profile = true;
{ {
val = vm_opt_and(recv, obj); val = vm_opt_and(recv, obj);
@ -1495,6 +1496,7 @@ opt_or
(CALL_DATA cd) (CALL_DATA cd)
(VALUE recv, VALUE obj) (VALUE recv, VALUE obj)
(VALUE val) (VALUE val)
// attr bool zjit_profile = true;
{ {
val = vm_opt_or(recv, obj); val = vm_opt_or(recv, obj);

View file

@ -695,7 +695,9 @@ pub const YARVINSN_zjit_opt_lt: ruby_vminsn_type = 231;
pub const YARVINSN_zjit_opt_le: ruby_vminsn_type = 232; pub const YARVINSN_zjit_opt_le: ruby_vminsn_type = 232;
pub const YARVINSN_zjit_opt_gt: ruby_vminsn_type = 233; pub const YARVINSN_zjit_opt_gt: ruby_vminsn_type = 233;
pub const YARVINSN_zjit_opt_ge: ruby_vminsn_type = 234; pub const YARVINSN_zjit_opt_ge: ruby_vminsn_type = 234;
pub const VM_INSTRUCTION_SIZE: ruby_vminsn_type = 235; pub const YARVINSN_zjit_opt_and: ruby_vminsn_type = 235;
pub const YARVINSN_zjit_opt_or: ruby_vminsn_type = 236;
pub const VM_INSTRUCTION_SIZE: ruby_vminsn_type = 237;
pub type ruby_vminsn_type = u32; pub type ruby_vminsn_type = u32;
pub type rb_iseq_callback = ::std::option::Option< pub type rb_iseq_callback = ::std::option::Option<
unsafe extern "C" fn(arg1: *const rb_iseq_t, arg2: *mut ::std::os::raw::c_void), unsafe extern "C" fn(arg1: *const rb_iseq_t, arg2: *mut ::std::os::raw::c_void),

View file

@ -63,6 +63,8 @@ fn profile_insn(profiler: &mut Profiler, opcode: ruby_vminsn_type) {
YARVINSN_opt_le => profile_operands(profiler, 2), YARVINSN_opt_le => profile_operands(profiler, 2),
YARVINSN_opt_gt => profile_operands(profiler, 2), YARVINSN_opt_gt => profile_operands(profiler, 2),
YARVINSN_opt_ge => profile_operands(profiler, 2), YARVINSN_opt_ge => profile_operands(profiler, 2),
YARVINSN_opt_and => profile_operands(profiler, 2),
YARVINSN_opt_or => profile_operands(profiler, 2),
YARVINSN_opt_send_without_block => { YARVINSN_opt_send_without_block => {
let cd: *const rb_call_data = profiler.insn_opnd(0).as_ptr(); let cd: *const rb_call_data = profiler.insn_opnd(0).as_ptr();
let argc = unsafe { vm_ci_argc((*cd).ci) }; let argc = unsafe { vm_ci_argc((*cd).ci) };