mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-30 12:50:19 +00:00
52 lines
No EOL
1.3 KiB
C#
52 lines
No EOL
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
|
|
namespace Cosmos.IL2CPU.ILOpCodes {
|
|
public class OpSwitch : ILOpCode {
|
|
public readonly int[] BranchLocations;
|
|
|
|
public OpSwitch(Code aOpCode, int aPos, int aNextPos, int[] aBranchLocations, System.Reflection.ExceptionHandlingClause aCurrentExceptionHandler)
|
|
: base(aOpCode, aPos, aNextPos, aCurrentExceptionHandler) {
|
|
BranchLocations = aBranchLocations;
|
|
}
|
|
|
|
public override int GetNumberOfStackPops()
|
|
{
|
|
switch (OpCode)
|
|
{
|
|
case Code.Switch:
|
|
return 1;
|
|
default:
|
|
throw new NotImplementedException("OpCode '" + OpCode + "' not implemented!");
|
|
}
|
|
}
|
|
|
|
public override int GetNumberOfStackPushes()
|
|
{
|
|
switch (OpCode)
|
|
{
|
|
case Code.Switch:
|
|
return 0;
|
|
default:
|
|
throw new NotImplementedException("OpCode '" + OpCode + "' not implemented!");
|
|
}
|
|
}
|
|
|
|
protected override void DoInitStackAnalysis(MethodBase aMethod)
|
|
{
|
|
base.DoInitStackAnalysis(aMethod);
|
|
|
|
switch (OpCode)
|
|
{
|
|
case Code.Switch:
|
|
StackPopTypes[0] = typeof(uint);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} |