本文整理汇总了C#中IInstructionDecoder.DecodeUShort方法的典型用法代码示例。如果您正苦于以下问题:C# IInstructionDecoder.DecodeUShort方法的具体用法?C# IInstructionDecoder.DecodeUShort怎么用?C# IInstructionDecoder.DecodeUShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInstructionDecoder
的用法示例。
在下文中一共展示了IInstructionDecoder.DecodeUShort方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(Context ctx, IInstructionDecoder decoder)
{
// Decode the base first
base.Decode(ctx, decoder);
ushort argIdx;
// Opcode specific handling
if (opcode == OpCode.Starg_s)
{
byte arg = decoder.DecodeByte();
argIdx = arg;
}
else
{
argIdx = decoder.DecodeUShort();
}
// The argument is the result
ctx.Result = decoder.Compiler.GetParameterOperand(argIdx);
// FIXME: Do some type compatibility checks
// See verification for this instruction and
// verification types.
}
示例2: Decode
/// <summary>
/// Decodes the specified CIL instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
/// <remarks>
/// This method is used by instructions to retrieve immediate operands
/// From the instruction stream.
/// </remarks>
public override void Decode(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
ushort argIdx;
// Opcode specific handling
switch (opcode)
{
case OpCode.Ldarg:
argIdx = decoder.DecodeUShort();
break;
case OpCode.Ldarg_s:
argIdx = decoder.DecodeByte();
break;
case OpCode.Ldarg_0:
argIdx = 0;
break;
case OpCode.Ldarg_1:
argIdx = 1;
break;
case OpCode.Ldarg_2:
argIdx = 2;
break;
case OpCode.Ldarg_3:
argIdx = 3;
break;
default:
throw new System.NotImplementedException();
}
// Push the loaded value onto the evaluation stack
Operand parameterOperand = decoder.Compiler.GetParameterOperand(argIdx);
Operand result = LoadInstruction.CreateResultOperand(decoder, parameterOperand.StackType, parameterOperand.Type);
ctx.Operand1 = parameterOperand;
ctx.Result = result;
}
示例3: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
// Opcode specific handling
ushort locIdx;
switch (opcode)
{
case OpCode.Ldloc:
locIdx = decoder.DecodeUShort();
break;
case OpCode.Ldloc_s:
locIdx = decoder.DecodeByte();
break;
case OpCode.Ldloc_0:
locIdx = 0;
break;
case OpCode.Ldloc_1:
locIdx = 1;
break;
case OpCode.Ldloc_2:
locIdx = 2;
break;
case OpCode.Ldloc_3:
locIdx = 3;
break;
default:
throw new System.NotImplementedException();
}
// Push the loaded value onto the evaluation stack
Operand localVariableOperand = decoder.Compiler.GetLocalOperand(locIdx);
Operand result = LoadInstruction.CreateResultOperand(decoder, localVariableOperand.StackType, localVariableOperand.Type);
ctx.Operand1 = localVariableOperand;
ctx.Result = result;
}
示例4: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
ushort locIdx;
// Destination depends on the opcode
switch (opcode)
{
case OpCode.Stloc:
locIdx = decoder.DecodeUShort();
break;
case OpCode.Stloc_s:
{
byte loc = decoder.DecodeByte();
locIdx = loc;
break;
}
case OpCode.Stloc_0:
locIdx = 0;
break;
case OpCode.Stloc_1:
locIdx = 1;
break;
case OpCode.Stloc_2:
locIdx = 2;
break;
case OpCode.Stloc_3:
locIdx = 3;
break;
default:
throw new NotImplementedException();
}
ctx.Result = decoder.Compiler.GetLocalOperand(locIdx);
}
示例5: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
ushort argIdx;
// Opcode specific handling
if (opcode == OpCode.Ldarga_s)
{
argIdx = decoder.DecodeByte();
}
else
{
argIdx = decoder.DecodeUShort();
}
Operand parameterOperand = decoder.Compiler.GetParameterOperand(argIdx);
ctx.Operand1 = parameterOperand;
ctx.Result = decoder.Compiler.CreateTemporary(new RefSigType(parameterOperand.Type));
}
示例6: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
ushort locIdx;
// Opcode specific handling
if (opcode == OpCode.Ldloca_s)
{
byte loc = decoder.DecodeByte();
locIdx = loc;
}
else
{
locIdx = decoder.DecodeUShort();
}
Operand localVariableOperand = decoder.Compiler.GetLocalOperand(locIdx);
ctx.Operand1 = localVariableOperand;
ctx.Result = decoder.Compiler.CreateTemporary(new RefSigType(localVariableOperand.Type));
}