summaryrefslogtreecommitdiff
path: root/yjit/src/codegen.rs
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2023-02-24 06:03:59 -0800
committerGitHub <[email protected]>2023-02-24 09:03:59 -0500
commitf471f46184c1faffe29e8a5df36407fbd5fbce8d (patch)
tree21078c4628b169215e344cd688666eab3f39e980 /yjit/src/codegen.rs
parentd8d152e68105b657d089faae437a34b0ed9e1418 (diff)
YJIT: Use enum for expressing type diff (#7370)
Notes
Notes: Merged-By: maximecb <[email protected]>
Diffstat (limited to 'yjit/src/codegen.rs')
-rw-r--r--yjit/src/codegen.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index 4cd86ed91a..da87104ef6 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -292,7 +292,7 @@ fn verify_ctx(jit: &JITState, ctx: &Context) {
let self_val_type = Type::from(self_val);
// Verify self operand type
- if self_val_type.diff(ctx.get_opnd_type(SelfOpnd)) == usize::MAX {
+ if self_val_type.diff(ctx.get_opnd_type(SelfOpnd)) == TypeDiff::Incompatible {
panic!(
"verify_ctx: ctx self type ({:?}) incompatible with actual value of self {}",
ctx.get_opnd_type(SelfOpnd),
@@ -333,7 +333,7 @@ fn verify_ctx(jit: &JITState, ctx: &Context) {
}
// If the actual type differs from the learned type
- if val_type.diff(learned_type) == usize::MAX {
+ if val_type.diff(learned_type) == TypeDiff::Incompatible {
panic!(
"verify_ctx: ctx type ({:?}) incompatible with actual value on stack: {}",
learned_type,
@@ -350,7 +350,7 @@ fn verify_ctx(jit: &JITState, ctx: &Context) {
let local_val = jit.peek_at_local(i as i32);
let local_type = Type::from(local_val);
- if local_type.diff(learned_type) == usize::MAX {
+ if local_type.diff(learned_type) == TypeDiff::Incompatible {
panic!(
"verify_ctx: ctx type ({:?}) incompatible with actual value of local: {} (type {:?})",
learned_type,
@@ -1314,7 +1314,7 @@ fn guard_object_is_heap(
asm.cmp(object, Qfalse.into());
asm.je(side_exit);
- if object_type.diff(Type::UnknownHeap) != usize::MAX {
+ if object_type.diff(Type::UnknownHeap) != TypeDiff::Incompatible {
ctx.upgrade_opnd_type(object_opnd, Type::UnknownHeap);
}
}
@@ -1347,7 +1347,7 @@ fn guard_object_is_array(
asm.cmp(flags_opnd, (RUBY_T_ARRAY as u64).into());
asm.jne(side_exit);
- if object_type.diff(Type::TArray) != usize::MAX {
+ if object_type.diff(Type::TArray) != TypeDiff::Incompatible {
ctx.upgrade_opnd_type(object_opnd, Type::TArray);
}
}
@@ -8066,7 +8066,7 @@ mod tests {
asm.compile(&mut cb);
assert_eq!(status, KeepCompiling);
- assert_eq!(context.diff(&Context::default()), 0);
+ assert_eq!(context.diff(&Context::default()), TypeDiff::Compatible(0));
assert_eq!(cb.get_write_pos(), 0);
}
@@ -8078,7 +8078,7 @@ mod tests {
let status = gen_pop(&mut jit, &mut context, &mut asm, &mut ocb);
assert_eq!(status, KeepCompiling);
- assert_eq!(context.diff(&Context::default()), 0);
+ assert_eq!(context.diff(&Context::default()), TypeDiff::Compatible(0));
}
#[test]