private static bool IsSimpleAccessor(IRMethod m, out int retInstrIdx)
		{
			// TODO: Allow for statics here as well.
			return
				(retInstrIdx = -1) == -1 &&
				m.ReturnType != null &&
				m.Parameters.Count == 1 &&
				m.Parameters[0].Type == m.ParentType &&
				(
					(
						m.Instructions.Count == 1 &&
						m.Instructions[0].Opcode == IROpcode.Return &&
						IsSimpleSource(m.Instructions[0].Sources[0]) &&
						(retInstrIdx = 0) == 0
					) ||
					(
						m.Instructions.Count == 2 &&
						m.Instructions[0].Opcode == IROpcode.Nop &&
						m.Instructions[1].Opcode == IROpcode.Return &&
						IsSimpleSource(m.Instructions[1].Sources[0]) &&
						(retInstrIdx = 1) == 1
					)
				)
			;	
		}
Пример #2
0
        public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
        {
                                    context.Asm("pop eax"); //value
                        context.Asm("pop ebx"); //adress
                        context.Asm("mov [ebx],  eax");

        }
Пример #3
0
		public override void Transform(IRMethod pMethod)
		{
			KnownLocalType[] locals = new KnownLocalType[pMethod.Locals.Count];
			for (int i = 0; i < pMethod.Instructions.Count; i++)
			{
				var curInstr = pMethod.Instructions[i];
				if (curInstr.Opcode == IROpcode.NewObject && curInstr.Destination.Type == IRLinearizedLocationType.Local)
				{
					locals[curInstr.Destination.Local.LocalIndex].Known = true;
					locals[curInstr.Destination.Local.LocalIndex].Type = ((IRNewObjectInstruction)curInstr).Constructor.ParentType;
				}
			}
			for (int i = 0; i < pMethod.Instructions.Count; i++)
			{
				var curInstr = pMethod.Instructions[i];
				if (curInstr.Opcode == IROpcode.Call)
				{
					var callInstr = (IRCallInstruction)curInstr;
					if (callInstr.Virtual)
					{
						if (!callInstr.Target.IsVirtual || callInstr.Target.IsFinal || callInstr.Target.ParentType.IsSealed || callInstr.Sources[0].GetTypeOfLocation().IsSealed)
						{
							callInstr.Virtual = false;
						}
						else if (callInstr.Sources[0].Type == IRLinearizedLocationType.Local && locals[callInstr.Sources[0].Local.LocalIndex].Known)
						{
							callInstr.Target = locals[callInstr.Sources[0].Local.LocalIndex].Type.VirtualMethodTree[callInstr.Target.VirtualMethodIndex];
							callInstr.Virtual = false;
						}
					}
				}
			}


		}
Пример #4
0
 public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
 {
     context.Asm($"pop eax");      // the array
     context.Asm($"pop ebx");      // the index
     context.Asm($"add eax, ebx"); // the index
     context.Asm($"push eax");     // the index
 }
Пример #5
0
Файл: Add.cs Проект: djlw78/Uskr
 public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
 {
     context.Asm("pop eax");
     context.Asm("pop ebx");
     context.Asm("add ebx, eax");
     context.Asm("push ebx");
 }
