Browse Source

* released valuepara

peter 26 years ago
parent
commit
000336a586
8 changed files with 38 additions and 193 deletions
  1. 6 83
      compiler/cg386cal.pas
  2. 4 7
      compiler/cg386ld.pas
  3. 4 5
      compiler/pass_2.pas
  4. 5 10
      compiler/symdef.inc
  5. 6 61
      compiler/symsym.inc
  6. 4 5
      compiler/symsymh.inc
  7. 4 5
      compiler/tcld.pas
  8. 5 17
      compiler/types.pas

+ 6 - 83
compiler/cg386cal.pas

@@ -56,19 +56,6 @@ implementation
     procedure secondcallparan(var p : ptree;defcoll : pdefcoll;
     procedure secondcallparan(var p : ptree;defcoll : pdefcoll;
                 push_from_left_to_right,inlined : boolean;para_offset : longint);
                 push_from_left_to_right,inlined : boolean;para_offset : longint);
 
 
-      function push_addr(p:ptree):boolean;
-        begin
-          push_addr:=(
-{$ifndef VALUEPARA}
-                      dont_copy_const_param(p^.resulttype) { or }
-{$else}
-                      push_addr_param(p^.resulttype)
-{$endif}
-{  hmmm, why this ?? (FK)  or ((p^.treetype=stringconstn) and is_ansistring(p^.resulttype)) }
-                     );
-        end;
-
-
       procedure maybe_push_high;
       procedure maybe_push_high;
         var
         var
            r    : preference;
            r    : preference;
@@ -166,9 +153,6 @@ implementation
 
 
       var
       var
          size : longint;
          size : longint;
-{$ifndef VALUEPARA}
-         stackref : treference;
-{$endif}
          otlabel,hlabel,oflabel : plabel;
          otlabel,hlabel,oflabel : plabel;
          { temporary variables: }
          { temporary variables: }
          tempdeftype : tdeftype;
          tempdeftype : tdeftype;
@@ -253,11 +237,7 @@ implementation
               tempdeftype:=p^.resulttype^.deftype;
               tempdeftype:=p^.resulttype^.deftype;
               if tempdeftype=filedef then
               if tempdeftype=filedef then
                CGMessage(cg_e_file_must_call_by_reference);
                CGMessage(cg_e_file_must_call_by_reference);
-              if
-{$ifndef VALUEPARA}
-                 (defcoll^.paratyp=vs_const) and
-{$endif}
-                 push_addr(p^.left) then
+              if push_addr_param(p^.resulttype) then
                 begin
                 begin
                    maybe_push_high;
                    maybe_push_high;
                    inc(pushedparasize,4);
                    inc(pushedparasize,4);
@@ -565,67 +545,7 @@ implementation
                                end
                                end
                              { call by value open array ? }
                              { call by value open array ? }
                              else
                              else
-{$ifndef VALUEPARA}
-                              if (p^.resulttype^.deftype=arraydef) and
-                                 assigned(defcoll^.data) and
-                                 is_open_array(defcoll^.data) then
-                               begin
-                                  { first, push high }
-                                  maybe_push_high;
-                                  inc(pushedparasize,4);
-                                  if inlined then
-                                    begin
-                                       exprasmlist^.concat(new(pai386,op_ref_reg(A_LEA,S_L,
-                                         newreference(p^.left^.location.reference),R_EDI)));
-                                       r:=new_reference(procinfo.framepointer,para_offset-pushedparasize);
-                                       exprasmlist^.concat(new(pai386,op_reg_ref(A_MOV,S_L,
-                                         R_EDI,r)));
-                                    end
-                                  else
-                                    emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
-                                end
-                              else
-                               begin
-                                  size:=align(p^.resulttype^.size,target_os.stackalignment);
-                                  { create stack space }
-                                  if not inlined then
-                                    exprasmlist^.concat(new(pai386,op_const_reg(A_SUB,S_L,size,R_ESP)));
-{$ifdef GDB}
-                                  if (cs_debuginfo in aktmoduleswitches) and
-                                     (exprasmlist^.first=exprasmlist^.last) then
-                                    exprasmlist^.concat(new(pai_force_line,init));
-{$endif GDB}
-                                  inc(pushedparasize,size);
-                                  { create stack reference }
-                                  stackref.symbol := nil;
-                                  if not inlined then
-                                    begin
-                                      clear_reference(stackref);
-                                      stackref.base:=R_ESP;
-                                    end
-                                  else
-                                    begin
-                                      clear_reference(stackref);
-                                      stackref.base:=procinfo.framepointer;
-                                      stackref.offset:=para_offset-pushedparasize;
-                                    end;
-                                  { generate copy }
-                                  if is_shortstring(p^.resulttype) then
-                                    begin
-                                       copyshortstring(stackref,p^.left^.location.reference,
-                                         pstringdef(p^.resulttype)^.len,false);
-                                    end
-                                  else
-                                    begin
-                                       concatcopy(p^.left^.location.reference,
-                                         stackref,p^.resulttype^.size,true,false);
-                                    end;
-                               end;
-{$else VALUEPARA}
-                              begin
-                                internalerror(8954);
-                              end;
-{$endif VALUEPARA}
+                               internalerror(8954);
                           end;
                           end;
                         else
                         else
                           CGMessage(cg_e_illegal_expression);
                           CGMessage(cg_e_illegal_expression);
