当前位置: 首页>>代码示例>>C#>>正文


C# SigType类代码示例

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


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

示例1: CreateISRMethods

        /// <summary>
        /// Creates the ISR methods.
        /// </summary>
        /// <param name="compiler">The compiler.</param>
        private void CreateISRMethods(AssemblyCompiler compiler)
        {
            // Create Interrupt Service Routines (ISR)
            RuntimeMethod InterruptMethod = compiler.Assembly.EntryPoint; // TODO: replace with another entry point

            SigType I1 = new SigType(CilElementType.I1);
            SigType I4 = new SigType(CilElementType.I4);
            RegisterOperand eax = new RegisterOperand(I4, GeneralPurposeRegister.EAX);

            for (int i = 0; i <= 256; i++) {
                InstructionSet set = new InstructionSet(100);
                Context ctx = new Context(set, -1);

                ctx.SetInstruction(CPUx86.Instruction.CliInstruction);
                if ((i != 8) && (i < 10 || i > 14)) // For IRQ 8, 10, 11, 12, 13, 14 the cpu automatically pushed the error code
                    ctx.AppendInstruction(CPUx86.Instruction.PushInstruction, null, new ConstantOperand(I4, 0x0));
                ctx.AppendInstruction(CPUx86.Instruction.PushadInstruction);
                ctx.AppendInstruction(CPUx86.Instruction.PushInstruction, null, new ConstantOperand(I4, i));
                // TODO: Set method parameters
                ctx.AppendInstruction(CPUx86.Instruction.CallInstruction, InterruptMethod);
                ctx.AppendInstruction(CPUx86.Instruction.PopInstruction, eax);
                ctx.AppendInstruction(CPUx86.Instruction.PopadInstruction);
                ctx.AppendInstruction(CPUx86.Instruction.PopInstruction, eax);
                ctx.AppendInstruction(CPUx86.Instruction.StiInstruction);
                //ctx.AppendInstruction(CPUx86.Instruction.IRetdInstruction);

                CompilerGeneratedMethod method = LinkTimeCodeGenerator.Compile(compiler, @"InterruptISR" + i.ToString(), set);
            }
        }
开发者ID:shanebrown99,项目名称:MOSA-Project,代码行数:33,代码来源:InterruptStage.cs

示例2: ApplyGenericType

 public void ApplyGenericType(SigType[] genericArguments)
 {
     if (this.Type is VarSigType)
     {
         this.Type = genericArguments[(Type as VarSigType).Index];
     }
 }
开发者ID:illuminus86,项目名称:MOSA-Project,代码行数:7,代码来源:VariableSignature.cs

