summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Bernstein <[email protected]>2025-06-05 16:54:25 -0400
committerAlan Wu <[email protected]>2025-06-06 16:17:54 +0900
commit3246bbd32500bff86f32db0dd3cafdd648650afa ()
tree60533edb5212332c194979869a0692d019ef99c7
parent6a46ca31a7d4999e9788896445fbb53d049882ab (diff)
ZJIT: Add codegen for uncached setinstancevariable
Notes: Merged: https://.com/ruby/ruby/pull/13527
-rw-r--r--test/ruby/test_zjit.rb9
-rw-r--r--zjit/bindgen/src/main.rs1
-rw-r--r--zjit/src/codegen.rs10
-rw-r--r--zjit/src/cruby_bindings.inc.rs1
4 files changed, 21 insertions, 0 deletions
@@ -559,6 +559,15 @@ class TestZJIT < Test::Unit::TestCase
}
end
# tool/ruby_vm/views/*.erb relies on the zjit instructions a) being contiguous and
# b) being reliably ordered after all the other instructions.
def test_instruction_order
@@ -381,6 +381,7 @@ fn main() {
.allowlist_function("rb_attr_get")
.allowlist_function("rb_ivar_defined")
.allowlist_function("rb_ivar_get")
.allowlist_function("rb_mod_name")
// From include/ruby/internal/intern/vm.h
@@ -275,6 +275,7 @@ fn gen_insn(cb: &mut CodeBlock, jit: &mut JITState, asm: &mut Assembler, functio
Insn::Point(_) => return Some(()), // For now, rb_zjit_bop_redefined() panics. TODO: leave a point and fix rb_zjit_bop_redefined()
Insn::CCall { cfun, args, name: _, return_type: _, elidable: _ } => gen_ccall(jit, asm, *cfun, args)?,
Insn::GetIvar { self_val, id, state: _ } => gen_getivar(asm, opnd!(self_val), *id),
_ => {
debug!("ZJIT: gen_function: unexpected insn {:?}", insn);
return None;
@@ -307,6 +308,15 @@ fn gen_getivar(asm: &mut Assembler, recv: Opnd, id: ID) -> Opnd {
)
}
/// Compile an interpreter entry block to be inserted into an ISEQ
fn gen_entry_prologue(asm: &mut Assembler, iseq: IseqPtr) {
asm_comment!(asm, "ZJIT entry point: {}", iseq_get_location(iseq, 0));
@@ -829,6 +829,7 @@ unsafe extern "C" {
pub fn rb_str_intern(str_: VALUE) -> VALUE;
pub fn rb_mod_name(mod_: VALUE) -> VALUE;
pub fn rb_ivar_get(obj: VALUE, name: ID) -> VALUE;
pub fn rb_ivar_defined(obj: VALUE, name: ID) -> VALUE;
pub fn rb_attr_get(obj: VALUE, name: ID) -> VALUE;
pub fn rb_obj_info_dump(obj: VALUE);