@@ -1665,7 +1585,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.55  1998-12-22 13:10:58  florian
+  Revision 1.56  1998-12-30 13:41:05  peter
+    * released valuepara
+
+  Revision 1.55  1998/12/22 13:10:58  florian
     * memory leaks for ansistring type casts fixed
     * memory leaks for ansistring type casts fixed
 
 
   Revision 1.54  1998/12/19 00:23:41  florian
   Revision 1.54  1998/12/19 00:23:41  florian

+ 4 - 7
compiler/cg386ld.pas

@@ -188,13 +188,7 @@ implementation
                          { in case call by reference, then calculate: }
                          { in case call by reference, then calculate: }
                          if (pvarsym(p^.symtableentry)^.varspez=vs_var) or
                          if (pvarsym(p^.symtableentry)^.varspez=vs_var) or
                             ((pvarsym(p^.symtableentry)^.varspez=vs_const) and
                             ((pvarsym(p^.symtableentry)^.varspez=vs_const) and
-{$ifndef VALUEPARA}
-                             dont_copy_const_param(pvarsym(p^.symtableentry)^.definition)) or
-                             { call by value open arrays are also indirect addressed }
-                             is_open_array(pvarsym(p^.symtableentry)^.definition) then
-{$else}
                              push_addr_param(pvarsym(p^.symtableentry)^.definition)) then
                              push_addr_param(pvarsym(p^.symtableentry)^.definition)) then
-{$endif}
                            begin
                            begin
                               simple_loadn:=false;
                               simple_loadn:=false;
                               if hregister=R_NO then
                               if hregister=R_NO then
@@ -734,7 +728,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.39  1998-12-19 00:23:45  florian
+  Revision 1.40  1998-12-30 13:41:07  peter
+    * released valuepara
+
+  Revision 1.39  1998/12/19 00:23:45  florian
     * ansistring memory leaks fixed
     * ansistring memory leaks fixed
 
 
   Revision 1.38  1998/12/11 00:02:51  peter
   Revision 1.38  1998/12/11 00:02:51  peter

+ 4 - 5
compiler/pass_2.pas

@@ -405,11 +405,7 @@ implementation
                                   { call by reference/const ? }
                                   { call by reference/const ? }
                                   if (regvars[i]^.varspez=vs_var) or
                                   if (regvars[i]^.varspez=vs_var) or
                                      ((regvars[i]^.varspez=vs_const) and
                                      ((regvars[i]^.varspez=vs_const) and
-{$ifndef VALUEPARA}
-                                       dont_copy_const_param(regvars[i]^.definition)) then
-{$else}
                                        push_addr_param(regvars[i]^.definition)) then
                                        push_addr_param(regvars[i]^.definition)) then
-{$endif}
                                     begin
                                     begin
                                        regvars[i]^.reg:=varregs[i];
                                        regvars[i]^.reg:=varregs[i];
                                        regsize:=S_L;
                                        regsize:=S_L;
@@ -499,7 +495,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.12  1998-12-19 00:23:51  florian
+  Revision 1.13  1998-12-30 13:41:09  peter
+    * released valuepara
+
+  Revision 1.12  1998/12/19 00:23:51  florian
     * ansistring memory leaks fixed
     * ansistring memory leaks fixed
 
 
   Revision 1.11  1998/12/11 00:03:28  peter
   Revision 1.11  1998/12/11 00:03:28  peter

+ 5 - 10
compiler/symdef.inc

