瀏覽代碼

* tcgcallparanode.secondcallparan: factored a complex condition into variable.
* tcgcallnode.pass_generate_code: call reorder_parameters also for procedure variable case, as it is done in two other control branches.

git-svn-id: trunk@28959 -

sergei 10 年之前
父節點
當前提交
bb1cec2474
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      compiler/ncgcal.pas

+ 6 - 2
compiler/ncgcal.pas

@@ -247,6 +247,7 @@ implementation
          href    : treference;
          href    : treference;
          otlabel,
          otlabel,
          oflabel : tasmlabel;
          oflabel : tasmlabel;
+         pushaddr: boolean;
       begin
       begin
          if not(assigned(parasym)) then
          if not(assigned(parasym)) then
            internalerror(200304242);
            internalerror(200304242);
@@ -304,7 +305,7 @@ implementation
                begin
                begin
                  { don't push a node that already generated a pointer type
                  { don't push a node that already generated a pointer type
                    by address for implicit hidden parameters }
                    by address for implicit hidden parameters }
-                 if (vo_is_funcret in parasym.varoptions) or
+                 pushaddr:=(vo_is_funcret in parasym.varoptions) or
                    { pass "this" in C++ classes explicitly as pointer
                    { pass "this" in C++ classes explicitly as pointer
                      because push_addr_param might not be true for them }
                      because push_addr_param might not be true for them }
                    (is_cppclass(parasym.vardef) and (vo_is_self in parasym.varoptions)) or
                    (is_cppclass(parasym.vardef) and (vo_is_self in parasym.varoptions)) or
@@ -322,7 +323,9 @@ implementation
                         )
                         )
                       ) and
                       ) and
                      paramanager.push_addr_param(parasym.varspez,parasym.vardef,
                      paramanager.push_addr_param(parasym.varspez,parasym.vardef,
-                         aktcallnode.procdefinition.proccalloption)) then
+                         aktcallnode.procdefinition.proccalloption));
+
+                 if pushaddr then
                    push_addr_para
                    push_addr_para
                  else
                  else
                    push_value_para;
                    push_value_para;
@@ -1023,6 +1026,7 @@ implementation
                 correct parameter register }
                 correct parameter register }
               if assigned(left) then
               if assigned(left) then
                 begin
                 begin
+                  reorder_parameters;
                   pushparas;
                   pushparas;
                   { free the resources allocated for the parameters }
                   { free the resources allocated for the parameters }
                   freeparas;
                   freeparas;