Exemplo n.º 1
0
        public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode)
        {
            // apparently, Roslyn changed something to the output. We now have to figure out where to jump to.
            if (aOpCode.CurrentExceptionRegion.Kind.HasFlag(ExceptionRegionKind.Finally) &&
                aOpCode.CurrentExceptionRegion.HandlerOffset > aOpCode.Position)
            {
                XS.Set(aMethod.MethodBase.GetFullName() + "_" + "LeaveAddress_" + aOpCode.CurrentExceptionRegion.HandlerOffset.ToString("X2"), Assembler.CurrentIlLabel + "." + (Assembler.AsmIlIdx + 2).ToString("X2"), destinationIsIndirect: true, size: RegisterSize.Int32);
                XS.Jump(AppAssembler.TmpPosLabel(aMethod, aOpCode.CurrentExceptionRegion.HandlerOffset));
            }

            XS.Jump(AppAssembler.TmpBranchLabel(aMethod, aOpCode));
        }
Exemplo n.º 2
0
 public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode)
 {
     ILOpCodes.OpSwitch OpSw = (ILOpCodes.OpSwitch)aOpCode;
     XS.Pop(XSRegisters.EAX);
     for (int i = 0; i < OpSw.BranchLocations.Length; i++)
     {
         XS.Compare(XSRegisters.EAX, ( uint )i);
         //string DestLabel = AssemblerNasm.TmpBranchLabel( aMethod, new ILOpCodes.OpBranch( ILOpCode.Code.Jmp, aOpCode.Position, OpSw.BranchLocations[ i ] ) );
         string xDestLabel = AppAssembler.TmpPosLabel(aMethod, OpSw.BranchLocations[i]);
         XS.Jump(CPUx86.ConditionalTestEnum.Equal, xDestLabel);
     }
 }
Exemplo n.º 3
0
 public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
 {
     // apparently, Roslyn changed something to the output. We now have to figure out where to jump to.
     if (aOpCode.CurrentExceptionHandler.Flags.HasFlag(ExceptionHandlingClauseOptions.Finally) &&
         aOpCode.CurrentExceptionHandler.HandlerOffset > aOpCode.Position)
     {
         new CPUx86.Jump {
             DestinationLabel = AppAssembler.TmpPosLabel(aMethod, aOpCode.CurrentExceptionHandler.HandlerOffset)
         };
     }
     else
     {
         new CPUx86.Jump {
             DestinationLabel = AppAssembler.TmpBranchLabel(aMethod, aOpCode)
         };
     }
 }
Exemplo n.º 4
0
        public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode)
        {
            string jumpTarget = AppAssembler.TmpBranchLabel(aMethod, aOpCode);

            // apparently, Roslyn changed something to the output. We now have to figure out where to jump to.
            if (aOpCode.CurrentExceptionRegion.Kind.HasFlag(ExceptionRegionKind.Finally) &&
                aOpCode.CurrentExceptionRegion.HandlerOffset > aOpCode.Position)
            {
                string destination = $"{aMethod.MethodBase.GetFullName()}_LeaveAddress_{aOpCode.CurrentExceptionRegion.HandlerOffset:X2}";
                string source      = AppAssembler.TmpBranchLabel(aMethod, aOpCode);
                XS.Set(destination, source, destinationIsIndirect: true, size: RegisterSize.Int32);
                XS.Jump(AppAssembler.TmpPosLabel(aMethod, aOpCode.CurrentExceptionRegion.HandlerOffset));
            }
            else
            {
                XS.Jump(jumpTarget);
            }
        }
Exemplo n.º 5
0
 public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
 {
     ILOpCodes.OpSwitch OpSw = (ILOpCodes.OpSwitch)aOpCode;
     new CPUx86.Pop {
         DestinationReg = CPUx86.Registers.EAX
     };
     for (int i = 0; i < OpSw.BranchLocations.Length; i++)
     {
         new CPUx86.Compare {
             DestinationReg = CPUx86.Registers.EAX, SourceValue = ( uint )i
         };
         //string DestLabel = AssemblerNasm.TmpBranchLabel( aMethod, new ILOpCodes.OpBranch( ILOpCode.Code.Jmp, aOpCode.Position, OpSw.BranchLocations[ i ] ) );
         string xDestLabel = AppAssembler.TmpPosLabel(aMethod, OpSw.BranchLocations[i]);
         new CPUx86.ConditionalJump {
             Condition          = CPUx86.ConditionalTestEnum.Equal
             , DestinationLabel = xDestLabel
         };
     }
 }