Пример #1
0
        protected override void Finalization()
        {
            if (string.IsNullOrEmpty(CompilerSettings.InlinedFile))
            {
                return;
            }

            var methods = GetAndSortMethodData();

            using (var writer = new StreamWriter(CompilerSettings.InlinedFile))
            {
                writer.WriteLine("Method\tCompilations");

                foreach (var data in methods)
                {
                    writer.WriteLine($"{InlinedSetupStage.RemoveReturnValue(data.Method.FullName)}\t{data.Version}");
                }
            }
        }
Пример #2
0
        protected override void Setup()
        {
            var excludeList    = Compiler.CompilerSettings.InlineExcludeList;
            var aggressiveList = Compiler.CompilerSettings.InlineAggressiveList;

            if ((excludeList == null || excludeList.Count == 0) && (aggressiveList == null || aggressiveList.Count == 0))
            {
                return;
            }

            foreach (var type in TypeSystem.AllTypes)
            {
                foreach (var method in type.Methods)
                {
                    bool excluded = false;

                    var name = InlinedSetupStage.RemoveReturnValue(method.FullName);

                    if (excludeList != null)
                    {
                        foreach (var exclude in excludeList)
                        {
                            var match = false;

                            if (name == exclude)
                            {
                                match = true;
                            }

                            if (match)
                            {
                                var methodData = Compiler.GetMethodData(method);
                                methodData.DoNotInline = true;

                                excluded = true;
                                break;
                            }
                        }

                        if (excluded)
                        {
                            continue;
                        }
                    }

                    if (aggressiveList != null)
                    {
                        foreach (var aggressive in aggressiveList)
                        {
                            var match = false;

                            if (name == aggressive)
                            {
                                match = true;
                            }

                            if (match)
                            {
                                var methodData = Compiler.GetMethodData(method);
                                methodData.AggressiveInlineRequested = true;

                                excluded = true;
                                break;
                            }
                        }
                    }
                }
            }
        }