From a70f90e1a95cf4dfbaa2485767156997eb958c4b Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Tue, 1 Nov 2022 11:39:13 -0400 Subject: 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. --- yjit/src/codegen.rs | 11 ++++++----- yjit/src/core.rs | 16 ---------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index bd40af9f79..de0a2dec0f 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -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] diff --git a/yjit/src/core.rs b/yjit/src/core.rs index 9288a0188b..70a6540b5b 100644 --- a/yjit/src/core.rs +++ b/yjit/src/core.rs @@ -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 } -- cgit v1.2.3