diff --git a/compiler/cg386cal.pas b/compiler/cg386cal.pas index 1720bd9512..1a88339123 100644 --- a/compiler/cg386cal.pas +++ b/compiler/cg386cal.pas @@ -56,19 +56,6 @@ implementation procedure secondcallparan(var p : ptree;defcoll : pdefcoll; 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; var r : preference; @@ -166,9 +153,6 @@ implementation var size : longint; -{$ifndef VALUEPARA} - stackref : treference; -{$endif} otlabel,hlabel,oflabel : plabel; { temporary variables: } tempdeftype : tdeftype; @@ -253,11 +237,7 @@ implementation tempdeftype:=p^.resulttype^.deftype; if tempdeftype=filedef then 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 maybe_push_high; inc(pushedparasize,4); @@ -565,67 +545,7 @@ implementation end { call by value open array ? } 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; else CGMessage(cg_e_illegal_expression); @@ -1665,7 +1585,10 @@ implementation end. { $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 Revision 1.54 1998/12/19 00:23:41 florian diff --git a/compiler/cg386ld.pas b/compiler/cg386ld.pas index 399265c659..88f4c924c8 100644 --- a/compiler/cg386ld.pas +++ b/compiler/cg386ld.pas @@ -188,13 +188,7 @@ implementation { in case call by reference, then calculate: } if (pvarsym(p^.symtableentry)^.varspez=vs_var) or ((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 -{$endif} begin simple_loadn:=false; if hregister=R_NO then @@ -734,7 +728,10 @@ implementation end. { $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 Revision 1.38 1998/12/11 00:02:51 peter diff --git a/compiler/pass_2.pas b/compiler/pass_2.pas index c528ebbfec..16b9d503bc 100644 --- a/compiler/pass_2.pas +++ b/compiler/pass_2.pas @@ -405,11 +405,7 @@ implementation { call by reference/const ? } if (regvars[i]^.varspez=vs_var) or ((regvars[i]^.varspez=vs_const) and -{$ifndef VALUEPARA} - dont_copy_const_param(regvars[i]^.definition)) then -{$else} push_addr_param(regvars[i]^.definition)) then -{$endif} begin regvars[i]^.reg:=varregs[i]; regsize:=S_L; @@ -499,7 +495,10 @@ implementation end. { $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 Revision 1.11 1998/12/11 00:03:28 peter diff --git a/compiler/symdef.inc b/compiler/symdef.inc index b3d96d30ec..4b64084e45 100644 --- a/compiler/symdef.inc +++ b/compiler/symdef.inc @@ -2009,19 +2009,11 @@ begin case pdc^.paratyp of 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_const : if push_addr_param(pdc^.data) then inc(l,target_os.size_of_pointer) else inc(l,align(pdc^.data^.size,target_os.stackalignment)); -{$endif} end; pdc:=pdc^.next; end; @@ -2899,7 +2891,7 @@ argnames:='__dt__' else argnames := ''; - + while assigned(para) do begin if para^.data^.deftype = formaldef then @@ -3262,7 +3254,10 @@ { $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 Revision 1.82 1998/12/19 00:23:52 florian diff --git a/compiler/symsym.inc b/compiler/symsym.inc index c575102d43..55ee95f07b 100644 --- a/compiler/symsym.inc +++ b/compiler/symsym.inc @@ -832,10 +832,8 @@ _mangledname:=nil; varspez:=vs_value; address:=0; -{$ifdef VALUEPARA} localaddress:=-1; islocalcopy:=false; -{$endif} refs:=0; is_valid := 1; var_options:=0; @@ -889,10 +887,8 @@ address:=readlong else address:=0; -{$ifdef VALUEPARA} localaddress:=-1; islocalcopy:=false; -{$endif} definition:=readdefref; var_options:=readbyte; if (var_options and vo_is_C_var)<>0 then @@ -951,53 +947,6 @@ 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; begin if assigned(definition) and (varspez=vs_value) then @@ -1044,7 +993,6 @@ else getpushsize:=0; end; -{$endif} procedure tvarsym.insert_in_data; @@ -1176,11 +1124,9 @@ end; parasymtable : begin -{$ifdef VALUEPARA} { here we need the size of a push instead of the size of the data } l:=getpushsize; -{$endif} address:=owner^.datasize; owner^.datasize:=align(owner^.datasize+l,target_os.stackalignment); end @@ -1233,14 +1179,10 @@ else if (owner^.symtabletype=parasymtable) then begin case varspez of - vs_value : st := 'p'; vs_var : st := 'v'; -{$ifdef VALUEPARA} + vs_value, 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 st := 'p'; end; @@ -1805,7 +1747,10 @@ { $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 Revision 1.64 1998/12/08 10:18:15 peter diff --git a/compiler/symsymh.inc b/compiler/symsymh.inc index f2aeb9ab30..ef00163720 100644 --- a/compiler/symsymh.inc +++ b/compiler/symsymh.inc @@ -173,10 +173,8 @@ pvarsym = ^tvarsym; tvarsym = object(tsym) address : longint; -{$ifdef VALUEPARA} localaddress : longint; { address of the local copy of a value para, -1 means not used } islocalcopy : boolean; -{$endif} definition : pdef; refs : longint; var_options : byte; @@ -195,9 +193,7 @@ function mangledname : string;virtual; procedure insert_in_data;virtual; function getsize : longint; -{$ifdef VALUEPARA} function getpushsize : longint; -{$endif} {$ifdef GDB} function stabstring : pchar;virtual; procedure concatstabto(asmlist : paasmoutput);virtual; @@ -327,7 +323,10 @@ { $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 Revision 1.8 1998/11/18 15:44:19 peter diff --git a/compiler/tcld.pas b/compiler/tcld.pas index f53baee487..85e4140734 100644 --- a/compiler/tcld.pas +++ b/compiler/tcld.pas @@ -103,11 +103,7 @@ implementation { we need a register for call by reference parameters } if (pvarsym(p^.symtableentry)^.varspez=vs_var) or ((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 -{$endif} { call by value open arrays are also indirect addressed } is_open_array(pvarsym(p^.symtableentry)^.definition) then p^.registers32:=1; @@ -425,7 +421,10 @@ implementation end. { $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 Revision 1.10 1998/11/18 15:44:23 peter diff --git a/compiler/types.pas b/compiler/types.pas index 59f0daf513..e40856dce6 100644 --- a/compiler/types.pas +++ b/compiler/types.pas @@ -91,12 +91,8 @@ unit types; { true, if def is a 64 bit int type } 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; -{$endif} { true if we must never copy this parameter } const @@ -380,16 +376,6 @@ unit types; ((def^.deftype=setdef) and (psetdef(def)^.settype<>smallset)); 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 } function push_addr_param(def : pdef) : boolean; begin @@ -398,7 +384,6 @@ unit types; ((def^.deftype=procvardef) and ((pprocvardef(def)^.options and pomethodpointer)<>0)) or ((def^.deftype=setdef) and (psetdef(def)^.settype<>smallset)); end; -{$endif} { test if l is in the range of def, outputs error if out of range } procedure testrange(def : pdef;l : longint); @@ -1048,7 +1033,10 @@ unit types; end. { $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 Revision 1.41 1998/12/10 09:47:33 florian