mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-29 20:30:44 +00:00
75 lines
No EOL
1.7 KiB
C#
75 lines
No EOL
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Cosmos.IL2CPU.ILOpCodes
|
|
{
|
|
public class OpVar : ILOpCode
|
|
{
|
|
public readonly UInt16 Value;
|
|
|
|
public OpVar(Code aOpCode, int aPos, int aNextPos, UInt16 aValue, System.Reflection.ExceptionHandlingClause aCurrentExceptionHandler)
|
|
: base(aOpCode, aPos, aNextPos, aCurrentExceptionHandler)
|
|
{
|
|
Value = aValue;
|
|
}
|
|
|
|
public override int NumberOfStackPops
|
|
{
|
|
get
|
|
{
|
|
switch (OpCode)
|
|
{
|
|
case Code.Ldloc:
|
|
case Code.Ldloca:
|
|
case Code.Ldarg:
|
|
case Code.Ldarga:
|
|
return 0;
|
|
case Code.Stloc:
|
|
case Code.Starg:
|
|
return 1;
|
|
default:
|
|
throw new NotImplementedException("OpCode '" + OpCode + "' not implemented!");
|
|
}
|
|
}
|
|
}
|
|
|
|
public override int NumberOfStackPushes
|
|
{
|
|
get
|
|
{
|
|
switch (OpCode)
|
|
{
|
|
case Code.Stloc:
|
|
case Code.Starg:
|
|
return 0;
|
|
case Code.Ldloc:
|
|
case Code.Ldloca:
|
|
case Code.Ldarg:
|
|
case Code.Ldarga:
|
|
return 1;
|
|
default:
|
|
throw new NotImplementedException("OpCode '" + OpCode + "' not implemented!");
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void DoInitStackAnalysis()
|
|
{
|
|
base.DoInitStackAnalysis();
|
|
|
|
switch (OpCode)
|
|
{
|
|
case Code.Ldloca:
|
|
StackPushTypes[0] = typeof(void*);
|
|
return;
|
|
case Code.Ldarga:
|
|
StackPushTypes[0] = typeof (void*);
|
|
return;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} |