diff options
| author | Alan Wu <XrXr@users.noreply.github.com> | 2021-03-03 18:06:49 -0500 |
|---|---|---|
| committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:30 -0400 |
| commit | eccf4bcd91c2f10b156f07187267040f866e6a0f (patch) | |
| tree | 1a92de2dc774b2af96aad076da0e6e98852e0124 /ujit_codegen.c | |
| parent | 8302eb57b0492a5ebd021536f0f3a00b95694bf8 (diff) | |
uJIT: support 64 bit operands for TEST. Use it to check for zero
It's one byte shorter than `cmp reg64, 0`. To illustrate:
```
48 83 f9 00 cmp rcx, 0x0
48 85 c9 test rcx, rcx
```
Diffstat (limited to 'ujit_codegen.c')
| -rw-r--r-- | ujit_codegen.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ujit_codegen.c b/ujit_codegen.c index e1bf8d85b7..db8b48a2e8 100644 --- a/ujit_codegen.c +++ b/ujit_codegen.c @@ -1132,7 +1132,7 @@ jit_protected_guard(jitstate_t *jit, codeblock_t *cb, const rb_callable_method_e // VALUE rb_obj_is_kind_of(VALUE obj, VALUE klass); call_ptr(cb, REG0, (void *)&rb_obj_is_kind_of); ujit_load_regs(cb); - cmp(cb, RAX, imm_opnd(0)); + test(cb, RAX, RAX); jz_ptr(cb, COUNTED_EXIT(side_exit, oswb_se_protected_check_failed)); } @@ -1668,7 +1668,7 @@ gen_leave(jitstate_t* jit, ctx_t* ctx) // If the return address is NULL, fall back to the interpreter int FALLBACK_LABEL = cb_new_label(cb, "FALLBACK"); - cmp(cb, REG1, imm_opnd(0)); + test(cb, REG1, REG1); jz_label(cb, FALLBACK_LABEL); // Jump to the JIT return address |