示例3: GetNull

        /// <summary>
        /// Retrieves a constant operand to represent the null-value.
        /// </summary>
        /// <returns>A new instance of <see cref="ConstantOperand"/>, that represents the null value.</returns>
        public static ConstantOperand GetNull()
        {
            if (_sObject == null)
                _sObject = new SigType(CilElementType.Object);

            return new ConstantOperand(_sObject, null);
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:11,代码来源:ConstantOperand.cs

示例4: StobjInstruction

 /// <summary>
 /// Initializes a new instance of the <see cref="StobjInstruction"/> class.
 /// </summary>
 /// <param name="opcode">The opcode.</param>
 public StobjInstruction(OpCode opcode)
     : base(opcode)
 {
     switch (opcode) {
         case OpCode.Stind_i1:
             _valueType = new SigType(CilElementType.I1);
             break;
         case OpCode.Stind_i2:
             _valueType = new SigType(CilElementType.I2);
             break;
         case OpCode.Stind_i4:
             _valueType = new SigType(CilElementType.I4);
             break;
         case OpCode.Stind_i8:
             _valueType = new SigType(CilElementType.I8);
             break;
         case OpCode.Stind_r4:
             _valueType = new SigType(CilElementType.R4);
             break;
         case OpCode.Stind_r8:
             _valueType = new SigType(CilElementType.R8);
             break;
         case OpCode.Stind_i:
             _valueType = new SigType(CilElementType.I);
             break;
         case OpCode.Stind_ref: // FIXME: Really object?
             _valueType = new SigType(CilElementType.Object);
             break;
         default:
             throw new NotImplementedException();
     }
 }
开发者ID:hj1980,项目名称:Mosa,代码行数:36,代码来源:StobjInstruction.cs

示例5: GenericInstSigType

 /// <summary>
 /// Initializes a new instance of the <see cref="GenericInstSigType"/> class.
 /// </summary>
 /// <param name="baseType">Type of the base.</param>
 /// <param name="genericArguments">The generic args.</param>
 public GenericInstSigType(TypeSigType baseType, SigType[] genericArguments)
     : base(CilElementType.GenericInst)
 {
     this.baseType = baseType;
     this.genericArguments = genericArguments;
     this.containsGenericParameters = CheckContainsOpenGenericParameters();
 }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:12,代码来源:GenericInstSigType.cs

示例6: CreateISRMethods

        /// <summary>
        /// Creates the ISR methods.
        /// </summary>
        /// <param name="compiler">The compiler.</param>
        private void CreateISRMethods(AssemblyCompiler compiler)
        {
            // Get RuntimeMethod for the Mosa.Kernel.X86.IDT.InterruptHandler
            RuntimeType rt = RuntimeBase.Instance.TypeLoader.GetType(@"Mosa.Kernel.X86.IDT");
            RuntimeMethod InterruptMethod = FindMethod(rt, "InterruptHandler");

            SigType I1 = new SigType(CilElementType.I1);
            SigType I2 = new SigType(CilElementType.I4);

            RegisterOperand ecx1 = new RegisterOperand(I1, GeneralPurposeRegister.ECX);
            RegisterOperand ecx2 = new RegisterOperand(I2, GeneralPurposeRegister.ECX);

            for (int i = 0; i <= 256; i++) {
                InstructionSet set = new InstructionSet(100);
                Context ctx = new Context(set, -1);

                ctx.AppendInstruction(CPUx86.Instruction.CliInstruction);
                ctx.AppendInstruction(CPUx86.Instruction.PushadInstruction);
                if ((i != 8) && (i < 10 || i > 14)) // For IRQ 8, 10, 11, 12, 13, 14 the cpu automatically pushed the error code
                    ctx.AppendInstruction(CPUx86.Instruction.PushInstruction, null, new ConstantOperand(I1, 0x0));
                ctx.AppendInstruction(CPUx86.Instruction.PushInstruction, null, new ConstantOperand(I2, i));
                ctx.AppendInstruction(CPUx86.Instruction.CallInstruction, InterruptMethod);
                // TODO: Replace next two instructions with add esp, 5 ;Stack clearing
                ctx.AppendInstruction(CPUx86.Instruction.PopInstruction, ecx2);
                ctx.AppendInstruction(CPUx86.Instruction.PopInstruction, ecx1);
                ctx.AppendInstruction(CPUx86.Instruction.PopadInstruction);
                ctx.AppendInstruction(CPUx86.Instruction.StiInstruction);
                ctx.AppendInstruction(CPUx86.Instruction.IRetdInstruction);

                CompilerGeneratedMethod method = LinkTimeCodeGenerator.Compile(compiler, @"InterruptISR" + i.ToString(), set);
            }
        }
开发者ID:rtownsend,项目名称:MOSA-Project,代码行数:36,代码来源:InterruptBuilderStage.cs

示例7: Validate

        /// <summary>
        /// Validates the instruction operands and creates a matching variable for the result.
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="compiler">The compiler.</param>
        public override void Validate(Context ctx, IMethodCompiler compiler)
        {
            base.Validate(ctx, compiler);

            // Validate the typecode & determine the resulting stack type
            SigType resultType;

            switch (_opcode) {
                case OpCode.Conv_u: goto case OpCode.Conv_i;
                case OpCode.Conv_i:
                    resultType = compiler.Architecture.NativeType;
                    break;

                case OpCode.Conv_i1:
                    resultType = new SigType(CilElementType.I1);
                    break;

                case OpCode.Conv_i2:
                    resultType = new SigType(CilElementType.I2);
                    break;

                case OpCode.Conv_i4:
                    resultType = new SigType(CilElementType.I4);
                    break;

                case OpCode.Conv_i8:
                    resultType = new SigType(CilElementType.I8);
                    break;

                case OpCode.Conv_r4:
                    resultType = new SigType(CilElementType.R4);
                    break;

                case OpCode.Conv_r8:
                    resultType = new SigType(CilElementType.R8);
                    break;

                case OpCode.Conv_u1:
                    resultType = new SigType(CilElementType.U1);
                    break;

                case OpCode.Conv_u2:
                    resultType = new SigType(CilElementType.U2);
                    break;

                case OpCode.Conv_u4:
                    resultType = new SigType(CilElementType.U4);
                    break;

                case OpCode.Conv_u8:
                    resultType = new SigType(CilElementType.U8);
                    break;

                default:
                    throw new NotSupportedException(@"Overflow checking conversions not supported.");
            }

            ctx.Result = compiler.CreateTemporary(resultType);
        }
开发者ID:hj1980,项目名称:Mosa,代码行数:64,代码来源:ConversionInstruction.cs

示例8: RefSigType

        /// <summary>
        /// Initializes a new instance of the <see cref="RefSigType"/> class.
        /// </summary>
        /// <param name="type">The referenced type.</param>
        public RefSigType(SigType type)
            : base(CilElementType.ByRef)
        {
            if (null == type)
                throw new ArgumentNullException(@"type");

            this.elementType = type;
        }
开发者ID:rtownsend,项目名称:MOSA-Project,代码行数:12,代码来源:RefSigType.cs

示例9: Equals

        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
        /// </returns>
        public override bool Equals(SigType other)
        {
            VarSigType vst = other as VarSigType;
            if (null == vst)
                return false;

            return (base.Equals(other) && index == vst.index);
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:15,代码来源:VarSigType.cs

示例10: Equals

        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
        /// </returns>
        public override bool Equals(SigType other)
        {
            RefSigType rst = other as RefSigType;
            if (null == rst)
                return false;

            return (base.Equals(other) && this.elementType.Matches(rst.elementType) == true);
        }
开发者ID:rtownsend,项目名称:MOSA-Project,代码行数:15,代码来源:RefSigType.cs

示例11: Equals

        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
        /// </returns>
        public override bool Equals(SigType other)
        {
            ValueTypeSigType vtst = other as ValueTypeSigType;
            if (vtst == null)
                return false;

            return (base.Equals(other) == true && _token == vtst._token);
        }
开发者ID:hj1980,项目名称:Mosa,代码行数:15,代码来源:ValueTypeSigType.cs

示例12: MemberOperand

        /// <summary>
        /// Initializes a new instance of the <see cref="MemberOperand"/> class.
        /// </summary>
        /// <param name="member">The member to reference.</param>
        /// <param name="type">The type of data held in the operand.</param>
        /// <param name="offset">The offset From the base register or absolute address to retrieve.</param>
        public MemberOperand(RuntimeMember member, SigType type, IntPtr offset)
            : base(type, null, offset)
        {
            if (member == null)
                throw new ArgumentNullException(@"member");

            this.member = member;
        }
开发者ID:rtownsend,项目名称:MOSA-Project,代码行数:14,代码来源:MemberOperand.cs

示例13: Equals

        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
        /// </returns>
        public override bool Equals(SigType other)
        {
            GenericInstSigType gist = other as GenericInstSigType;
            if (null == gist)
                return false;

            return (base.Equals(other) && _baseType == gist._baseType && SigType.Equals(_genericArgs, gist._genericArgs));
        }
开发者ID:hj1980,项目名称:Mosa,代码行数:15,代码来源:GenericInstSigType.cs

示例14: Equals

        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
        /// </returns>
        public override bool Equals(SigType other)
        {
            ClassSigType cst = other as ClassSigType;
            if (null == cst)
                return false;

            return (base.Equals(other) == true && _token == cst._token);
        }
开发者ID:rtownsend,项目名称:MOSA-Project,代码行数:15,代码来源:ClassSigType.cs

示例15: Equals

        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
        /// </returns>
        public override bool Equals(SigType other)
        {
            MVarSigType mvst = other as MVarSigType;
            if (mvst == null)
                return false;

            return (base.Equals(other) == true && index == mvst.index);
        }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:15,代码来源:MVarSigType.cs


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