ソースを参照

* don't replace vmt entries of empty methods by FPC_EMPTYMETHOD
if the code is compiled for x86 and returns the result in an fpu register

git-svn-id: trunk@23304 -

florian 12 年 前
コミット
198907797b
3 ファイル変更28 行追加1 行削除
  1. 1 0
      .gitattributes
  2. 6 1
      compiler/nobj.pas
  3. 21 0
      tests/tbs/tb0588.pp

+ 1 - 0
.gitattributes

@@ -9765,6 +9765,7 @@ tests/tbs/tb0584.pp svneol=native#text/pascal
 tests/tbs/tb0585.pp svneol=native#text/pascal
 tests/tbs/tb0586.pp svneol=native#text/pascal
 tests/tbs/tb0587.pp svneol=native#text/plain
+tests/tbs/tb0588.pp svneol=native#text/pascal
 tests/tbs/tb205.pp svneol=native#text/plain
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain

+ 6 - 1
compiler/nobj.pas

@@ -114,7 +114,7 @@ implementation
        globals,verbose,systems,
        node,procinfo,
        symbase,symtable,symconst,symtype,defcmp,
-       cgbase,parabase,
+       cgbase,parabase,paramgr,
        dbgbase,
        ncgrtti,
        wpobase
@@ -1542,6 +1542,11 @@ implementation
         result:=false;
         if procdef.isempty then
           begin
+{$ifdef x86}
+            paramanager.create_funcretloc_info(procdef,calleeside);
+            if (procdef.funcretloc[calleeside].Location^.loc=LOC_FPUREGISTER) then
+              exit;
+{$endif x86}
             procdef.init_paraloc_info(calleeside);
             { we can redirect the call if no memory parameter is passed }
             for i:=0 to procdef.paras.count-1 do

+ 21 - 0
tests/tbs/tb0588.pp

@@ -0,0 +1,21 @@
+{ %opt=-O4 }
+{$mode objfpc}
+uses
+  sysutils;
+type
+  tmyclass = class
+    function f : double;virtual;
+  end;
+
+function tmyclass.f : double;
+  begin
+  end;
+
+var
+  myclass : tmyclass;
+begin
+  myclass:=tmyclass.create;
+  writeln(myclass.f+myclass.f+myclass.f);
+  myclass.free;
+  writeln('ok');
+end.