Improve assertions.

This commit is contained in:
Mike Pall
2020-06-13 00:52:54 +02:00
parent 8b55054473
commit 8ae5170cdc
71 changed files with 1363 additions and 927 deletions

View File

@@ -122,7 +122,7 @@ static int carith_ptr(lua_State *L, CTState *cts, CDArith *ca, MMS mm)
setboolV(L->top-1, ((uintptr_t)pp < (uintptr_t)pp2));
return 1;
} else {
lua_assert(mm == MM_le);
lj_assertL(mm == MM_le, "bad metamethod %d", mm);
setboolV(L->top-1, ((uintptr_t)pp <= (uintptr_t)pp2));
return 1;
}
@@ -208,7 +208,9 @@ static int carith_int64(lua_State *L, CTState *cts, CDArith *ca, MMS mm)
*up = lj_carith_powu64(u0, u1);
break;
case MM_unm: *up = (uint64_t)-(int64_t)u0; break;
default: lua_assert(0); break;
default:
lj_assertL(0, "bad metamethod %d", mm);
break;
}
lj_gc_check(L);
return 1;
@@ -301,7 +303,9 @@ uint64_t lj_carith_shift64(uint64_t x, int32_t sh, int op)
case IR_BSAR-IR_BSHL: x = lj_carith_sar64(x, sh); break;
case IR_BROL-IR_BSHL: x = lj_carith_rol64(x, sh); break;
case IR_BROR-IR_BSHL: x = lj_carith_ror64(x, sh); break;
default: lua_assert(0); break;
default:
lj_assertX(0, "bad shift op %d", op);
break;
}
return x;
}