• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ITypeSystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ITypeSystem的典型用法代码示例。如果您正苦于以下问题:C# ITypeSystem类的具体用法?C# ITypeSystem怎么用?C# ITypeSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ITypeSystem类属于命名空间,在下文中一共展示了ITypeSystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: foreach

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            var result = context.Result;
            var op1 = context.Operand1;
            var op2 = context.Operand2;
            var constant = Operand.CreateConstant(BuiltInSigType.IntPtr, parameters.Count * 4);

            var eax = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.EAX); // FIXME - need access to virtual register allocator
            var edx = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.EDX); // FIXME - need access to virtual register allocator
            var esp = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.ESP); // FIXME - need access to virtual register allocator
            var ebp = Operand.CreateCPURegister(BuiltInSigType.IntPtr, GeneralPurposeRegister.EBP); // FIXME - need access to virtual register allocator
            context.SetInstruction(X86.Sub, esp, constant);
            context.AppendInstruction(X86.Mov, edx, esp);

            var size = parameters.Count * 4 + 4;
            foreach (var parameter in parameters)
            {
                context.AppendInstruction(X86.Mov, Operand.CreateMemoryAddress(BuiltInSigType.IntPtr, edx, new IntPtr(size - 4)), Operand.CreateMemoryAddress(BuiltInSigType.IntPtr, ebp, new IntPtr(size + 4)));
                size -= 4;
            }
            context.AppendInstruction(X86.Mov, Operand.CreateMemoryAddress(BuiltInSigType.IntPtr, edx, new IntPtr(size - 4)), op1);

            context.AppendInstruction(X86.Mov, eax, op2);
            context.AppendInstruction(X86.Call, null, eax);
            context.AppendInstruction(X86.Add, esp, constant);
            context.AppendInstruction(X86.Mov, result, Operand.CreateCPURegister(result.Type, GeneralPurposeRegister.EAX)); // FIXME - need access to virtual register allocator
        }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:32,代码来源:InvokeInstanceDelegateWithReturn.cs


示例2: WebFormsDefaultHandler

 public WebFormsDefaultHandler(ICommunicationContext context, ITypeSystem typeSystem, IDependencyResolver resolver)
 {
     _context = context;
     _typeSystem = typeSystem;
     _resolver = resolver;
     _pageType = typeSystem.FromClr<Page>();
 }
开发者ID:endjin,项目名称:openrasta-stable,代码行数:7,代码来源:WebFormsDefaultHandler.cs


示例3: RegisterOperand

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            var result = context.Result;
            //var op1 = context.Operand1;
            var op2 = context.Operand2;

            var eax = new RegisterOperand(BuiltInSigType.IntPtr, GeneralPurposeRegister.EAX);
            var edx = new RegisterOperand(BuiltInSigType.IntPtr, GeneralPurposeRegister.EDX);
            var esp = new RegisterOperand(BuiltInSigType.IntPtr, GeneralPurposeRegister.ESP);
            var ebp = new RegisterOperand(BuiltInSigType.IntPtr, GeneralPurposeRegister.EBP);
            context.SetInstruction(X86.Sub, esp, new ConstantOperand(BuiltInSigType.IntPtr, parameters.Count * 4));
            context.AppendInstruction(X86.Mov, edx, esp);

            var size = parameters.Count * 4;
            foreach (var parameter in parameters)
            {
                context.AppendInstruction(X86.Mov, new MemoryOperand(BuiltInSigType.IntPtr, edx.Register, new IntPtr(size - 4)), new MemoryOperand(BuiltInSigType.IntPtr, ebp.Register, new IntPtr(size + 8)));
                size -= 4;
            }

            context.AppendInstruction(X86.Mov, eax, op2);
            context.AppendInstruction(X86.Call, null, new RegisterOperand(BuiltInSigType.IntPtr, GeneralPurposeRegister.EAX));
            context.AppendInstruction(X86.Add, esp, new ConstantOperand(BuiltInSigType.IntPtr, parameters.Count * 4));
            context.AppendInstruction(X86.Mov,result, new RegisterOperand(result.Type, GeneralPurposeRegister.EAX));
        }
开发者ID:toddhainsworth,项目名称:MOSA-Project,代码行数:30,代码来源:InvokeDelegateWithReturn.cs


