Jelajahi Sumber

Merged revisions 10988,10991,10993-10994,10999 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r10988 | mazen | 2008-05-17 21:31:08 +0200 (Sa, 17 Mai 2008) | 2 lines

* Applied patch to fix issue with far call for sparc (bug #11312).
........
r10991 | florian | 2008-05-17 22:10:35 +0200 (Sa, 17 Mai 2008) | 2 lines

* experimental sparc interface wrapper patch
........
r10994 | florian | 2008-05-18 10:58:55 +0200 (So, 18 Mai 2008) | 2 lines

* stress testing for interface wrappers
........
r10999 | florian | 2008-05-18 13:11:30 +0200 (So, 18 Mai 2008) | 2 lines

* fix interface wrappers on sparc
........

git-svn-id: branches/fixes_2_2@11000 -

florian 17 tahun lalu
induk
melakukan
80093e5681
3 mengubah file dengan 67 tambahan dan 5 penghapusan
  1. 1 0
      .gitattributes
  2. 12 5
      compiler/sparc/cgcpu.pas
  3. 54 0
      tests/webtbs/tw11312.pp

+ 1 - 0
.gitattributes

@@ -8001,6 +8001,7 @@ tests/webtbs/tw1124.pp svneol=native#text/plain
 tests/webtbs/tw11254.pp svneol=native#text/plain
 tests/webtbs/tw11288.pp svneol=native#text/plain
 tests/webtbs/tw11290.pp svneol=native#text/plain
+tests/webtbs/tw11312.pp svneol=native#text/plain
 tests/webtbs/tw1132.pp svneol=native#text/plain
 tests/webtbs/tw1133.pp svneol=native#text/plain
 tests/webtbs/tw1152.pp svneol=native#text/plain

+ 12 - 5
compiler/sparc/cgcpu.pas

@@ -1343,14 +1343,21 @@ implementation
               Internalerror(200006139);
             { mov  0(%rdi),%rax ; load vmt}
             reference_reset_base(href,NR_O0,0);
-            cg.a_load_ref_reg(list,OS_ADDR,OS_ADDR,href,NR_L0);
+            cg.a_load_ref_reg(list,OS_ADDR,OS_ADDR,href,NR_G1);
             { jmp *vmtoffs(%eax) ; method offs }
-            reference_reset_base(href,NR_L0,procdef._class.vmtmethodoffset(procdef.extnumber));
-            list.concat(taicpu.op_ref_reg(A_LD,href,NR_L1));
-            list.concat(taicpu.op_reg(A_JMP,NR_L1));
+            reference_reset_base(href,NR_G1,procdef._class.vmtmethodoffset(procdef.extnumber));
+            list.concat(taicpu.op_ref_reg(A_LD,href,NR_G1));
+            list.concat(taicpu.op_reg(A_JMP,NR_G1));
           end
         else
-          list.concat(taicpu.op_sym(A_BA,current_asmdata.RefAsmSymbol(procdef.mangledname)));
+          begin
+            reference_reset_symbol(href,current_asmdata.RefAsmSymbol(procdef.mangledname),0);
+            href.refaddr := addr_high;
+            list.concat(taicpu.op_ref_reg(A_SETHI,href,NR_G1));
+            href.refaddr := addr_low;
+            list.concat(taicpu.op_reg_ref_reg(A_OR,NR_G1,href,NR_G1));
+            list.concat(taicpu.op_reg(A_JMP,NR_G1));
+          end;
         { Delay slot }
         list.Concat(TAiCpu.Op_none(A_NOP));
 

+ 54 - 0
tests/webtbs/tw11312.pp

@@ -0,0 +1,54 @@
+{ %opt=-O- }
+{$mode objfpc}
+type
+  ii = interface
+    procedure p1;
+    procedure p2;
+  end;
+
+  to1 = class(tinterfacedobject,ii)
+    procedure p1;virtual;
+    procedure p2;virtual;
+  end;
+
+var
+  i : longint;
+
+procedure to1.p1;
+  begin
+    inc(i);
+  end;
+
+procedure to1.p2;
+  begin
+    inc(i);
+  end;
+
+var
+  a,b,c,d,e,f,g,h : longint;
+  i1 : ii;
+begin
+  i:=0;
+  i1:=to1.create;
+  for a:=1 to 1 do
+    for b:=1 to a do
+      for c:=1 to b do
+       for d:=1 to c do
+         for e:=1 to d do
+           for f:=1 to e do
+             for g:=1 to f do
+               i1.p1;
+  if i<>1 then
+    halt(1);
+  for a:=1 to 1 do
+    for b:=1 to a do
+      for c:=1 to b do
+       for d:=1 to c do
+         for e:=1 to d do
+           for f:=1 to e do
+             for g:=1 to f do
+               i1.p2;
+  if i<>2 then
+    halt(1);
+  writeln('ok');
+end.