From 8138802448c4b1b6870eec02b6b8939f791af587 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Wed, 17 Aug 2022 12:23:59 -0400 Subject: [PATCH] Fix issue with expandarray, add missing jl, enable tests (https://github.com/Shopify/ruby/pull/409) --- yjit/src/backend/arm64/mod.rs | 3 +++ yjit/src/backend/ir.rs | 2 ++ yjit/src/backend/x86_64/mod.rs | 8 ++++++++ yjit/src/codegen.rs | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/yjit/src/backend/arm64/mod.rs b/yjit/src/backend/arm64/mod.rs index 64136bfdd221da..d92b4778e342f3 100644 --- a/yjit/src/backend/arm64/mod.rs +++ b/yjit/src/backend/arm64/mod.rs @@ -826,6 +826,9 @@ impl Assembler Op::Jne => { emit_conditional_jump::<{Condition::NE}>(cb, insn.target.unwrap()); }, + Op::Jl => { + emit_conditional_jump::<{Condition::LT}>(cb, insn.target.unwrap()); + }, Op::Jbe => { emit_conditional_jump::<{Condition::LS}>(cb, insn.target.unwrap()); }, diff --git a/yjit/src/backend/ir.rs b/yjit/src/backend/ir.rs index ef8cd5e8728d4c..952c8f7f10aa5d 100644 --- a/yjit/src/backend/ir.rs +++ b/yjit/src/backend/ir.rs @@ -118,6 +118,7 @@ pub enum Op JmpOpnd, // Low-level conditional jump instructions + Jl, Jbe, Je, Jne, @@ -988,6 +989,7 @@ def_push_1_opnd_no_out!(jmp_opnd, Op::JmpOpnd); def_push_jcc!(jmp, Op::Jmp); def_push_jcc!(je, Op::Je); def_push_jcc!(jne, Op::Jne); +def_push_jcc!(jl, Op::Jl); def_push_jcc!(jbe, Op::Jbe); def_push_jcc!(jz, Op::Jz); def_push_jcc!(jnz, Op::Jnz); diff --git a/yjit/src/backend/x86_64/mod.rs b/yjit/src/backend/x86_64/mod.rs index d474c9fe59a71b..1ec08dd78746ca 100644 --- a/yjit/src/backend/x86_64/mod.rs +++ b/yjit/src/backend/x86_64/mod.rs @@ -465,6 +465,14 @@ impl Assembler } } + Op::Jl => { + match insn.target.unwrap() { + Target::CodePtr(code_ptr) => jl_ptr(cb, code_ptr), + Target::Label(label_idx) => jl_label(cb, label_idx), + _ => unreachable!() + } + }, + Op::Jbe => { match insn.target.unwrap() { Target::CodePtr(code_ptr) => jbe_ptr(cb, code_ptr), diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index ed11f7cf0fe942..2e202ce2d038ac 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -1445,7 +1445,7 @@ fn gen_expandarray( // Only handle the case where the number of values in the array is greater // than or equal to the number of values requested. asm.cmp(array_len_opnd, num.into()); - asm.jo(counted_exit!(ocb, side_exit, expandarray_rhs_too_small).into()); + asm.jl(counted_exit!(ocb, side_exit, expandarray_rhs_too_small).into()); // Load the address of the embedded array into REG1. // (struct RArray *)(obj)->as.ary