示例#1
0
        private void PatchDelegate()
        {
            if (Method.HasImplementation)
            {
                return;
            }

            if (!Method.DeclaringType.IsDelegate)
            {
                return;
            }

            if (!DelegatePatcher.PatchDelegate(this))
            {
                return;
            }

            IsCILDecodeRequired = false;
            IsExecutePipeline   = true;

            if (Trace.IsTraceable(5))
            {
                var traceLog = new TraceLog(TraceType.MethodDebug, Method, "XX-Delegate Patched", MethodData.Version);
                traceLog?.Log("This delegate method was patched");
                Trace.PostTraceLog(traceLog);
            }
        }
示例#2
0
        public void Initialize(MosaCompiler compiler)
        {
            Compiler = compiler;

            Architecture = Compiler.CompilerOptions.Architecture;

            TypeSystem           = Compiler.TypeSystem;
            TypeLayout           = Compiler.TypeLayout;
            CompilerTrace        = Compiler.CompilerTrace;
            CompilerOptions      = Compiler.CompilerOptions;
            CompilationScheduler = Compiler.CompilationScheduler;
            Linker = compiler.Linker;

            CompilePipeline = new CompilerPipeline();
            GlobalCounters  = new Counters();
            PlugSystem      = new PlugSystem();
            CompilerData    = new CompilerData();
            DelegatePatcher = new DelegatePatcher(this);

            // Create new dictionary
            IntrinsicTypes = new Dictionary <string, Type>();

            foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (type.IsClass && typeof(IIntrinsicInternalMethod).IsAssignableFrom(type))
                {
                    // Now get all the ReplacementTarget attributes
                    var attributes = (ReplacementTargetAttribute[])type.GetCustomAttributes(typeof(ReplacementTargetAttribute), true);
                    for (int i = 0; i < attributes.Length; i++)
                    {
                        // Finally add the dictionary entry mapping the target string and the type
                        IntrinsicTypes.Add(attributes[i].Target, type);
                    }
                }
            }

            PlatformInternalRuntimeType = GetPlatformInternalRuntimeType();
            InternalRuntimeType         = GeInternalRuntimeType();

            // Extended Setup
            ExtendCompilerSetup();

            // Build the default pre-compiler pipeline
            Architecture.ExtendCompilerPipeline(CompilePipeline);
        }
示例#3
0
        private void PatchDelegate()
        {
            if (Method.HasImplementation)
            {
                return;
            }

            if (!Method.DeclaringType.IsDelegate)
            {
                return;
            }

            if (!DelegatePatcher.PatchDelegate(this))
            {
                return;
            }

            IsCILDecodeRequired = false;
            IsExecutePipeline   = true;
        }