@@ -121,24 +121,12 @@ impl Type {
121121
122122 /// Check if the type is an immediate
123123 pub fn is_imm ( & self ) -> bool {
124- match self {
125- Type :: UnknownImm => true ,
126- Type :: Nil => true ,
127- Type :: True => true ,
128- Type :: False => true ,
129- Type :: Fixnum => true ,
130- Type :: Flonum => true ,
131- Type :: ImmSymbol => true ,
132- _ => false ,
133- }
124+ matches ! ( self , Type :: UnknownImm | Type :: Nil | Type :: True | Type :: False | Type :: Fixnum | Type :: Flonum | Type :: ImmSymbol )
134125 }
135126
136127 /// Returns true when the type is not specific.
137128 pub fn is_unknown ( & self ) -> bool {
138- match self {
139- Type :: Unknown | Type :: UnknownImm | Type :: UnknownHeap => true ,
140- _ => false ,
141- }
129+ matches ! ( self , Type :: Unknown | Type :: UnknownImm | Type :: UnknownHeap )
142130 }
143131
144132 /// Returns true when we know the VALUE is a specific handle type,
@@ -150,17 +138,7 @@ impl Type {
150138
151139 /// Check if the type is a heap object
152140 pub fn is_heap ( & self ) -> bool {
153- match self {
154- Type :: UnknownHeap => true ,
155- Type :: TArray => true ,
156- Type :: CArray => true ,
157- Type :: THash => true ,
158- Type :: CHash => true ,
159- Type :: TString => true ,
160- Type :: CString => true ,
161- Type :: BlockParamProxy => true ,
162- _ => false ,
163- }
141+ matches ! ( self , Type :: UnknownHeap | Type :: TArray | Type :: CArray | Type :: THash | Type :: CHash | Type :: TString | Type :: CString | Type :: BlockParamProxy )
164142 }
165143
166144 /// Check if it's a T_ARRAY object (both TArray and CArray are T_ARRAY)
@@ -2510,10 +2488,12 @@ impl Context {
25102488
25112489 /// Create a new Context that is compatible with self but doesn't have type information.
25122490 pub fn get_generic_ctx ( & self ) -> Context {
2513- let mut generic_ctx = Context :: default ( ) ;
2514- generic_ctx. stack_size = self . stack_size ;
2515- generic_ctx. sp_offset = self . sp_offset ;
2516- generic_ctx. reg_mapping = self . reg_mapping ;
2491+ let mut generic_ctx = Context {
2492+ stack_size : self . stack_size ,
2493+ sp_offset : self . sp_offset ,
2494+ reg_mapping : self . reg_mapping ,
2495+ ..Default :: default ( )
2496+ } ;
25172497 if self . is_return_landing ( ) {
25182498 generic_ctx. set_as_return_landing ( ) ;
25192499 }
@@ -3233,9 +3213,7 @@ fn gen_entry_point_body(blockid: BlockId, stack_size: u8, ec: EcPtr, jit_excepti
32333213 let ( code_ptr, reg_mapping) = gen_entry_prologue ( cb, ocb, blockid, stack_size, jit_exception) ?;
32343214
32353215 // Find or compile a block version
3236- let mut ctx = Context :: default ( ) ;
3237- ctx. stack_size = stack_size;
3238- ctx. reg_mapping = reg_mapping;
3216+ let ctx = Context { stack_size, reg_mapping, ..Default :: default ( ) } ;
32393217 let block = match find_block_version ( blockid, & ctx) {
32403218 // If an existing block is found, generate a jump to the block.
32413219 Some ( blockref) => {
@@ -3359,9 +3337,7 @@ fn entry_stub_hit_body(
33593337 asm. compile ( cb, Some ( ocb) ) ?;
33603338
33613339 // Find or compile a block version
3362- let mut ctx = Context :: default ( ) ;
3363- ctx. stack_size = stack_size;
3364- ctx. reg_mapping = reg_mapping;
3340+ let ctx = Context { stack_size, reg_mapping, ..Default :: default ( ) } ;
33653341 let blockref = match find_block_version ( blockid, & ctx) {
33663342 // If an existing block is found, generate a jump to the block.
33673343 Some ( blockref) => {
0 commit comments