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); } }
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); }
private void PatchDelegate() { if (Method.HasImplementation) { return; } if (!Method.DeclaringType.IsDelegate) { return; } if (!DelegatePatcher.PatchDelegate(this)) { return; } IsCILDecodeRequired = false; IsExecutePipeline = true; }