/// <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(InstructionNode ctx, IInstructionDecoder decoder) { // Decode base classes first base.Decode(ctx, decoder); // Opcode specific handling int index; switch (opcode) { case OpCode.Ldloc: case OpCode.Ldloc_s: index = (int)decoder.Instruction.Operand; break; case OpCode.Ldloc_0: index = 0; break; case OpCode.Ldloc_1: index = 1; break; case OpCode.Ldloc_2: index = 2; break; case OpCode.Ldloc_3: index = 3; break; default: throw new InvalidMetadataException(); } // Push the loaded value onto the evaluation stack var local = decoder.Compiler.GetLocalOperand(index); var result = LoadInstruction.CreateResultOperand(decoder, local.Type); ctx.Operand1 = local; ctx.Result = result; }
/// <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(InstructionNode ctx, IInstructionDecoder decoder) { base.Decode(ctx, decoder); var field = (MosaField)decoder.Instruction.Operand; decoder.Compiler.Scheduler.TrackFieldReferenced(field); ctx.MosaField = field; ctx.Result = LoadInstruction.CreateResultOperand(decoder, field.FieldType.ToManagedPointer()); }
/// <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(InstructionNode ctx, IInstructionDecoder decoder) { // Decode base classes first base.Decode(ctx, decoder); MosaType type = (elementType == null) ? type = (MosaType)decoder.Instruction.Operand : type = decoder.TypeSystem.GetTypeFromTypeCode(elementType.Value); ctx.Result = LoadInstruction.CreateResultOperand(decoder, type); }
public override void Decode(InstructionNode ctx, IInstructionDecoder decoder) { // Decode base classes first base.Decode(ctx, decoder); var type = (MosaType)decoder.Instruction.Operand; //Operand result = decoder.Compiler.CreateVirtualRegister(type); //ctx.Result = result; ctx.Result = LoadInstruction.CreateResultOperand(decoder, type); ctx.MosaType = type; }
/// <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(InstructionNode ctx, IInstructionDecoder decoder) { // Decode base classes first base.Decode(ctx, decoder); var field = (MosaField)decoder.Instruction.Operand; decoder.Compiler.Scheduler.TrackFieldReferenced(field); ctx.MosaField = field; ctx.Result = LoadInstruction.CreateResultOperand(decoder, field.FieldType); }
/// <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(InstructionNode ctx, IInstructionDecoder decoder) { // Decode base classes first base.Decode(ctx, decoder); MosaType type = (elementType == null) ? type = (MosaType)decoder.Instruction.Operand : type = decoder.TypeSystem.GetTypeFromTypeCode(elementType.Value); // Push the loaded value ctx.Result = LoadInstruction.CreateResultOperand(decoder, type); ctx.MosaType = type; //System.Diagnostics.Debug.WriteLine(decoder.Method.FullName); //temp - remove me }