Пример #6
0
		public override void Run(IRMethod pMethod)
		{
			bool prevWasKeptNop = false;
			pMethod.Instructions.DelayedReIndexOnRemove = true;
			for (int i = 0; i < pMethod.Instructions.Count; i++)
			{
				var curInstr = pMethod.Instructions[i];
				if (curInstr.Opcode == IROpcode.Nop)
				{
					var nop = (IRNopInstruction)curInstr;
					if (!nop.ForceEmit || prevWasKeptNop)
					{
						pMethod.Instructions.Remove(nop);
						i--;
					}
					else
					{
						prevWasKeptNop = true;
					}
				}
				else
				{
					prevWasKeptNop = false;
				}
			}
			pMethod.Instructions.FixRemovedTargetInstructions();
			pMethod.Instructions.DelayedReIndexOnRemove = false;
		}
		public override void Transform(IRType type)
		{
			if (!type.IsAbstract && (type.IsGeneric || type.NestedInsideOfType != null || type.IsArrayType || type.IsManagedPointerType || type.IsUnmanagedPointerType))
			{
				if (type.VirtualMethodTree[3].ParentType != type)
				{
					// It doesn't already implement ToString() itself.
					IRMethod ts = new IRMethod(type.Assembly);
					ts.ParentType = type;
					ts.ReturnType = type.Assembly.AppDomain.System_String;
					ts.Parameters.Add(new IRParameter(type.Assembly) { ParentMethod = ts, Type = type });
					ts.VirtualMethodIndex = 3;
					var r = new IRReturnInstruction();
					r.ParentMethod = ts;
					r.Linearized = true;
					var loc = new IRLinearizedLocation(r, IRLinearizedLocationType.String);
					loc.String.Value = type.ToString();
					r.Sources.Add(loc);
					ts.Instructions.Add(r);

					ts.ParentTypeMethodIndex = type.Methods.Count;
					type.Methods.Add(ts);
					type.VirtualMethodTree[3] = ts;

					if (!ts.Resolved) // This adds it to the Domain's Methods list.
						throw new Exception();
				}
			}
		}
		private static bool IsEmptyConstructor(IRMethod m)
		{
			return 
				(
					m.Instructions.Count == 3 &&
					m.Instructions[0].Opcode == IROpcode.Call &&
					IsBaseCallInstruction(m, m.Instructions[0]) &&
					IsEmptyConstructor(((IRCallInstruction)m.Instructions[0]).Target) &&
					m.Instructions[1].Opcode == IROpcode.Nop &&
					m.Instructions[2].Opcode == IROpcode.Return
				) ||
				(
					m.Instructions.Count == 2 &&
					(
						m.Instructions[0].Opcode == IROpcode.Nop ||
						(
							m.Instructions[0].Opcode == IROpcode.Call &&
							IsBaseCallInstruction(m, m.Instructions[0]) &&
							IsEmptyConstructor(((IRCallInstruction)m.Instructions[0]).Target)
						)
					) &&
					m.Instructions[1].Opcode == IROpcode.Return
				) ||
				(
					m.Instructions.Count == 1 &&
					m.Instructions[0].Opcode == IROpcode.Return
				)
			;
		}
Пример #9
0
        public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
        {
            context.Asm("mov ebx, 0");
            context.Asm("call _" + Utils.MD5(instruction.Operand.ToString()));


            if (instruction.Operand is MethodDef md)
            {
                int size = !md.IsStatic ? 4 : 0; // non static always get the 'this' value are arg 0

                foreach (var parameter in md.Parameters)
                {
                    size += 4;
                    // context.Asm("pop ebx");
                }

                context.Asm("add esp, " + size);
                if (!md.ReturnType.FullName.Contains("Void"))
                {
                    context.Asm("push eax");
                }
            }
            else if (instruction.Operand is MemberRef mr)
            {
                if (!mr.ReturnType.FullName.Contains("Void"))
                {
                    context.Asm("push eax");
                }
            }
        }
Пример #10
0
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return(CopyTo(new IRLeaveInstruction(TargetILOffset)
     {
         TargetIRInstruction = this.TargetIRInstruction
     }, pNewMethod));
 }
 public IRLoadRuntimeHandleInstruction(IRType pTargetType, IRMethod pTargetMethod, IRField pTargetField)
     : base(IROpcode.LoadRuntimeHandle)
 {
     TargetType = pTargetType;
     TargetMethod = pTargetMethod;
     TargetField = pTargetField;
 }
		public override void Transform(IRMethod method)
		{
			method.Instructions.ImmediateRetargetModifiedInstructions = false;
			for (int i = 0; i < method.Instructions.Count; i++)
			{
				var curInstr = method.Instructions[i];
				switch (curInstr.Opcode)
				{
					case IROpcode.Unbox:
					{
						var curUBx = (Instructions.IRUnboxInstruction)curInstr;
						if (curUBx.GetValue && !curUBx.Type.IsValueType)
						{
							var c = new Instructions.IRCastInstruction(curUBx.Type, true);
							c.Sources.AddRange(curUBx.Sources);
							c.Sources.ForEach(s => s.SetParentInstruction(c));
							c.Destination = curUBx.Destination;
							c.Destination.SetParentInstruction(c);
							method.Instructions[i] = c;
						}
						break;
					}
					default:
						break;
				}
			}
			method.Instructions.FixModifiedTargetInstructions();
			method.Instructions.ImmediateRetargetModifiedInstructions = false;
		}
