зеркало из https://github.com/github/ruby.git
YJIT: Delete redundant ways to make Context
Context::new() is the same as Context::default() and Context::new_with_stack_size() was only used in tests.
This commit is contained in:
Родитель
6bf458eefd
Коммит
a70f90e1a9
|
@ -5049,7 +5049,7 @@ fn gen_send_iseq(
|
|||
};
|
||||
|
||||
// Create a context for the callee
|
||||
let mut callee_ctx = Context::new(); // Was DEFAULT_CTX
|
||||
let mut callee_ctx = Context::default();
|
||||
|
||||
// Set the argument types in the callee's context
|
||||
for arg_idx in 0..argc {
|
||||
|
@ -6870,7 +6870,7 @@ mod tests {
|
|||
|
||||
return (
|
||||
JITState::new(&block),
|
||||
Context::new(),
|
||||
Context::default(),
|
||||
Assembler::new(),
|
||||
CodeBlock::new_dummy(256 * 1024),
|
||||
OutlinedCb::wrap(CodeBlock::new_dummy(256 * 1024)),
|
||||
|
@ -6913,18 +6913,19 @@ mod tests {
|
|||
asm.compile(&mut cb);
|
||||
|
||||
assert_eq!(status, KeepCompiling);
|
||||
assert_eq!(context.diff(&Context::new()), 0);
|
||||
assert_eq!(context.diff(&Context::default()), 0);
|
||||
assert_eq!(cb.get_write_pos(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gen_pop() {
|
||||
let (mut jit, _, mut asm, _cb, mut ocb) = setup_codegen();
|
||||
let mut context = Context::new_with_stack_size(1);
|
||||
let mut context = Context::default();
|
||||
context.stack_push(Type::Fixnum);
|
||||
let status = gen_pop(&mut jit, &mut context, &mut asm, &mut ocb);
|
||||
|
||||
assert_eq!(status, KeepCompiling);
|
||||
assert_eq!(context.diff(&Context::new()), 0);
|
||||
assert_eq!(context.diff(&Context::default()), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -1005,22 +1005,6 @@ impl Block {
|
|||
}
|
||||
|
||||
impl Context {
|
||||
pub fn new_with_stack_size(size: i16) -> Self {
|
||||
return Context {
|
||||
stack_size: size as u16,
|
||||
sp_offset: size,
|
||||
chain_depth: 0,
|
||||
local_types: [Type::Unknown; MAX_LOCAL_TYPES],
|
||||
temp_types: [Type::Unknown; MAX_TEMP_TYPES],
|
||||
self_type: Type::Unknown,
|
||||
temp_mapping: [MapToStack; MAX_TEMP_TYPES],
|
||||
};
|
||||
}
|
||||
|
||||
pub fn new() -> Self {
|
||||
return Self::new_with_stack_size(0);
|
||||
}
|
||||
|
||||
pub fn get_stack_size(&self) -> u16 {
|
||||
self.stack_size
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче