Browse Source

* some more generic calling stuff fixed

florian 23 years ago
parent
commit
15b9d096f9
3 changed files with 51 additions and 26 deletions
  1. 9 9
      compiler/ncgcal.pas
  2. 5 3
      compiler/paramgr.pas
  3. 37 14
      compiler/powerpc/cpubase.pas

+ 9 - 9
compiler/ncgcal.pas

@@ -61,7 +61,7 @@ implementation
       gdb,
 {$endif GDB}
       cginfo,cgbase,pass_2,
-      cpubase,aasmbase,aasmtai,aasmcpu,
+      cpuinfo,cpubase,aasmbase,aasmtai,aasmcpu,
       nmem,nld,ncnv,
       ncgutil,cga,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu;
 
@@ -1112,7 +1112,6 @@ implementation
          testregisters32;
 {$endif TEMPREGDEBUG}
 
-{$ifdef dummy}
          { a constructor could be a function with boolean result }
          { if calling constructor called fail we
            must jump directly to quickexitlabel  PM
@@ -1124,7 +1123,7 @@ implementation
             (methodpointer.nodetype=typen) and
             (aktprocdef.proctypeoption=potype_constructor) then
            begin
-             emitjmp(C_Z,faillabel);
+              cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,accumulator,faillabel);
            end;
 
          { call to AfterConstruction? }
@@ -1136,12 +1135,12 @@ implementation
            (methodpointer.nodetype<>typen) then
            begin
               getlabel(constructorfailed);
-              emitjmp(C_Z,constructorfailed);
-              cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,1);
+              cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,self_pointer_reg,constructorfailed);
+              cg.a_param_reg(exprasmlist,OS_ADDR,accumulator,paramanager.getintparaloc(1));
               reference_reset_base(href,self_pointer_reg,0);
               tmpreg:=cg.get_scratch_reg_address(exprasmlist);
               cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,tmpreg);
-              reference_reset_base(href,tmpreg,68);
+              reference_reset_base(href,tmpreg,17*pointer_size);
               cg.a_call_ref(exprasmlist,href);
               cg.free_scratch_reg(exprasmlist,tmpreg);
               exprasmList.concat(tai_regalloc.Alloc(accumulator));
@@ -1149,7 +1148,6 @@ implementation
               cg.a_load_reg_reg(exprasmlist,OS_ADDR,self_pointer_reg,accumulator);
            end;
 
-{$endif dummy}
          { handle function results }
          if (not is_void(resulttype.def)) then
           begin
@@ -1501,7 +1499,9 @@ begin
 end.
 {
   $Log$
-  Revision 1.1  2002-07-11 14:41:28  florian
-    * start of the new generic parameter handling
+  Revision 1.2  2002-07-13 19:38:43  florian
+    * some more generic calling stuff fixed
 
+  Revision 1.1  2002/07/11 14:41:28  florian
+    * start of the new generic parameter handling
 }

+ 5 - 3
compiler/paramgr.pas

@@ -132,10 +132,12 @@ end.
 
 {
    $Log$
-   Revision 1.2  2002-07-13 07:17:15  jonas
+   Revision 1.3  2002-07-13 19:38:43  florian
+     * some more generic calling stuff fixed
+
+   Revision 1.2  2002/07/13 07:17:15  jonas
      * fixed memory leak reported by  Sergey Korshunoff
 
    Revision 1.1  2002/07/11 14:41:28  florian
      * start of the new generic parameter handling
-
-}
+}

+ 37 - 14
compiler/powerpc/cpubase.pas

@@ -317,18 +317,30 @@ uses
 
     type
       TLoc=(
-        LOC_INVALID,     { added for tracking problems}
-        LOC_CONSTANT,    { ordinal constant }
-        LOC_REGISTER,    { in a processor register }
-        LOC_CREGISTER,   { Constant register which shouldn't be modified }
-        LOC_FPUREGISTER, { FPU register}
-        LOC_CFPUREGISTER,{ Constant FPU register which shouldn't be modified }
-        LOC_MMREGISTER,  { multimedia register }
-        LOC_CMMREGISTER, { Constant multimedia reg which shouldn't be modified }
-        LOC_REFERENCE,   { in memory }
-        LOC_CREFERENCE,  { in memory (constant) }
-        LOC_JUMP,        { boolean results only, jump to false or true label }
-        LOC_FLAGS        { boolean results only, flags are set }
+        { added for tracking problems}
+        LOC_INVALID,
+        { ordinal constant }
+        LOC_CONSTANT,
+        { in a processor register }
+        LOC_REGISTER,
+        { Constant register which shouldn't be modified }
+        LOC_CREGISTER,
+        { FPU register}
+        LOC_FPUREGISTER,
+        { Constant FPU register which shouldn't be modified }
+        LOC_CFPUREGISTER,
+        { multimedia register }
+        LOC_MMREGISTER,
+        { Constant multimedia reg which shouldn't be modified }
+        LOC_CMMREGISTER,
+        { in memory }
+        LOC_REFERENCE,
+        { in memory (constant) }
+        LOC_CREFERENCE,
+        { boolean results only, jump to false or true label }
+        LOC_JUMP,
+        { boolean results only, flags are set }
+        LOC_FLAGS
       );
 
       { tparamlocation describes where a parameter for a procedure is stored.
@@ -336,11 +348,19 @@ uses
         TLocation isn't used, because contains a lot of unnessary fields.
       }
       tparalocation = packed record
+         { The location type where the parameter is passed, usually
+           LOC_REFERENCE,LOC_REGISTER or LOC_FPUREGISTER
+         }
          loc  : TLoc;
+         { The stack pointer must be decreased by this value before
+           the parameter is copied to the given destination.
+           This allows to "encode" pushes with tparalocation.
+           On the PowerPC, this field is unsed but it is there
+           because several generic code accesses it.
+         }
          sp_fixup : longint;
          case TLoc of
             LOC_REFERENCE : (reference : tparareference);
-            { segment in reference at the same place as in loc_register }
             LOC_FPUREGISTER, LOC_CFPUREGISTER, LOC_MMREGISTER, LOC_CMMREGISTER,
               LOC_REGISTER,LOC_CREGISTER : (
               case longint of
@@ -627,7 +647,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.18  2002-07-11 14:41:34  florian
+  Revision 1.19  2002-07-13 19:38:44  florian
+    * some more generic calling stuff fixed
+
+  Revision 1.18  2002/07/11 14:41:34  florian
     * start of the new generic parameter handling
 
   Revision 1.17  2002/07/11 07:35:36  jonas