Пример #13
0
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return(CopyTo(new IRBranchInstruction(BranchCondition, TargetILOffset)
     {
         TargetIRInstruction = this.TargetIRInstruction
     }, pNewMethod));
 }
Пример #14
0
        public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
        {
            //fml time for vmt shit crap
            context.Asm("mov ebx, 1");
            context.Asm("call _" + Utils.MD5(instruction.Operand.ToString()));

            if (instruction.Operand is MemberRef mr)
            {
                var argsc = mr.FullName.Split('(').Last().TrimEnd(')').Split(',').Length;
                var size  = (argsc * 4);


                context.Asm("add esp, " + size);
                if (!mr.ReturnType.FullName.Contains("Void"))
                {
                    context.Asm("push eax");
                }
            }
            else if (instruction.Operand is MethodDef md)
            {
                int size = !md.IsStatic ? 4 : 0; // non static always get the 'this' value are arg 0

                foreach (var parameter in md.Parameters)
                {
                    size += 4;
                    // context.Asm("pop ebx");
                }

                context.Asm("add esp, " + size);
                if (!md.ReturnType.FullName.Contains("Void"))
                {
                    context.Asm("push eax");
                }
            }
        }
Пример #15
0
 public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
 {
     context.Asm("pop ecx");             //bits
     context.Asm("pop ebx");             //val
     context.Asm($"shr ebx, cl");
     context.Asm("push ebx");
 }
Пример #16
0
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     IRInstruction[] newTargetIRInstructions = (IRInstruction[])TargetIRInstructions.Clone();
     return(CopyTo(new IRSwitchInstruction(TargetILOffsets)
     {
         TargetIRInstructions = newTargetIRInstructions
     }, pNewMethod));
 }
Пример #17
0
 public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
 {
     context.Asm("pop eax");
     context.Asm("pop ebx");
     context.Asm($"cmp eax, ebx");
     context.Asm(
         $"jg _{Utils.MD5(meth.Namespace)}_{(instruction.Operand as Instruction).Offset}");
 }
Пример #18
0
Файл: Div.cs Проект: djlw78/Uskr
 public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
 {
     context.Asm("mov edx, 0");
     context.Asm("pop eax");
     context.Asm("pop ecx");
     context.Asm("div ecx");
     context.Asm("push eax");
 }
Пример #19
0
 public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
 {
     //@Incomplete need to do overflow cheack
     context.Asm("pop eax");
     context.Asm("pop ebx");
     context.Asm("add ebx, eax");
     context.Asm("push ebx");
 }
Пример #20
0
		public override void Transform(IRMethod method)
		{
			foreach (var instr in method.Instructions)
			{
				instr.Sources.ForEach(s => TransformLocation(s));
				if (instr.Destination != null)
					TransformLocation(instr.Destination);
			}
		}
Пример #21
0
        public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
        {
            if (meth.IsFunc)
            {
                context.Asm("pop eax");
            }

            context.Asm("leave");
            context.Asm("ret");
        }
