Browse Source

* improved heuristics for auto-inlining

git-svn-id: trunk@45328 -
florian 5 years ago
parent
commit
2a2ec77b10
1 changed files with 7 additions and 2 deletions
  1. 7 2
      compiler/psub.pas

+ 7 - 2
compiler/psub.pas

@@ -1821,8 +1821,13 @@ implementation
                                            potype_destructor,potype_class_constructor,potype_class_destructor]) and
             ((procdef.procoptions*[po_exports,po_external,po_interrupt,po_virtualmethod,po_iocheck])=[]) and
             (not(procdef.proccalloption in [pocall_safecall])) and
-            { rough approximation if we should auto inline }
-            (node_count(code)<=10) then
+            { rough approximation if we should auto inline:
+              - if the tree is simple enough
+              - if the tree is not too big
+              A bigger tree which is simpler might be autoinlined otoh
+              a smaller and complexer tree as well: so we use the sum of
+              both measures here }
+            (node_count(code)+node_complexity(code)<=25) then
           begin
             { Can we inline this procedure? }
             if checknodeinlining(procdef) then