本文整理汇总了C#中IInstructionDecoder.DecodeTokenType方法的典型用法代码示例。如果您正苦于以下问题:C# IInstructionDecoder.DecodeTokenType方法的具体用法?C# IInstructionDecoder.DecodeTokenType怎么用?C# IInstructionDecoder.DecodeTokenType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInstructionDecoder
的用法示例。
在下文中一共展示了IInstructionDecoder.DecodeTokenType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 base classes first
base.Decode(ctx, decoder);
// Load the _stackFrameIndex token from the immediate
TokenTypes token = decoder.DecodeTokenType();
//Console.WriteLine("Stfld used in {0}.{1}", decoder.Method.DeclaringType.FullName, decoder.Method.Name);
Debug.Assert(TokenTypes.Field == (TokenTypes.TableMask & token) || TokenTypes.MemberRef == (TokenTypes.TableMask & token), @"Invalid token type.");
ctx.RuntimeField = decoder.ModuleTypeSystem.GetField(token);
if (ctx.RuntimeField.ContainsGenericParameter)
{
foreach (RuntimeField field in decoder.Method.DeclaringType.Fields)
if (field.Name == ctx.RuntimeField.Name)
{
ctx.RuntimeField = field;
break;
}
Debug.Assert(!ctx.RuntimeField.ContainsGenericParameter);
}
}
示例2: 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)
{
base.Decode(ctx, decoder);
Token token = decoder.DecodeTokenType();
ctx.RuntimeField = decoder.Method.Module.GetField(token);
// FIXME: Can this be put into a re-used method?
if (ctx.RuntimeField.ContainsGenericParameter || ctx.RuntimeField.DeclaringType.ContainsOpenGenericParameters)
{
foreach (var field in decoder.Method.DeclaringType.Fields)
{
if (field.Name == ctx.RuntimeField.Name)
{
ctx.RuntimeField = field;
break;
}
}
if (ctx.RuntimeField.ContainsGenericParameter)
{
ctx.RuntimeField = decoder.GenericTypePatcher.PatchField(decoder.TypeModule, decoder.Method.DeclaringType as CilGenericType, ctx.RuntimeField);
}
decoder.Compiler.Scheduler.TrackFieldReferenced(ctx.RuntimeField);
Debug.Assert(!ctx.RuntimeField.ContainsGenericParameter);
}
SigType sigType = new RefSigType(ctx.RuntimeField.SignatureType);
ctx.Result = LoadInstruction.CreateResultOperand(decoder, Operand.StackTypeFromSigType(sigType), sigType);
}
示例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);
Token token = decoder.DecodeTokenType();
ITypeModule module = null;
Mosa.Runtime.TypeSystem.Generic.CilGenericType genericType = decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType;
if (genericType != null)
module = (decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType).BaseGenericType.Module;
else
module = decoder.Method.Module;
ctx.RuntimeField = module.GetField(token);
if (ctx.RuntimeField.ContainsGenericParameter)
{
foreach (RuntimeField field in decoder.Method.DeclaringType.Fields)
if (field.Name == ctx.RuntimeField.Name)
{
ctx.RuntimeField = field;
break;
}
Debug.Assert(!ctx.RuntimeField.ContainsGenericParameter);
}
SigType sigType = ctx.RuntimeField.SignatureType;
ctx.Result = LoadInstruction.CreateResultOperand(decoder, Operand.StackTypeFromSigType(sigType), sigType);
}
示例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);
// Load the _stackFrameIndex token from the immediate
Token token = decoder.DecodeTokenType();
//Console.WriteLine("Stfld used in {0}.{1}", decoder.Method.DeclaringType.FullName, decoder.Method.Name);
Debug.Assert(token.Table == TableType.Field || token.Table == TableType.MemberRef, @"Invalid token type.");
ITypeModule module = null;
Mosa.Runtime.TypeSystem.Generic.CilGenericType genericType = decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType;
if (genericType != null)
module = (decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType).BaseGenericType.Module;
else
module = decoder.Method.Module;
ctx.RuntimeField = module.GetField(token);
if (ctx.RuntimeField.ContainsGenericParameter)
{
foreach (RuntimeField field in decoder.Method.DeclaringType.Fields)
if (field.Name == ctx.RuntimeField.Name)
{
ctx.RuntimeField = field;
break;
}
Debug.Assert(!ctx.RuntimeField.ContainsGenericParameter);
}
}
示例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);
// Retrieve the provider token to check against
TokenTypes token = decoder.DecodeTokenType();
ctx.Result = decoder.Compiler.CreateTemporary(new ClassSigType(token));
}
示例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);
// Retrieve the provider token to check against
Token token = decoder.DecodeTokenType();
ctx.Other = decoder.TypeModule.GetType(token);
}
示例7: 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);
// Retrieve the type reference
Token token = decoder.DecodeTokenType();
decoder.TypeModule.GetType(token);
}
示例8: 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);
// Retrieve a type reference from the immediate argument
// FIXME: Limit the token types
Token token = decoder.DecodeTokenType();
throw new NotImplementedException();
}
示例9: 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);
Token token = decoder.DecodeTokenType();
//RuntimeType type = decoder.TypeModule.GetType(token);
ctx.Result = decoder.Compiler.CreateTemporary(new ClassSigType(token));
}
示例10: 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);
TokenTypes token = decoder.DecodeTokenType();
RuntimeType type = decoder.ModuleTypeSystem.GetType(token);
ctx.Result = decoder.Compiler.CreateTemporary(new ClassSigType(token));
//throw new NotImplementedException();
}
示例11: 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);
// Retrieve the type token
Token token = decoder.DecodeTokenType();
ctx.Other = decoder.TypeModule.GetType (token);
/*
_constraint = MetadataTypeReference.FromToken(decoder.Metadata, token);
Debug.Assert(null != _constraint);
*/
}
示例12: 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);
Token token = decoder.DecodeTokenType();
RuntimeType type = decoder.TypeModule.GetType(token);
uint size = (uint)decoder.Compiler.TypeLayout.GetTypeSize(type);
ctx.Result = new Operands.ConstantOperand(BuiltInSigType.UInt32, size);
}
示例13: 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);
// Read the fn token
Token token = decoder.DecodeTokenType();
ctx.Result = decoder.Compiler.CreateVirtualRegister(BuiltInSigType.IntPtr);
ctx.InvokeTarget = decoder.TypeModule.GetMethod(token);
decoder.Compiler.Scheduler.TrackMethodInvoked(ctx.InvokeTarget);
}
示例14: 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);
// Load the string value, it's a token
TokenTypes token = decoder.DecodeTokenType();
token |= TokenTypes.UserString;
// Set the result
ctx.Token = token;
ctx.Result = decoder.Compiler.CreateTemporary(BuiltInSigType.String);
}
示例15: 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);
// Retrieve the type token
TokenTypes token = decoder.DecodeTokenType();
throw new NotImplementedException();
/*
_constraint = MetadataTypeReference.FromToken(decoder.Metadata, token);
Debug.Assert(null != _constraint);
*/
}