Пример #22
0
		private static IRType ResolveSimpleReturn(IRType tp, IRMethod target)
		{
			if (tp.IsTemporaryVar)
				return target.ParentType.GenericParameters[tp.TemporaryVarOrMVarIndex];
			else if (tp.IsTemporaryMVar)
				return target.GenericParameters[tp.TemporaryVarOrMVarIndex];
			else if (tp.IsArrayType)
				return target.Assembly.AppDomain.GetArrayType(ResolveSimpleReturn(tp.ArrayElementType, target));
			else
				return tp;
		}
Пример #23
0
        public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
        {
            context.Asm($"pop eax"); // value
            context.Asm($"pop ebx"); // object pointer

            if (instruction.Operand is FieldDef fd)
            {
                context.Asm($"add ebx, {4 + fd.DeclaringType.Fields.IndexOf(fd) * 4}");
                context.Asm($"mov [ebx], eax");
            }
        }
Пример #24
0
        public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
        {
            context.Asm($"pop eax");    //index
            context.Asm($"pop ecx");    //array
            context.Asm($"add ecx, 4"); //array

            context.Asm($"mov edx, 4"); //array

            context.Asm($"mul edx");
            context.Asm($"add ecx, eax");
            context.Asm($"mov ebx, [ecx]"); //array
            context.Asm("push ebx");
        }
		private static bool IsBaseCallInstruction(IRMethod pMethod, IRInstruction instr)
		{
			if (((IRCallInstruction)instr).Target.ParentType != pMethod.ParentType.BaseType)
			{
				int i43 = 0;
				i43++;
			}
			return
				instr.Sources.Count == 1 &&
				instr.Sources[0].Type == IRLinearizedLocationType.Parameter &&
				instr.Sources[0].Parameter.ParameterIndex == 0 &&
				((IRCallInstruction)instr).Target.ParentType == pMethod.ParentType.BaseType
			;
		}
Пример #26
0
        public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
        {
            if (instruction.Operand is MethodDef md)
            {
                context.Asm($"push {4 + CalcMaxFields(md.DeclaringType) * 4}");
                context.Asm($"call _1EC80A85A7C365C7432628F0BD1DC116 ; call to kmalloc");
                context.Asm($"add esp, 4");
                context.Asm($"mov [eax], dword {context.VirtualTypes.IndexOf(md.DeclaringType)}"); //store in instance number
                context.Asm($"push eax");

                context.Asm($"call _{Utils.MD5(md.FullName)}");
                //dont add to esp here because we need to dup it any way`
            }
        }
Пример #27
0
		public override void Run(IRMethod pMethod)
		{
			pMethod.Instructions.ImmediateRetargetModifiedInstructions = false;
			for (int i = 0; i < pMethod.Instructions.Count; i++)
			{
				var curInstr = pMethod.Instructions[i];
				if (curInstr.Opcode == IROpcode.Call)
				{
					var curCall = (IRCallInstruction)curInstr;
					int retIdx;
					if (!curCall.Virtual && IsSimpleAccessor(curCall.Target, out retIdx))
					{
						if (curCall.Target.IsStatic)
						{
							var newMove = new IRMoveInstruction()
							{
								ParentMethod = pMethod,
							};
							newMove.Destination = curCall.Destination.Clone(newMove);
							var retSrc = curCall.Target.Instructions[retIdx].Sources[0];
							newMove.Sources.Add(retSrc.Clone(newMove));
							pMethod.Instructions[i] = newMove;
						}
						else
						{
							var newMove = new IRMoveInstruction()
							{
								ParentMethod = pMethod,
							};
							newMove.Destination = curCall.Destination.Clone(newMove);
							var curSrc = curCall.Sources[0];
							var retSrc = curCall.Target.Instructions[retIdx].Sources[0];
							var paramSrc = new IRLinearizedLocation(newMove, IRLinearizedLocationType.Parameter)
							{
								Parameter = new IRLinearizedLocation.ParameterLocationData()
								{
									ParameterIndex = 0,
								},
							};
							var nSrc = retSrc.Clone(newMove);
							nSrc.RetargetSource(ref nSrc, paramSrc, curSrc);
							newMove.Sources.Add(nSrc);
							pMethod.Instructions[i] = newMove;
						}
					}
				}
			}
			pMethod.Instructions.FixModifiedTargetInstructions();
			pMethod.Instructions.ImmediateRetargetModifiedInstructions = true;
		}
