コード例 #1
0
        private PerMethodInfo GetOrCreateInfo(MethodDesc md)
        {
            if (!_methodInf.TryGetValue(md, out PerMethodInfo pmi))
            {
                MethodIL il =
                    md switch
                {
                    EcmaMethod em => EcmaMethodIL.Create(em),
                    _ => new InstantiatedMethodIL(md, EcmaMethodIL.Create((EcmaMethod)md.GetTypicalMethodDefinition())),
                };

                if (il == null)
                {
                    return(null);
                }

                _methodInf.Add(md, pmi = new PerMethodInfo());
                pmi.IL        = il;
                pmi.FlowGraph = FlowGraph.Create(il);
                pmi.Profile   = new SampleProfile(pmi.IL, pmi.FlowGraph);
            }

            return(pmi);
        }