コード例 #1
0
ファイル: MipsMethodEmiter.cs プロジェクト: mrcmunir/cspspemu
		public MipsMethodEmiter(MipsEmiter MipsEmiter, CpuProcessor Processor)
		{
			this.Processor = Processor;

			if (!InitializedOnce)
			{
				Field_GPRList = new FieldInfo[32];
				Field_FPRList = new FieldInfo[32];
				for (int n = 0; n < 32; n++)
				{
					Field_GPRList[n] = typeof(CpuThreadState).GetField("GPR" + n);
					Field_FPRList[n] = typeof(CpuThreadState).GetField("FPR" + n);
				}

				InitializedOnce = true;
			}

			UniqueCounter++;

#if USE_DYNAMIC_METHOD
			DynamicMethod = new DynamicMethod(
				"",
				typeof(void),
				new Type[] { typeof(CpuThreadState) },
				Assembly.GetExecutingAssembly().ManifestModule
			);
			ILGenerator = DynamicMethod.GetILGenerator();
#else
			TypeBuilder = MipsEmiter.ModuleBuilder.DefineType("type" + UniqueCounter, TypeAttributes.Sealed | TypeAttributes.Public);
			MethodBuilder = TypeBuilder.DefineMethod(
				name: MethodName = "method" + UniqueCounter,
				attributes: MethodAttributes.Static | MethodAttributes.Public | MethodAttributes.UnmanagedExport | MethodAttributes.Final,
				returnType: typeof(void),
				parameterTypes: new Type[] { typeof(CpuThreadState) }
			);
			ILGenerator = MethodBuilder.GetILGenerator();
#endif
		}
コード例 #2
0
        public MipsMethodEmiter(MipsEmiter MipsEmiter, CpuProcessor Processor)
        {
            this.Processor = Processor;

            if (!InitializedOnce)
            {
                Field_GPRList = new FieldInfo[32];
                Field_FPRList = new FieldInfo[32];
                for (int n = 0; n < 32; n++)
                {
                    Field_GPRList[n] = typeof(CpuThreadState).GetField("GPR" + n);
                    Field_FPRList[n] = typeof(CpuThreadState).GetField("FPR" + n);
                }

                InitializedOnce = true;
            }

            UniqueCounter++;

#if USE_DYNAMIC_METHOD
            DynamicMethod = new DynamicMethod(
                "",
                typeof(void),
                new Type[] { typeof(CpuThreadState) },
                Assembly.GetExecutingAssembly().ManifestModule
                );
            ILGenerator = DynamicMethod.GetILGenerator();
#else
            TypeBuilder          = MipsEmiter.ModuleBuilder.DefineType("type" + UniqueCounter, TypeAttributes.Sealed | TypeAttributes.Public);
            MethodBuilder        = TypeBuilder.DefineMethod(
                name: MethodName = "method" + UniqueCounter,
                attributes: MethodAttributes.Static | MethodAttributes.Public | MethodAttributes.UnmanagedExport | MethodAttributes.Final,
                returnType: typeof(void),
                parameterTypes: new Type[] { typeof(CpuThreadState) }
                );
            ILGenerator = MethodBuilder.GetILGenerator();
#endif
        }