diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-19 16:43:20 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:43 -0400 |
commit | 00be5846e4793b718da19dafec3f4ecf2d6d0692 (patch) | |
tree | c22f1e3bf830119d67a583f7890df9acc5c48fa3 /yjit_asm.c | |
parent | cffa1162758a67dd73da6cd911d593f67f05ea7b (diff) |
Fix non RUBY_DEBUG build warnings
On non RUBY_DEBUG builds, assert() compiles to nothing and the compiler
warns about uninitialized variables in those code paths. Replace
those asserts with rb_bug() to fix the warnings and do the assert in
all builds. Since yjit_asm_tests.c compiles outside of Ruby, it needed
a distinct version of rb_bug().
Also put YJIT_STATS check for function delcaration that is only defined
in YJIT_STATS builds.
Diffstat (limited to 'yjit_asm.c')
-rw-r--r-- | yjit_asm.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/yjit_asm.c b/yjit_asm.c index 15da7a37a1..5e433f5ea4 100644 --- a/yjit_asm.c +++ b/yjit_asm.c @@ -78,7 +78,7 @@ x86opnd_t mem_opnd_sib(uint32_t num_bits, x86opnd_t base_reg, x86opnd_t index_re scale_exp = 0; break; default: - assert(false && "scale not one of 1,2,4,8"); + rb_bug("yjit: scale not one of 1,2,4,8"); break; } @@ -466,7 +466,7 @@ static bool rex_needed(x86opnd_t opnd) return (opnd.as.mem.base_reg_no > 7) || (opnd.as.mem.has_idx && opnd.as.mem.idx_reg_no > 7); } - assert (false); + rb_bug("unreachable"); } // Check if an SIB byte is needed to encode this operand @@ -643,7 +643,7 @@ static void cb_write_rm( else if (dsize == 32) mod = 2; else - assert (false); + rb_bug("unreachable"); } // Encode the reg field @@ -726,7 +726,7 @@ static void write_rm_unary( if (opnd.type == OPND_REG || opnd.type == OPND_MEM) opndSize = opnd.num_bits; else - assert (false && "invalid operand"); + rb_bug("yjit: invalid operand"); assert (opndSize == 8 || opndSize == 16 || opndSize == 32 || opndSize == 64); bool szPref = opndSize == 16; @@ -856,7 +856,7 @@ static void cb_write_shift( if (opnd0.type == OPND_REG || opnd0.type == OPND_MEM) opndSize = opnd0.num_bits; else - assert (false && "shift: invalid first operand"); + rb_bug("yjit: shift: invalid first operand"); assert (opndSize == 16 || opndSize == 32 || opndSize == 64); bool szPref = opndSize == 16; |