Пример #28
0
        public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
        {
            long size = 0;

            if (instruction.Operand is TypeDef td)
            {
                foreach (var field in td.Fields)
                {
                    size += field.GetFieldSize();
                }
            }


            context.Asm($"push {size}");
        }
Пример #29
0
Файл: Ceq.cs Проект: djlw78/Uskr
 public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
 {
     context.Asm("pop eax");
     context.Asm("pop ebx");
     context.Asm($"cmp eax, ebx");
     context.Asm(
         $"je _{Utils.MD5(meth.Namespace)}_{instruction.Offset}_f");
     context.Asm("push 0");
     context.Asm($"jmp _{Utils.MD5(meth.Namespace)}_{instruction.Offset}_t");
     context.Asm(
         $"_{Utils.MD5(meth.Namespace)}_{instruction.Offset}_f:");
     context.Asm("push 1");
     context.Asm(
         $"_{Utils.MD5(meth.Namespace)}_{instruction.Offset}_t:");
 }
Пример #30
0
        public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
        {
            var nexti = meth.Body.Instructions.IndexOf(instruction);
            var next  = meth.Body.Instructions[nexti + 1];
            var val   = instruction.GetLdcI4Value();

            switch (next.OpCode.Code)
            {
            case Code.Conv_U:
                context.Asm($"push {(uint) val}");
                break;

            default:
                context.Asm($"push {val}");
                break;
            }
        }
Пример #31
0
        public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
        {
            context.Asm($"pop edi");      // count of elements
            context.Asm($"mov eax, edi"); // count of elements


            context.Asm("mov edx, 0");
            context.Asm($"mov ecx, 4");
            context.Asm("mul ecx");
            context.Asm($"add eax, 4"); // add padding of 4 to store leng
            context.Asm("push eax");


            context.Asm($"call _1EC80A85A7C365C7432628F0BD1DC116");
            context.Asm($"sub esp, 4");
            context.Asm($"mov [eax], edi");
            context.Asm($"push eax");
        }
Пример #32
0
        private void EmmitStaticIL(IRAssembly assembly, IRMethod meth, UskrContext context)
        {
            foreach (var instruction in meth.Body.Instructions)
            {
                context.Comment();
                context.Comment(instruction.ToString());

                context.Asm($"_{Utils.MD5(meth.Namespace)}_{instruction.Offset}: ");

                if (Handlers.ContainsKey(instruction.OpCode.Code))
                {
                    Handlers[instruction.OpCode.Code].Handel(assembly, meth, context, instruction);
                }
                else
                {
                    Logger.Error($"Missing Opcode Handler: {instruction}");
                }
            }
        }
		public override void Transform(IRMethod method)
		{
			if (method.IsInternalCall)
			{
				IRInstruction added = null;
				switch (method.ToString())
				{
					case "object object::Internal_PointerToReference(void*)":
					case "void* object.Internal_ReferenceToPointer(object)":
						method.Instructions.Add(
							added = new IRReturnInstruction()
							{
								Sources = new List<IRLinearizedLocation>()
								{
									new IRLinearizedLocation(null, IRLinearizedLocationType.Parameter)
									{
										Parameter = new IRLinearizedLocation.ParameterLocationData()
										{
											ParameterIndex = 0
										}
									}
								}
							}
						);
						added.Sources[0].SetParentInstruction(added);
						added.ParentMethod = method;
						break;
					case "(null) object::Internal_FastCopy(void*, void*, int)":
						break;
					case "(null) object::Internal_FastZero(void*, int)":
						break;
					case "(null) string..ctor(string, char[])":
						break;
					case "(null) string..ctor(string, char, int)":
						break;
					default:
						throw new Exception("Unknown internal call '" + method.ToString() + "'!");
				}
			}
		}