@@ -2009,19 +2009,11 @@
           begin
           begin
             case pdc^.paratyp of
             case pdc^.paratyp of
               vs_var   : inc(l,target_os.size_of_pointer);
               vs_var   : inc(l,target_os.size_of_pointer);
-{$ifndef VALUEPARA}
-              vs_value : inc(l,align(pdc^.data^.size,target_os.stackalignment));
-              vs_const : if dont_copy_const_param(pdc^.data) then
-                          inc(l,target_os.size_of_pointer)
-                         else
-                          inc(l,align(pdc^.data^.size,target_os.stackalignment));
-{$else}
               vs_value,
               vs_value,
               vs_const : if push_addr_param(pdc^.data) then
               vs_const : if push_addr_param(pdc^.data) then
                           inc(l,target_os.size_of_pointer)
                           inc(l,target_os.size_of_pointer)
                          else
                          else
                           inc(l,align(pdc^.data^.size,target_os.stackalignment));
                           inc(l,align(pdc^.data^.size,target_os.stackalignment));
-{$endif}
             end;
             end;
             pdc:=pdc^.next;
             pdc:=pdc^.next;
           end;
           end;
@@ -2899,7 +2891,7 @@
                    argnames:='__dt__'
                    argnames:='__dt__'
                  else
                  else
                    argnames := '';
                    argnames := '';
-                 
+
                  while assigned(para) do
                  while assigned(para) do
                    begin
                    begin
                    if para^.data^.deftype = formaldef then
                    if para^.data^.deftype = formaldef then
@@ -3262,7 +3254,10 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.83  1998-12-21 14:03:08  pierre
+  Revision 1.84  1998-12-30 13:41:12  peter
+    * released valuepara
+
+  Revision 1.83  1998/12/21 14:03:08  pierre
    * procvar stabs correction
    * procvar stabs correction
 
 
   Revision 1.82  1998/12/19 00:23:52  florian
   Revision 1.82  1998/12/19 00:23:52  florian

+ 6 - 61
compiler/symsym.inc

@@ -832,10 +832,8 @@
          _mangledname:=nil;
          _mangledname:=nil;
          varspez:=vs_value;
          varspez:=vs_value;
          address:=0;
          address:=0;
-{$ifdef VALUEPARA}
          localaddress:=-1;
          localaddress:=-1;
          islocalcopy:=false;
          islocalcopy:=false;
-{$endif}
          refs:=0;
          refs:=0;
          is_valid := 1;
          is_valid := 1;
          var_options:=0;
          var_options:=0;
@@ -889,10 +887,8 @@
            address:=readlong
            address:=readlong
          else
          else
            address:=0;
            address:=0;
-{$ifdef VALUEPARA}
          localaddress:=-1;
          localaddress:=-1;
          islocalcopy:=false;
          islocalcopy:=false;
-{$endif}
          definition:=readdefref;
          definition:=readdefref;
          var_options:=readbyte;
          var_options:=readbyte;
          if (var_options and vo_is_C_var)<>0 then
          if (var_options and vo_is_C_var)<>0 then
@@ -951,53 +947,6 @@
       end;
       end;
 
 
 
 
-{$ifndef VALUEPARA}
-    function tvarsym.getsize : longint;
-      begin
-         { only if the definition is set, we could determine the   }
-         { size, this is if an error occurs while reading the type }
-         { also used for operator, this allows not to allocate the }
-         { return size twice                                       }
-         if assigned(definition) then
-           begin
-              case varspez of
-                 vs_value : begin
-                              if is_open_array(definition) then
-                                getsize:=target_os.size_of_pointer+target_os.size_of_longint
-                              else
-                                getsize:=definition^.size;
-                            end;
-                   vs_var : begin
-                            { open arrays push also the high valye }
-                              if is_open_array(definition) or
-                                 is_open_string(definition) then
-                                getsize:=target_os.size_of_pointer+target_os.size_of_longint
-                              else
-                                getsize:=target_os.size_of_pointer;
-                            end;
-                 vs_const : begin
-                              case definition^.deftype of
-                             stringdef,
-                             recorddef,
-                             objectdef,
-                                setdef : getsize:=target_os.size_of_pointer;
-                              arraydef : begin
-                                         { open arrays push also the high valye }
-                                           if is_open_array(definition) then
-                                             getsize:=target_os.size_of_pointer+target_os.size_of_longint
-                                           else
-                                             getsize:=target_os.size_of_pointer;
-                                         end;
-                              else
-                               getsize:=definition^.size;
-                              end;
-                            end;
-              end;
-           end
-         else
-           getsize:=0;
-      end;
-{$else}
     function tvarsym.getsize : longint;
     function tvarsym.getsize : longint;
       begin
       begin
         if assigned(definition) and (varspez=vs_value) then
         if assigned(definition) and (varspez=vs_value) then
