@@ -570,9 +570,9 @@ internal struct LabelInfo
570570 {
571571 public object Target ; // label target is the link between the goto and the label.
572572 public Label Label ;
573- public int ReturnVariableIndexPlusOneAndIsDefined ;
574573 public Label ReturnLabel ;
575- public int InlinedLambdaInvokeIndex ;
574+ public short ReturnVariableIndexPlusOneAndIsDefined ;
575+ public short InlinedLambdaInvokeIndex ;
576576 }
577577
578578 /// Track the info required to build a closure object + some context information not directly related to closure.
@@ -585,7 +585,7 @@ internal struct ClosureInfo
585585
586586 /// Map of the links between Labels and Goto's
587587 internal LiveCountArray < LabelInfo > Labels ;
588- internal int CurrentInlinedLambdaInvokeIndex ;
588+ internal short CurrentInlinedLambdaInvokeIndex ;
589589
590590 public ClosureStatus Status ;
591591
@@ -693,17 +693,17 @@ public void AddNestedLambda(NestedLambdaInfo nestedLambdaInfo)
693693 }
694694 }
695695
696- public int GetLabelOrInvokeIndex ( object labelTarget )
696+ public short GetLabelOrInvokeIndex ( object labelTarget )
697697 {
698698 var count = Labels . Count ;
699699 var items = Labels . Items ;
700- for ( var i = 0 ; i < count ; ++ i )
700+ for ( short i = 0 ; i < count ; ++ i )
701701 if ( items [ i ] . Target == labelTarget )
702702 return i ;
703703 return - 1 ;
704704 }
705705
706- public void AddLabel ( LabelTarget labelTarget , int inlinedLambdaInvokeIndex = - 1 )
706+ public void AddLabel ( LabelTarget labelTarget , short inlinedLambdaInvokeIndex = - 1 )
707707 {
708708 if ( GetLabelOrInvokeIndex ( labelTarget ) == - 1 )
709709 {
@@ -713,14 +713,14 @@ public void AddLabel(LabelTarget labelTarget, int inlinedLambdaInvokeIndex = -1)
713713 }
714714 }
715715
716- public int AddInlinedLambdaInvoke ( InvocationExpression e )
716+ public short AddInlinedLambdaInvoke ( InvocationExpression e )
717717 {
718718 var index = GetLabelOrInvokeIndex ( e ) ;
719719 if ( index == - 1 )
720720 {
721721 ref var label = ref Labels . PushSlot ( ) ;
722722 label . Target = e ;
723- index = Labels . Count - 1 ;
723+ index = ( short ) ( Labels . Count - 1 ) ;
724724 }
725725 return index ;
726726 }
@@ -1965,11 +1965,11 @@ public static bool TryEmit(Expression expr, IReadOnlyList<PE> paramExprs,
19651965 if ( invokeIndex == - 1 )
19661966 return false ;
19671967 ref var invokeInfo = ref closure . Labels . Items [ invokeIndex ] ;
1968- var varIndex = ( invokeInfo . ReturnVariableIndexPlusOneAndIsDefined >> 1 ) - 1 ;
1968+ var varIndex = ( short ) ( ( invokeInfo . ReturnVariableIndexPlusOneAndIsDefined >> 1 ) - 1 ) ;
19691969 if ( varIndex == - 1 )
19701970 {
1971- varIndex = il . GetNextLocalVarIndex ( gtOrLabelValue . Type ) ;
1972- invokeInfo . ReturnVariableIndexPlusOneAndIsDefined = ( varIndex + 1 ) << 1 ;
1971+ varIndex = ( short ) il . GetNextLocalVarIndex ( gtOrLabelValue . Type ) ;
1972+ invokeInfo . ReturnVariableIndexPlusOneAndIsDefined = ( short ) ( ( varIndex + 1 ) << 1 ) ;
19731973 invokeInfo . ReturnLabel = il . DefineLabel ( ) ;
19741974 }
19751975 EmitStoreLocalVariable ( il , varIndex ) ;
@@ -2246,11 +2246,11 @@ private static bool TryEmitGoto(GotoExpression expr, IReadOnlyList<PE> paramExp
22462246 // store the return expression result into the that variable
22472247 // emit OpCodes.Leave to the special label with the result which should be marked after the label to jump over its default value
22482248 ref var label = ref closure . Labels . Items [ index ] ;
2249- var varIndex = ( label . ReturnVariableIndexPlusOneAndIsDefined >> 1 ) - 1 ;
2249+ var varIndex = ( short ) ( label . ReturnVariableIndexPlusOneAndIsDefined >> 1 ) - 1 ;
22502250 if ( varIndex == - 1 )
22512251 {
22522252 varIndex = il . GetNextLocalVarIndex ( gotoValue . Type ) ;
2253- label . ReturnVariableIndexPlusOneAndIsDefined = ( varIndex + 1 ) << 1 ;
2253+ label . ReturnVariableIndexPlusOneAndIsDefined = ( short ) ( ( varIndex + 1 ) << 1 ) ;
22542254 label . ReturnLabel = il . DefineLabel ( ) ;
22552255 }
22562256 EmitStoreLocalVariable ( il , varIndex ) ;
@@ -2267,11 +2267,11 @@ private static bool TryEmitGoto(GotoExpression expr, IReadOnlyList<PE> paramExp
22672267 if ( invokeIndex == - 1 )
22682268 return false ;
22692269 ref var invokeInfo = ref closure . Labels . Items [ invokeIndex ] ;
2270- var varIndex = ( invokeInfo . ReturnVariableIndexPlusOneAndIsDefined >> 1 ) - 1 ;
2270+ var varIndex = ( short ) ( invokeInfo . ReturnVariableIndexPlusOneAndIsDefined >> 1 ) - 1 ;
22712271 if ( varIndex == - 1 )
22722272 {
22732273 varIndex = il . GetNextLocalVarIndex ( gotoValue . Type ) ;
2274- invokeInfo . ReturnVariableIndexPlusOneAndIsDefined = ( varIndex + 1 ) << 1 ;
2274+ invokeInfo . ReturnVariableIndexPlusOneAndIsDefined = ( short ) ( ( varIndex + 1 ) << 1 ) ;
22752275 invokeInfo . ReturnLabel = il . DefineLabel ( ) ;
22762276 }
22772277 EmitStoreLocalVariable ( il , varIndex ) ;
0 commit comments