Пример #34
0
        public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
        {
            var bytes = "";

            foreach (var c in instruction.Operand.ToString())
            {
                bytes += ((byte)c) + ",";
            }

            bytes = bytes.Trim().TrimEnd(',');

            var key  = "_" + Utils.MD5(instruction.Operand.ToString());
            var bits = BitConverter.GetBytes(instruction.Operand.ToString().Length);

            if (!context.GlobalsExtra.ContainsKey(key))
            {
                context.GlobalsExtra.Add(key,
                                         $"{bits[0]},{bits[1]},{bits[2]},{bits[3]}" + "," +
                                         bytes);
            }
            context.Asm($"push _{Utils.MD5(instruction.Operand.ToString())}");
        }
		public override void Run(IRMethod pMethod)
		{
			if (
				pMethod.Name == ".ctor" && 
				pMethod.Instructions.Count >= 3 &&
				pMethod.ParentType.BaseType != null
			)
			{
				int c = pMethod.Instructions.Count;
				int cIdx = -1;
				pMethod.Instructions.ImmediateRetargetModifiedInstructions = false;
				if (
					(
						pMethod.Instructions[c - 3].Opcode == IROpcode.Call &&
						IsBaseCallInstruction(pMethod, pMethod.Instructions[c - 3]) &&
						(cIdx = c - 3) >= 0
					) ||
					(
						pMethod.Instructions[0].Opcode == IROpcode.Call &&
						IsBaseCallInstruction(pMethod, pMethod.Instructions[0]) &&
						(cIdx = 0) >= 0
					) ||
					(
						pMethod.Instructions[c - 2].Opcode == IROpcode.Call &&
						IsBaseCallInstruction(pMethod, pMethod.Instructions[c - 2]) &&
						(cIdx = c - 2) >= 0
					)
				)
				{
					if (IsEmptyConstructor(((IRCallInstruction)pMethod.Instructions[cIdx]).Target))
					{
						pMethod.Instructions[cIdx] = new IRNopInstruction();
					}
				}
				pMethod.Instructions.FixModifiedTargetInstructions();
				pMethod.Instructions.ImmediateRetargetModifiedInstructions = true;
			}
		}
Пример #36
0
		public override void Run(IRMethod pMethod)
		{
			pMethod.Instructions.ImmediateRetargetModifiedInstructions = false;
			for (int i = 0; i < pMethod.Instructions.Count - 1; i++)
			{
				var curInstr = pMethod.Instructions[i];
				if (curInstr.Opcode == IROpcode.Branch)
				{
					var curBranchInstr = (IRBranchInstruction)curInstr;
					if (curBranchInstr.BranchCondition == IRBranchCondition.Always)
					{
						if (curBranchInstr.TargetIRInstruction.IRIndex == curBranchInstr.IRIndex + 1)
						{
							pMethod.Instructions[i] = new IRNopInstruction();
						}
						else if (curBranchInstr.TargetIRInstruction.Opcode == IROpcode.Return)
						{
							pMethod.Instructions[i] = curBranchInstr.TargetIRInstruction.Clone(pMethod);
						}
						else if (pMethod.ReturnType != null &&
							curBranchInstr.TargetIRInstruction.Opcode == IROpcode.Move &&
							curBranchInstr.TargetIRInstruction.Sources[0].Type == IRLinearizedLocationType.Local &&
							pMethod.Instructions[curBranchInstr.TargetIRInstruction.IRIndex + 1].Opcode == IROpcode.Return
						)
						{
							var r = pMethod.Instructions[curBranchInstr.TargetIRInstruction.IRIndex + 1].Clone(pMethod);
							r.Sources[0] = curBranchInstr.TargetIRInstruction.Sources[0].Clone(r);
							pMethod.Instructions[i] = r;
						}
					}
				}
			}
			pMethod.Instructions.FixModifiedTargetInstructions();
			pMethod.Instructions.ImmediateRetargetModifiedInstructions = true;
			IRAppDomain.RemoveDeadCode(pMethod);
		}
