]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/inline/inlheur/callsite.go
cmd/compile/internal/inline/inlheur: remove pkg-level call site table
[gostls13.git] / src / cmd / compile / internal / inline / inlheur / callsite.go
index 2e42cc28da8d8f5692ff7bf1d35e8949a0df07d7..7a1830fd68a335125ca31a5cf95fdab94ced115e 100644 (file)
@@ -41,19 +41,16 @@ type CallSite struct {
 // with many calls that share the same auto-generated pos.
 type CallSiteTab map[*ir.CallExpr]*CallSite
 
-// Package-level table of callsites.
-var cstab = CallSiteTab{}
-
-func GetCallSiteScore(ce *ir.CallExpr) (bool, int) {
-       cs, ok := cstab[ce]
-       if !ok {
-               return false, 0
+func GetCallSiteScore(fn *ir.Func, call *ir.CallExpr) (int, bool) {
+       if funcInlHeur, ok := fpmap[fn]; !ok {
+               return 0, false
+       } else {
+               cs, ok := funcInlHeur.cstab[call]
+               if !ok {
+                       return 0, false
+               }
+               return cs.Score, true
        }
-       return true, cs.Score
-}
-
-func CallSiteTable() CallSiteTab {
-       return cstab
 }
 
 type CSPropBits uint32