Skip to content

Commit

Permalink
Port opt_str_uminus to new backend IR (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
fresh-eggs authored and k0kubun committed Aug 25, 2022
1 parent f641146 commit 03dd240
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 8 additions & 0 deletions bootstraptest/test_yjit_new_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,14 @@ def foo
Foo.new.foo
}

# opt_str_uminus
assert_equal 'mosaic', %q{
def foo()
-"mosaic"
end
foo()
}

# opt_str_freeze
assert_equal 'netscape', %q{
def foo()
Expand Down
9 changes: 3 additions & 6 deletions yjit/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3074,27 +3074,24 @@ fn gen_opt_str_freeze(
KeepCompiling
}

/*
fn gen_opt_str_uminus(
jit: &mut JITState,
ctx: &mut Context,
cb: &mut CodeBlock,
asm: &mut Assembler,
ocb: &mut OutlinedCb,
) -> CodegenStatus {
if !assume_bop_not_redefined(jit, ocb, STRING_REDEFINED_OP_FLAG, BOP_UMINUS) {
return CantCompile;
}

let str = jit_get_arg(jit, 0);
jit_mov_gc_ptr(jit, cb, REG0, str);

// Push the return value onto the stack
let stack_ret = ctx.stack_push(Type::CString);
mov(cb, stack_ret, REG0);
asm.mov(stack_ret, str.into());

KeepCompiling
}
*/

fn gen_opt_not(
jit: &mut JITState,
Expand Down Expand Up @@ -5965,7 +5962,7 @@ fn get_gen_fn(opcode: VALUE) -> Option<InsnGenFn> {
YARVINSN_opt_ge => Some(gen_opt_ge),
YARVINSN_opt_mod => Some(gen_opt_mod),
YARVINSN_opt_str_freeze => Some(gen_opt_str_freeze),
//YARVINSN_opt_str_uminus => Some(gen_opt_str_uminus),
YARVINSN_opt_str_uminus => Some(gen_opt_str_uminus),
YARVINSN_splatarray => Some(gen_splatarray),
YARVINSN_newrange => Some(gen_newrange),
YARVINSN_putstring => Some(gen_putstring),
Expand Down

0 comments on commit 03dd240

Please sign in to comment.