Пример #37
0
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return CopyTo(new IRLoadStringInstruction(Value), pNewMethod);
 }
Пример #38
0
		public override IRInstruction Clone(IRMethod pNewMethod) { return CopyTo(new IRSizeOfInstruction(Type), pNewMethod); }
Пример #39
0
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return(CopyTo(new IRConvertCheckedInstruction(Type, OverflowType), pNewMethod));
 }
Пример #40
0
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return CopyTo(new IRNewObjectInstruction(Constructor), pNewMethod);
 }
Пример #41
0
		public override IRInstruction Clone(IRMethod pNewMethod) { return CopyTo(new IRUnboxInstruction(Type, GetValue), pNewMethod); }
Пример #42
0
		public override IRInstruction Clone(IRMethod pNewMethod) { return CopyTo(new IRLoadLocalInstruction(LocalIndex), pNewMethod); }
Пример #43
0
 public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
 {
     context.Asm($"pop eax");
     context.Asm($"mov [_{Utils.MD5((instruction.Operand as FieldDef).FullName)}], eax");
 }
Пример #44
0
		public override IRInstruction Clone(IRMethod pNewMethod) { return CopyTo(new IRLeaveInstruction(TargetILOffset) { TargetIRInstruction = this.TargetIRInstruction }, pNewMethod); }
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return CopyTo(new IRLoadStaticFieldInstruction(Field), pNewMethod);
 }
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return CopyTo(new IRLoadTypedReferenceInstruction(Type), pNewMethod);
 }
		public override IRInstruction Clone(IRMethod pNewMethod) { return CopyTo(new IRConvertUncheckedInstruction(TargetType), pNewMethod); }
Пример #48
0
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     IRInstruction[] newTargetIRInstructions = (IRInstruction[])TargetIRInstructions.Clone();
     return CopyTo(new IRSwitchInstruction(TargetILOffsets) { TargetIRInstructions = newTargetIRInstructions }, pNewMethod);
 }
Пример #49
0
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return(CopyTo(new IRCallInstruction(Target, Virtual), pNewMethod));
 }
Пример #50
0
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return CopyTo(new IRBranchInstruction(BranchCondition, TargetILOffset) { TargetIRInstruction = this.TargetIRInstruction }, pNewMethod);
 }
Пример #51
0
		public override IRInstruction Clone(IRMethod pNewMethod) { return CopyTo(new IRCompareInstruction(CompareCondition), pNewMethod); }
Пример #52
0
		public override IRInstruction Clone(IRMethod pNewMethod) { return CopyTo(new IRAddInstruction(OverflowType), pNewMethod); }
Пример #53
0
		public override IRInstruction Clone(IRMethod pNewMethod) { return CopyTo(new IRBreakInstruction(), pNewMethod); }
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return CopyTo(new IRInitializeObjectInstruction(Type), pNewMethod);
 }
Пример #55
0
 public IRCallInstruction(IRMethod pTarget, bool pVirtual) : base(IROpcode.Call)
 {
     Target  = pTarget;
     Virtual = pVirtual;
 }
Пример #56
0
 public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
 {
     context.Asm($"mov eax, [ebp-{4 + (4 * (instruction.Operand as Local).Index)}]");
     context.Asm("push eax");
 }
Пример #57
0
 public void Handel(IRAssembly assembly, IRMethod meth, UskrContext context, Instruction instruction)
 {
     Logger.Debug($"Not Implemented: {instruction.OpCode.Code}");
     //64nit
 }
Пример #58
0
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return(CopyTo(new IRCompareInstruction(CompareCondition), pNewMethod));
 }
Пример #59
0
 public override IRInstruction Clone(IRMethod pNewMethod)
 {
     return(CopyTo(new IRBreakInstruction(), pNewMethod));
 }
Пример #60
0
 public IRNewObjectInstruction(IRMethod pConstructor)
     : base(IROpcode.NewObject)
 {
     Constructor = pConstructor;
 }