示例4: GetInternalAllocateStringCallTarget

        private SymbolOperand GetInternalAllocateStringCallTarget(ITypeSystem typeSystem)
        {
            RuntimeType runtimeType = typeSystem.GetType(@"Mosa.Internal.Runtime");
            RuntimeMethod callTarget = runtimeType.FindMethod(@"AllocateString");

            return SymbolOperand.FromMethod(callTarget);
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:7,代码来源:InternalAllocateString.cs


示例5: InternalTypeModule

        /// <summary>
        /// Initializes static data members of the type loader.
        /// </summary>
        /// <param name="typeSystem">The type system.</param>
        public InternalTypeModule(ITypeSystem typeSystem)
        {
            Debug.Assert(typeSystem != null);

            this.typeSystem = typeSystem;
            this.types = new List<RuntimeType>();
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:11,代码来源:InternalTypeModule.cs


示例6: DefaultModuleTypeSystem

        /// <summary>
        /// Initializes static data members of the type loader.
        /// </summary>
        /// <param name="typeSystem">The type system.</param>
        /// <param name="metadataModule">The metadata module.</param>
        public DefaultModuleTypeSystem(ITypeSystem typeSystem, IMetadataModule metadataModule)
        {
            Debug.Assert(typeSystem != null);
            Debug.Assert(metadataModule != null);
            Debug.Assert(metadataModule.Metadata != null);

            this.typeSystem = typeSystem;
            this.metadataModule = metadataModule;
            this.metadata = metadataModule.Metadata;

            methods = new RuntimeMethod[GetTableRows(TokenTypes.MethodDef)];
            fields = new RuntimeField[GetTableRows(TokenTypes.Field)];
            types = new RuntimeType[GetTableRows(TokenTypes.TypeDef)];
            parameters = new RuntimeParameter[GetTableRows(TokenTypes.Param)];

            typeSpecs = new RuntimeType[GetTableRows(TokenTypes.TypeSpec)];
            methodSpecs = new RuntimeMethod[GetTableRows(TokenTypes.MethodSpec)];

            // Load all types from the assembly into the type array
            LoadTypes();
            LoadGenerics();
            LoadTypeSpecs();
            LoadParameters();
            LoadCustomAttributes();
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:30,代码来源:DefaultModuleTypeSystem.cs


示例7: Compile

        /// <summary>
        /// Link time code generator used to compile dynamically created methods during link time.
        /// </summary>
        /// <param name="compiler">The assembly compiler used to compile this method.</param>
        /// <param name="methodName">The name of the created method.</param>
        /// <param name="instructionSet">The instruction set.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException"><paramref name="compiler"/>, <paramref name="methodName"/> or <paramref name="instructionSet"/> is null.</exception>
        /// <exception cref="System.ArgumentException"><paramref name="methodName"/> is invalid.</exception>
        public static LinkerGeneratedMethod Compile(AssemblyCompiler compiler, string methodName, InstructionSet instructionSet, ITypeSystem typeSystem)
        {
            if (compiler == null)
                throw new ArgumentNullException(@"compiler");
            if (methodName == null)
                throw new ArgumentNullException(@"methodName");
            if (methodName.Length == 0)
                throw new ArgumentException(@"Invalid method name.");

            LinkerGeneratedType compilerGeneratedType = typeSystem.InternalTypeModule.GetType(@"Mosa.Tools.Compiler", @"LinkerGenerated") as LinkerGeneratedType;

            // Create the type if we need to.
            if (compilerGeneratedType == null)
            {
                compilerGeneratedType = new LinkerGeneratedType(typeSystem.InternalTypeModule, @"Mosa.Tools.Compiler", @"LinkerGenerated", null);
                typeSystem.AddInternalType(compilerGeneratedType);
            }

            MethodSignature signature = new MethodSignature(BuiltInSigType.Void, new SigType[0]);

            // Create the method
            // HACK: <$> prevents the method from being called from CIL
            LinkerGeneratedMethod method = new LinkerGeneratedMethod(typeSystem.InternalTypeModule, "<$>" + methodName, compilerGeneratedType, signature);
            compilerGeneratedType.AddMethod(method);

            LinkerMethodCompiler methodCompiler = new LinkerMethodCompiler(compiler, compiler.Pipeline.FindFirst<ICompilationSchedulerStage>(), method, instructionSet);
            methodCompiler.Compile();
            return method;
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:38,代码来源:LinkTimeCodeGenerator.cs


示例8:

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            // Retrieve register context
            //context.SetInstruction(CPUx86.Instruction.MovInstruction, new RegisterOperand(BuiltInSigType.UInt32, GeneralPurposeRegister.EAX), Operand.CreateMemoryAddress(BuiltInSigType.UInt32, GeneralPurposeRegister.ESP, new IntPtr(28)));

            // Restore registers (Note: EAX and EDX are NOT restored!)
            //context.AppendInstruction(CPUx86.Instruction.MovInstruction, new RegisterOperand(BuiltInSigType.UInt32, GeneralPurposeRegister.EDX), Operand.CreateMemoryAddress(BuiltInSigType.UInt32, GeneralPurposeRegister.EAX, new IntPtr(28)));
            //context.AppendInstruction(CPUx86.Instruction.MovInstruction, new RegisterOperand(BuiltInSigType.UInt32, GeneralPurposeRegister.EBX), Operand.CreateMemoryAddress(BuiltInSigType.UInt32, GeneralPurposeRegister.EAX, new IntPtr(4)));
            //context.AppendInstruction(CPUx86.Instruction.MovInstruction, new RegisterOperand(BuiltInSigType.UInt32, GeneralPurposeRegister.EDI), Operand.CreateMemoryAddress(BuiltInSigType.UInt32, GeneralPurposeRegister.EAX, new IntPtr(20)));
            //context.AppendInstruction(CPUx86.Instruction.MovInstruction, new RegisterOperand(BuiltInSigType.UInt32, GeneralPurposeRegister.ESI), Operand.CreateMemoryAddress(BuiltInSigType.UInt32, GeneralPurposeRegister.EAX, new IntPtr(16)));
            //context.AppendInstruction(CPUx86.Instruction.MovInstruction, new RegisterOperand(BuiltInSigType.UInt32, GeneralPurposeRegister.ESP), Operand.CreateMemoryAddress(BuiltInSigType.UInt32, GeneralPurposeRegister.EAX, new IntPtr(32)));
            //context.AppendInstruction(CPUx86.Instruction.MovInstruction, new RegisterOperand(BuiltInSigType.UInt32, GeneralPurposeRegister.EBP), Operand.CreateMemoryAddress(BuiltInSigType.UInt32, GeneralPurposeRegister.EAX, new IntPtr(24)));

            //uint ebp, uint esp, int eip

            Operand edx = Operand.CreateCPURegister(BuiltInSigType.UInt32, GeneralPurposeRegister.EDX);
            Operand ebp = Operand.CreateCPURegister(BuiltInSigType.UInt32, GeneralPurposeRegister.EBP);
            Operand esp = Operand.CreateCPURegister(BuiltInSigType.UInt32, GeneralPurposeRegister.ESP);

            // Restore registers
            context.SetInstruction(X86.Mov, Operand.CreateCPURegister(BuiltInSigType.UInt32, GeneralPurposeRegister.ESP), context.Operand1);

            // Jmp to EIP (stored in EDX)
            context.AppendInstruction(X86.Jmp, null, edx);

            //context.SetOperand(0, edx);
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:32,代码来源:RestoreContext.cs


示例9: SimpleJitMethodCompiler

        public SimpleJitMethodCompiler(AssemblyCompiler compiler, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method, Stream codeStream, ITypeSystem typeSystem)
            : base(compiler.Pipeline.FindFirst<IAssemblyLinker>(), compiler.Architecture, compilationScheduler, type, method, typeSystem, compiler.Pipeline.FindFirst<ITypeLayout>())
        {
            if (codeStream == null)
                throw new ArgumentNullException(@"codeStream");

            this.codeStream = codeStream;
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:8,代码来源:SimpleJitMethodCompiler.cs


示例10:

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            Operand result = context.Result;

            Operand imm = Operand.CreateCPURegister(BuiltInSigType.UInt32, GeneralPurposeRegister.EAX);

            context.SetInstruction(IR.IRInstruction.Move, imm, Operand.CreateCPURegister(BuiltInSigType.UInt32, control));
            context.AppendInstruction(IR.IRInstruction.Move, result, imm);
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:14,代码来源:GetControlRegisterBase.cs


示例11: AssemblyCompiler

        /// <summary>
        /// Initializes a new compiler instance.
        /// </summary>
        /// <param name="architecture">The compiler target architecture.</param>
        /// <param name="typeSystem">The type system.</param>
        protected AssemblyCompiler(IArchitecture architecture, ITypeSystem typeSystem)
        {
            if (architecture == null)
                throw new ArgumentNullException(@"architecture");

            this.architecture = architecture;
            this.pipeline = new CompilerPipeline();
            this.typeSystem = typeSystem;
        }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:14,代码来源:AssemblyCompiler.cs


示例12: RegisterOperand

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            Operand result = context.Result;

            RegisterOperand imm = new RegisterOperand(BuiltInSigType.UInt32, GeneralPurposeRegister.EAX);

            context.SetInstruction(IR.Instruction.MoveInstruction, imm, new RegisterOperand(BuiltInSigType.UInt32, control));
            context.AppendInstruction(IR.Instruction.MoveInstruction, result, imm);
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:14,代码来源:GetControlRegisterBase.cs


示例13:

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicInternalMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            Operand callTargetOperand = this.GetInternalAllocateStringCallTarget(typeSystem);
            Operand methodTableOperand = Operand.CreateSymbol(BuiltInSigType.IntPtr, StringClassMethodTableSymbolName);
            Operand lengthOperand = context.Operand1;
            Operand result = context.Result;

            context.SetInstruction(IRInstruction.Call, result, callTargetOperand, methodTableOperand, lengthOperand);
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:14,代码来源:InternalAllocateString.cs


示例14: InternalTypeModule

        /// <summary>
        /// Initializes static data members of the type loader.
        /// </summary>
        /// <param name="typeSystem">The type system.</param>
        public InternalTypeModule(ITypeSystem typeSystem)
        {
            Debug.Assert(typeSystem != null);

            this.typeSystem = typeSystem;
            this.types = new List<RuntimeType>();
            this.methods = new List<RuntimeMethod>();
            this.typeNames = new HashSet<string>();
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:13,代码来源:InternalTypeModule.cs


示例15: ReplaceIntrinsicCall

        /// <summary>
        /// Replaces the instrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        public void ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem)
        {
            Operand result = context.Result;

            RegisterOperand imm = new RegisterOperand(new SigType(CilElementType.U4), GeneralPurposeRegister.EAX);

            context.SetInstruction(IR.Instruction.MoveInstruction, imm, new RegisterOperand(new SigType(CilElementType.U4), _control));
            context.AppendInstruction(IR.Instruction.MoveInstruction, result, imm);
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:14,代码来源:GetControlRegisterBase.cs


示例16: ReplaceIntrinsicCall

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        public void ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem)
        {
            SymbolOperand callTargetOperand = this.GetInternalAllocateStringCallTarget(typeSystem);
            SymbolOperand methodTableOperand = new SymbolOperand(BuiltInSigType.IntPtr, StringClassMethodTableSymbolName);
            Operand lengthOperand = context.Operand1;
            Operand result = context.Result;

            context.SetInstruction(IR.Instruction.CallInstruction, result, callTargetOperand, methodTableOperand, lengthOperand);
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:14,代码来源:InternalAllocateString.cs


示例17:

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            Operand result = context.Result;

            Operand tmp = Operand.CreateCPURegister(BuiltInSigType.Ptr, GeneralPurposeRegister.EDX);
            Operand operand = Operand.CreateMemoryAddress(context.Operand1.Type, GeneralPurposeRegister.EDX, new System.IntPtr(0));

            context.SetInstruction(X86.Mov, tmp, context.Operand1);
            context.AppendInstruction(X86.Mov, result, operand);
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:15,代码来源:Get.cs


示例18: RegisterOperand

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            Operand result = context.Result;

            RegisterOperand tmp = new RegisterOperand(BuiltInSigType.Ptr, GeneralPurposeRegister.EDX);
            MemoryOperand operand = new MemoryOperand(context.Operand1.Type, GeneralPurposeRegister.EDX, new System.IntPtr(0));

            context.SetInstruction(X86.Mov, tmp, context.Operand1);
            context.AppendInstruction(X86.Mov, result, operand);
        }
开发者ID:toddhainsworth,项目名称:MOSA-Project,代码行数:15,代码来源:Get.cs


示例19:

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicPlatformMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            Operand operand1 = context.Operand1;

            Operand eax = Operand.CreateCPURegister(BuiltInSigType.UInt32, GeneralPurposeRegister.EAX);
            Operand cr = Operand.CreateCPURegister(BuiltInSigType.UInt32, control);

            context.SetInstruction(IR.IRInstruction.Move, eax, operand1);
            context.AppendInstruction(IR.IRInstruction.Move, cr, eax);
        }
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:15,代码来源:SetControlRegisterBase.cs


示例20: RegisterOperand

        /// <summary>
        /// Replaces the intrinsic call site
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="typeSystem">The type system.</param>
        void IIntrinsicMethod.ReplaceIntrinsicCall(Context context, ITypeSystem typeSystem, IList<RuntimeParameter> parameters)
        {
            Operand operand1 = context.Operand1;

            RegisterOperand eax = new RegisterOperand(BuiltInSigType.UInt32, GeneralPurposeRegister.EAX);
            RegisterOperand cr = new RegisterOperand(BuiltInSigType.UInt32, control);

            context.SetInstruction(IR.Instruction.MoveInstruction, eax, operand1);
            context.AppendInstruction(IR.Instruction.MoveInstruction, cr, eax);
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:15,代码来源:SetControlRegisterBase.cs



注:本文中的ITypeSystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITypedGettersV3类代码示例发布时间:2022-05-24
下一篇:
C# ITypeSymbol类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap