Skip to content

Commit add78e7

Browse files
authored
ZJIT: Use iseq pointer directly in get/set class var codegen (ruby#14921)
Addresses ruby#14918 (comment)
1 parent e529bf7 commit add78e7

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

zjit/src/codegen.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -506,12 +506,9 @@ fn gen_get_ep(asm: &mut Assembler, level: u32) -> Opnd {
506506

507507
fn gen_objtostring(jit: &mut JITState, asm: &mut Assembler, val: Opnd, cd: *const rb_call_data, state: &FrameState) -> Opnd {
508508
gen_prepare_non_leaf_call(jit, asm, state);
509-
510-
let iseq_opnd = Opnd::Value(jit.iseq.into());
511-
512509
// TODO: Specialize for immediate types
513510
// Call rb_vm_objtostring(iseq, recv, cd)
514-
let ret = asm_ccall!(asm, rb_vm_objtostring, iseq_opnd, val, (cd as usize).into());
511+
let ret = asm_ccall!(asm, rb_vm_objtostring, VALUE(jit.iseq as usize).into(), val, (cd as usize).into());
515512

516513
// TODO: Call `to_s` on the receiver if rb_vm_objtostring returns Qundef
517514
// Need to replicate what CALL_SIMPLE_METHOD does
@@ -836,16 +833,12 @@ fn gen_setivar(jit: &mut JITState, asm: &mut Assembler, recv: Opnd, id: ID, val:
836833

837834
fn gen_getclassvar(jit: &mut JITState, asm: &mut Assembler, id: ID, ic: *const iseq_inline_cvar_cache_entry, state: &FrameState) -> Opnd {
838835
gen_prepare_non_leaf_call(jit, asm, state);
839-
840-
let iseq = asm.load(Opnd::mem(64, CFP, RUBY_OFFSET_CFP_ISEQ));
841-
asm_ccall!(asm, rb_vm_getclassvariable, iseq, CFP, id.0.into(), Opnd::const_ptr(ic))
836+
asm_ccall!(asm, rb_vm_getclassvariable, VALUE(jit.iseq as usize).into(), CFP, id.0.into(), Opnd::const_ptr(ic))
842837
}
843838

844839
fn gen_setclassvar(jit: &mut JITState, asm: &mut Assembler, id: ID, val: Opnd, ic: *const iseq_inline_cvar_cache_entry, state: &FrameState) {
845840
gen_prepare_non_leaf_call(jit, asm, state);
846-
847-
let iseq = asm.load(Opnd::mem(64, CFP, RUBY_OFFSET_CFP_ISEQ));
848-
asm_ccall!(asm, rb_vm_setclassvariable, iseq, CFP, id.0.into(), val, Opnd::const_ptr(ic));
841+
asm_ccall!(asm, rb_vm_setclassvariable, VALUE(jit.iseq as usize).into(), CFP, id.0.into(), val, Opnd::const_ptr(ic));
849842
}
850843

851844
/// Look up global variables

0 commit comments

Comments
 (0)