Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromruby/ruby

Commitda01faa

Browse files
authored
ZJIT: Remove try_num_bits (ruby#14272)
1 parent3ff1ca0 commitda01faa

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

‎zjit/src/backend/lir.rs‎

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -147,26 +147,15 @@ impl Opnd
147147
}
148148
}
149149

150-
/// Return Some(Opnd) with a given num_bits if self has num_bits.
151-
/// None if self doesn't have a num_bits field.
152-
pubfntry_num_bits(&self,num_bits:u8) ->Option<Opnd>{
153-
assert!(num_bits ==8 || num_bits ==16 || num_bits ==32 || num_bits ==64);
154-
match*self{
155-
Opnd::Reg(reg) =>Some(Opnd::Reg(reg.with_num_bits(num_bits))),
156-
Opnd::Mem(Mem{ base, disp, ..}) =>Some(Opnd::Mem(Mem{ base, disp, num_bits})),
157-
Opnd::VReg{ idx, ..} =>Some(Opnd::VReg{ idx, num_bits}),
158-
_ =>None,
159-
}
160-
}
161-
162-
/// Return Opnd with a given num_bits if self has num_bits.
163-
/// Panic otherwise. This should be used only when you know which Opnd self is.
150+
/// Return Opnd with a given num_bits if self has num_bits. Panic otherwise.
164151
#[track_caller]
165152
pubfnwith_num_bits(&self,num_bits:u8) ->Opnd{
166-
ifletSome(opnd) =self.try_num_bits(num_bits){
167-
opnd
168-
}else{
169-
unreachable!("with_num_bits should not be used on: {self:?}");
153+
assert!(num_bits ==8 || num_bits ==16 || num_bits ==32 || num_bits ==64);
154+
match*self{
155+
Opnd::Reg(reg) =>Opnd::Reg(reg.with_num_bits(num_bits)),
156+
Opnd::Mem(Mem{ base, disp, ..}) =>Opnd::Mem(Mem{ base, disp, num_bits}),
157+
Opnd::VReg{ idx, ..} =>Opnd::VReg{ idx, num_bits},
158+
_ =>unreachable!("with_num_bits should not be used for: {self:?}"),
170159
}
171160
}
172161

‎zjit/src/codegen.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,8 +1183,8 @@ fn gen_guard_type(jit: &mut JITState, asm: &mut Assembler, val: lir::Opnd, guard
11831183
asm.jne(side_exit(jit, state,GuardType(guard_type)));
11841184
}elseif guard_type.is_subtype(types::StaticSymbol){
11851185
// Static symbols have (val & 0xff) == RUBY_SYMBOL_FLAG
1186-
// Use 8-bit comparison like YJIT does
1187-
debug_assert!(val.try_num_bits(8).is_some(),"GuardType should not be usedfor a knownconstant, but val was: {val:?}");
1186+
// Use 8-bit comparison like YJIT does. GuardType should not be used
1187+
//for a knownVALUE, which with_num_bits() does not support.
11881188
asm.cmp(val.with_num_bits(8),Opnd::UImm(RUBY_SYMBOL_FLAGasu64));
11891189
asm.jne(side_exit(jit, state,GuardType(guard_type)));
11901190
}elseif guard_type.is_subtype(types::NilClass){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp