mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
ZJIT: Use InvokeBuiltin leaf attribute in codegen
This commit is contained in:
parent
fa5481bc06
commit
c3404d736f
Notes:
git
2025-10-23 00:10:50 +00:00
@ -386,7 +386,7 @@ fn gen_insn(cb: &mut CodeBlock, jit: &mut JITState, asm: &mut Assembler, functio
|
||||
// Ensure we have enough room fit ec, self, and arguments
|
||||
// TODO remove this check when we have stack args (we can use Time.new to test it)
|
||||
Insn::InvokeBuiltin { bf, state, .. } if bf.argc + 2 > (C_ARG_OPNDS.len() as i32) => return Err(*state),
|
||||
Insn::InvokeBuiltin { bf, args, state, .. } => gen_invokebuiltin(jit, asm, &function.frame_state(*state), bf, opnds!(args)),
|
||||
Insn::InvokeBuiltin { bf, leaf, args, state, .. } => gen_invokebuiltin(jit, asm, &function.frame_state(*state), bf, *leaf, opnds!(args)),
|
||||
&Insn::EntryPoint { jit_entry_idx } => no_output!(gen_entry_point(jit, asm, jit_entry_idx)),
|
||||
Insn::Return { val } => no_output!(gen_return(asm, opnd!(val))),
|
||||
Insn::FixnumAdd { left, right, state } => gen_fixnum_add(jit, asm, opnd!(left), opnd!(right), &function.frame_state(*state)),
|
||||
@ -640,13 +640,17 @@ fn gen_get_constant_path(jit: &JITState, asm: &mut Assembler, ic: *const iseq_in
|
||||
asm_ccall!(asm, rb_vm_opt_getconstant_path, EC, CFP, Opnd::const_ptr(ic))
|
||||
}
|
||||
|
||||
fn gen_invokebuiltin(jit: &JITState, asm: &mut Assembler, state: &FrameState, bf: &rb_builtin_function, args: Vec<Opnd>) -> lir::Opnd {
|
||||
fn gen_invokebuiltin(jit: &JITState, asm: &mut Assembler, state: &FrameState, bf: &rb_builtin_function, leaf: bool, args: Vec<Opnd>) -> lir::Opnd {
|
||||
assert!(bf.argc + 2 <= C_ARG_OPNDS.len() as i32,
|
||||
"gen_invokebuiltin should not be called for builtin function {} with too many arguments: {}",
|
||||
unsafe { std::ffi::CStr::from_ptr(bf.name).to_str().unwrap() },
|
||||
bf.argc);
|
||||
// Anything can happen inside builtin functions
|
||||
gen_prepare_non_leaf_call(jit, asm, state);
|
||||
if leaf {
|
||||
gen_prepare_leaf_call_with_gc(asm, state);
|
||||
} else {
|
||||
// Anything can happen inside builtin functions
|
||||
gen_prepare_non_leaf_call(jit, asm, state);
|
||||
}
|
||||
|
||||
let mut cargs = vec![EC];
|
||||
cargs.extend(args);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user