@@ -1044,7 +993,6 @@
          else
          else
            getpushsize:=0;
            getpushsize:=0;
       end;
       end;
-{$endif}
 
 
 
 
     procedure tvarsym.insert_in_data;
     procedure tvarsym.insert_in_data;
@@ -1176,11 +1124,9 @@
                  end;
                  end;
                parasymtable :
                parasymtable :
                  begin
                  begin
-{$ifdef VALUEPARA}
                    { here we need the size of a push instead of the
                    { here we need the size of a push instead of the
                      size of the data }
                      size of the data }
                    l:=getpushsize;
                    l:=getpushsize;
-{$endif}
                    address:=owner^.datasize;
                    address:=owner^.datasize;
                    owner^.datasize:=align(owner^.datasize+l,target_os.stackalignment);
                    owner^.datasize:=align(owner^.datasize+l,target_os.stackalignment);
                  end
                  end
@@ -1233,14 +1179,10 @@
        else if (owner^.symtabletype=parasymtable) then
        else if (owner^.symtabletype=parasymtable) then
          begin
          begin
             case varspez of
             case varspez of
-               vs_value : st := 'p';
                vs_var   : st := 'v';
                vs_var   : st := 'v';
-{$ifdef VALUEPARA}
+               vs_value,
                vs_const : if push_addr_param(definition) then
                vs_const : if push_addr_param(definition) then
