Browse Source

* also handle nested proc ptrs in thlcgcpu.location_force_mem on i8086

git-svn-id: trunk@25824 -
nickysn 11 years ago
parent
commit
7e7ab2fd4d
1 changed files with 15 additions and 2 deletions
  1. 15 2
      compiler/i8086/hlcgcpu.pas

+ 15 - 2
compiler/i8086/hlcgcpu.pas

@@ -55,6 +55,7 @@ implementation
     globtype,verbose,
     globtype,verbose,
     paramgr,
     paramgr,
     cpubase,cpuinfo,tgobj,cgobj,cgcpu,
     cpubase,cpuinfo,tgobj,cgobj,cgcpu,
+    defutil,
     symconst;
     symconst;
 
 
   { thlcgcpu }
   { thlcgcpu }
@@ -199,9 +200,21 @@ implementation
   procedure thlcgcpu.location_force_mem(list: TAsmList; var l: tlocation; size: tdef);
   procedure thlcgcpu.location_force_mem(list: TAsmList; var l: tlocation; size: tdef);
     var
     var
       r,tmpref: treference;
       r,tmpref: treference;
+      is_sixbyterecord: Boolean;
+      is_methodptr: Boolean;
+      is_nestedprocptr: Boolean;
     begin
     begin
-      { handle i8086 6-byte (mixed near + far) method pointers }
-      if (size.typ in [procvardef,recorddef]) and (size.size=6) and (l.loc in [LOC_REGISTER,LOC_CREGISTER]) then
+      is_sixbyterecord:=(size.typ=recorddef) and (size.size=6);
+      is_methodptr:=(size.typ=procvardef)
+        and (po_methodpointer in tprocvardef(size).procoptions)
+        and not(po_addressonly in tprocvardef(size).procoptions);
+      is_nestedprocptr:=(size.typ=procvardef)
+        and is_nested_pd(tprocvardef(size))
+        and not(po_addressonly in tprocvardef(size).procoptions);
+
+      { handle i8086 method pointers (incl. 6-byte mixed near + far),
+        6-byte records and nested proc ptrs }
+      if (is_sixbyterecord or is_methodptr or is_nestedprocptr) and (l.loc in [LOC_REGISTER,LOC_CREGISTER]) then
         begin
         begin
           tg.gethltemp(list,size,size.size,tt_normal,r);
           tg.gethltemp(list,size,size.size,tt_normal,r);
           tmpref:=r;
           tmpref:=r;