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:
parent
6bf458eefd
commit
a70f90e1a9
Notes:
git
2022-11-01 18:16:52 +00:00
@ -5049,7 +5049,7 @@ fn gen_send_iseq(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create a context for the callee
|
// 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
|
// Set the argument types in the callee's context
|
||||||
for arg_idx in 0..argc {
|
for arg_idx in 0..argc {
|
||||||
@ -6870,7 +6870,7 @@ mod tests {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
JITState::new(&block),
|
JITState::new(&block),
|
||||||
Context::new(),
|
Context::default(),
|
||||||
Assembler::new(),
|
Assembler::new(),
|
||||||
CodeBlock::new_dummy(256 * 1024),
|
CodeBlock::new_dummy(256 * 1024),
|
||||||
OutlinedCb::wrap(CodeBlock::new_dummy(256 * 1024)),
|
OutlinedCb::wrap(CodeBlock::new_dummy(256 * 1024)),
|
||||||
@ -6913,18 +6913,19 @@ mod tests {
|
|||||||
asm.compile(&mut cb);
|
asm.compile(&mut cb);
|
||||||
|
|
||||||
assert_eq!(status, KeepCompiling);
|
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);
|
assert_eq!(cb.get_write_pos(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gen_pop() {
|
fn test_gen_pop() {
|
||||||
let (mut jit, _, mut asm, _cb, mut ocb) = setup_codegen();
|
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);
|
let status = gen_pop(&mut jit, &mut context, &mut asm, &mut ocb);
|
||||||
|
|
||||||
assert_eq!(status, KeepCompiling);
|
assert_eq!(status, KeepCompiling);
|
||||||
assert_eq!(context.diff(&Context::new()), 0);
|
assert_eq!(context.diff(&Context::default()), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1005,22 +1005,6 @@ impl Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Context {
|
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 {
|
pub fn get_stack_size(&self) -> u16 {
|
||||||
self.stack_size
|
self.stack_size
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user