YJIT: handle opt_aset_with
``` # frozen_string_ltieral: true hash["literal"] = value ```
This commit is contained in:
parent
2e3f81838c
commit
186e60cb68
Notes:
git
2025-05-15 09:56:37 +00:00
@ -6939,6 +6939,12 @@ vm_opt_aset_with(VALUE recv, VALUE key, VALUE val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_vm_opt_aset_with(VALUE recv, VALUE key, VALUE value)
|
||||||
|
{
|
||||||
|
return vm_opt_aset_with(recv, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
vm_opt_length(VALUE recv, int bop)
|
vm_opt_length(VALUE recv, int bop)
|
||||||
{
|
{
|
||||||
|
@ -3891,6 +3891,40 @@ fn gen_opt_aref(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn gen_opt_aset_with(
|
||||||
|
jit: &mut JITState,
|
||||||
|
asm: &mut Assembler,
|
||||||
|
) -> Option<CodegenStatus> {
|
||||||
|
// We might allocate or raise
|
||||||
|
jit_prepare_non_leaf_call(jit, asm);
|
||||||
|
|
||||||
|
let key_opnd = Opnd::Value(jit.get_arg(0));
|
||||||
|
let recv_opnd = asm.stack_opnd(1);
|
||||||
|
let value_opnd = asm.stack_opnd(0);
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
fn rb_vm_opt_aset_with(recv: VALUE, key: VALUE, value: VALUE) -> VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
let val_opnd = asm.ccall(
|
||||||
|
rb_vm_opt_aset_with as *const u8,
|
||||||
|
vec![
|
||||||
|
recv_opnd,
|
||||||
|
key_opnd,
|
||||||
|
value_opnd,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
asm.stack_pop(2); // Keep it on stack during GC
|
||||||
|
|
||||||
|
asm.cmp(val_opnd, Qundef.into());
|
||||||
|
asm.je(Target::side_exit(Counter::opt_aset_with_qundef));
|
||||||
|
|
||||||
|
let top = asm.stack_push(Type::Unknown);
|
||||||
|
asm.mov(top, val_opnd);
|
||||||
|
|
||||||
|
return Some(KeepCompiling);
|
||||||
|
}
|
||||||
|
|
||||||
fn gen_opt_aset(
|
fn gen_opt_aset(
|
||||||
jit: &mut JITState,
|
jit: &mut JITState,
|
||||||
asm: &mut Assembler,
|
asm: &mut Assembler,
|
||||||
@ -10753,6 +10787,7 @@ fn get_gen_fn(opcode: VALUE) -> Option<InsnGenFn> {
|
|||||||
YARVINSN_opt_aref => Some(gen_opt_aref),
|
YARVINSN_opt_aref => Some(gen_opt_aref),
|
||||||
YARVINSN_opt_aset => Some(gen_opt_aset),
|
YARVINSN_opt_aset => Some(gen_opt_aset),
|
||||||
YARVINSN_opt_aref_with => Some(gen_opt_aref_with),
|
YARVINSN_opt_aref_with => Some(gen_opt_aref_with),
|
||||||
|
YARVINSN_opt_aset_with => Some(gen_opt_aset_with),
|
||||||
YARVINSN_opt_mult => Some(gen_opt_mult),
|
YARVINSN_opt_mult => Some(gen_opt_mult),
|
||||||
YARVINSN_opt_div => Some(gen_opt_div),
|
YARVINSN_opt_div => Some(gen_opt_div),
|
||||||
YARVINSN_opt_ltlt => Some(gen_opt_ltlt),
|
YARVINSN_opt_ltlt => Some(gen_opt_ltlt),
|
||||||
|
@ -520,6 +520,7 @@ make_counters! {
|
|||||||
opt_aset_not_hash,
|
opt_aset_not_hash,
|
||||||
|
|
||||||
opt_aref_with_qundef,
|
opt_aref_with_qundef,
|
||||||
|
opt_aset_with_qundef,
|
||||||
|
|
||||||
opt_case_dispatch_megamorphic,
|
opt_case_dispatch_megamorphic,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user