-{$else}
-               vs_const : if dont_copy_const_param(definition) then
-{$endif}
-                            st := 'v'{ should be 'i' but 'i' doesn't work }
+                            st := 'v' { should be 'i' but 'i' doesn't work }
                           else
                           else
                             st := 'p';
                             st := 'p';
               end;
               end;
@@ -1805,7 +1747,10 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.65  1998-12-26 15:35:44  peter
+  Revision 1.66  1998-12-30 13:41:14  peter
+    * released valuepara
+
+  Revision 1.65  1998/12/26 15:35:44  peter
     + read/write of constnil
     + read/write of constnil
 
 
   Revision 1.64  1998/12/08 10:18:15  peter
   Revision 1.64  1998/12/08 10:18:15  peter

+ 4 - 5
compiler/symsymh.inc

@@ -173,10 +173,8 @@
        pvarsym = ^tvarsym;
        pvarsym = ^tvarsym;
        tvarsym = object(tsym)
        tvarsym = object(tsym)
           address      : longint;
           address      : longint;
-{$ifdef VALUEPARA}
           localaddress : longint;  { address of the local copy of a value para, -1 means not used }
           localaddress : longint;  { address of the local copy of a value para, -1 means not used }
           islocalcopy  : boolean;
           islocalcopy  : boolean;
-{$endif}
           definition   : pdef;
           definition   : pdef;
           refs         : longint;
           refs         : longint;
           var_options  : byte;
           var_options  : byte;
@@ -195,9 +193,7 @@
           function  mangledname : string;virtual;
           function  mangledname : string;virtual;
           procedure insert_in_data;virtual;
           procedure insert_in_data;virtual;
           function  getsize : longint;
           function  getsize : longint;
-{$ifdef VALUEPARA}
           function  getpushsize : longint;
           function  getpushsize : longint;
-{$endif}
 {$ifdef GDB}
 {$ifdef GDB}
           function stabstring : pchar;virtual;
           function stabstring : pchar;virtual;
           procedure concatstabto(asmlist : paasmoutput);virtual;
           procedure concatstabto(asmlist : paasmoutput);virtual;
@@ -327,7 +323,10 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.9  1998-11-28 16:20:57  peter
+  Revision 1.10  1998-12-30 13:41:15  peter
+    * released valuepara
+
+  Revision 1.9  1998/11/28 16:20:57  peter
     + support for dll variables
     + support for dll variables
 
 
   Revision 1.8  1998/11/18 15:44:19  peter
   Revision 1.8  1998/11/18 15:44:19  peter

+ 4 - 5
compiler/tcld.pas

@@ -103,11 +103,7 @@ implementation
                    { we need a register for call by reference parameters }
                    { we need a register for call by reference parameters }
                    if (pvarsym(p^.symtableentry)^.varspez=vs_var) or
                    if (pvarsym(p^.symtableentry)^.varspez=vs_var) or
                       ((pvarsym(p^.symtableentry)^.varspez=vs_const) and
                       ((pvarsym(p^.symtableentry)^.varspez=vs_const) and
-{$ifndef VALUEPARA}
-                      dont_copy_const_param(pvarsym(p^.symtableentry)^.definition)) or
-{$else}
                       push_addr_param(pvarsym(p^.symtableentry)^.definition)) or
                       push_addr_param(pvarsym(p^.symtableentry)^.definition)) or
-{$endif}
                       { call by value open arrays are also indirect addressed }
                       { call by value open arrays are also indirect addressed }
                       is_open_array(pvarsym(p^.symtableentry)^.definition) then
                       is_open_array(pvarsym(p^.symtableentry)^.definition) then
                      p^.registers32:=1;
                      p^.registers32:=1;
@@ -425,7 +421,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.11  1998-11-18 17:45:28  peter
+  Revision 1.12  1998-12-30 13:41:19  peter
+    * released valuepara
+
+  Revision 1.11  1998/11/18 17:45:28  peter
     * fixes for VALUEPARA
     * fixes for VALUEPARA
 
 
   Revision 1.10  1998/11/18 15:44:23  peter
   Revision 1.10  1998/11/18 15:44:23  peter

+ 5 - 17
compiler/types.pas

@@ -91,12 +91,8 @@ unit types;
     { true, if def is a 64 bit int type }
     { true, if def is a 64 bit int type }
     function is_64bitint(def : pdef) : boolean;
     function is_64bitint(def : pdef) : boolean;
 
 
-{$ifndef VALUEPARA}
-    { true if a const parameter is too large to copy }
-    function dont_copy_const_param(def : pdef) : boolean;
-{$else}
+    { true if a parameter is too large to copy and only the address is pushed }
     function push_addr_param(def : pdef) : boolean;
     function push_addr_param(def : pdef) : boolean;
-{$endif}
 
 
     { true if we must never copy this parameter }
     { true if we must never copy this parameter }
     const
     const
@@ -380,16 +376,6 @@ unit types;
            ((def^.deftype=setdef) and (psetdef(def)^.settype<>smallset));
            ((def^.deftype=setdef) and (psetdef(def)^.settype<>smallset));
       end;
       end;
 
 
-{$ifndef VALUEPARA}
-    { true if a const parameter is too large to copy }
-    function dont_copy_const_param(def : pdef) : boolean;
-      begin
-         dont_copy_const_param:=(def^.deftype in [arraydef,objectdef,formaldef,recorddef]) or
-           ((def^.deftype=stringdef) and (pstringdef(def)^.string_typ in [st_shortstring,st_longstring])) or
-           ((def^.deftype=procvardef) and ((pprocvardef(def)^.options and pomethodpointer)<>0)) or
-           ((def^.deftype=setdef) and (psetdef(def)^.settype<>smallset));
-      end;
-{$else}
     { true if a parameter is too large to copy and only the address is pushed }
     { true if a parameter is too large to copy and only the address is pushed }
     function push_addr_param(def : pdef) : boolean;
     function push_addr_param(def : pdef) : boolean;
       begin
       begin
@@ -398,7 +384,6 @@ unit types;
            ((def^.deftype=procvardef) and ((pprocvardef(def)^.options and pomethodpointer)<>0)) or
            ((def^.deftype=procvardef) and ((pprocvardef(def)^.options and pomethodpointer)<>0)) or
            ((def^.deftype=setdef) and (psetdef(def)^.settype<>smallset));
            ((def^.deftype=setdef) and (psetdef(def)^.settype<>smallset));
       end;
       end;
-{$endif}
 
 
     { test if l is in the range of def, outputs error if out of range }
     { test if l is in the range of def, outputs error if out of range }
     procedure testrange(def : pdef;l : longint);
     procedure testrange(def : pdef;l : longint);
@@ -1048,7 +1033,10 @@ unit types;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.42  1998-12-11 00:04:03  peter
+  Revision 1.43  1998-12-30 13:41:20  peter
+    * released valuepara
+
+  Revision 1.42  1998/12/11 00:04:03  peter
     + globtype,tokens,version unit splitted from globals
     + globtype,tokens,version unit splitted from globals
 
 
   Revision 1.41  1998/12/10 09:47:33  florian
   Revision 1.41  1998/12/10 09:47:33  florian