@@ -340,13 +340,13 @@ pub enum YARVOpnd {
340340 SelfOpnd ,
341341
342342 // Temporary stack operand with stack index
343- StackOpnd ( u16 ) ,
343+ StackOpnd ( u8 ) ,
344344}
345345
346346impl From < Opnd > for YARVOpnd {
347347 fn from ( value : Opnd ) -> Self {
348348 match value {
349- Opnd :: Stack { idx, .. } => StackOpnd ( idx as u16 ) ,
349+ Opnd :: Stack { idx, .. } => StackOpnd ( idx. try_into ( ) . unwrap ( ) ) ,
350350 _ => unreachable ! ( "{:?} cannot be converted to YARVOpnd" , value)
351351 }
352352 }
@@ -358,11 +358,11 @@ impl From<Opnd> for YARVOpnd {
358358#[ derive( Clone , Default , PartialEq , Debug ) ]
359359pub struct Context {
360360 // Number of values currently on the temporary stack
361- stack_size : u16 ,
361+ stack_size : u8 ,
362362
363363 // Offset of the JIT SP relative to the interpreter SP
364364 // This represents how far the JIT's SP is from the "real" SP
365- sp_offset : i16 ,
365+ sp_offset : i8 ,
366366
367367 // Depth of this block in the sidechain (eg: inline-cache chain)
368368 chain_depth : u8 ,
@@ -1265,15 +1265,15 @@ impl Block {
12651265}
12661266
12671267impl Context {
1268- pub fn get_stack_size ( & self ) -> u16 {
1268+ pub fn get_stack_size ( & self ) -> u8 {
12691269 self . stack_size
12701270 }
12711271
1272- pub fn get_sp_offset ( & self ) -> i16 {
1272+ pub fn get_sp_offset ( & self ) -> i8 {
12731273 self . sp_offset
12741274 }
12751275
1276- pub fn set_sp_offset ( & mut self , offset : i16 ) {
1276+ pub fn set_sp_offset ( & mut self , offset : i8 ) {
12771277 self . sp_offset = offset;
12781278 }
12791279
@@ -1359,16 +1359,16 @@ impl Context {
13591359 }
13601360 }
13611361
1362- self . stack_size -= n as u16 ;
1363- self . sp_offset -= n as i16 ;
1362+ self . stack_size -= n as u8 ;
1363+ self . sp_offset -= n as i8 ;
13641364
13651365 return top;
13661366 }
13671367
13681368 pub fn shift_stack ( & mut self , argc : usize ) {
13691369 assert ! ( argc < self . stack_size. into( ) ) ;
13701370
1371- let method_name_index = ( self . stack_size - argc as u16 - 1 ) as usize ;
1371+ let method_name_index = ( self . stack_size as usize ) - ( argc as usize ) - 1 ;
13721372
13731373 for i in method_name_index..( self . stack_size - 1 ) as usize {
13741374
0 commit comments