mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-16 02:30:41 +01:00
* VALUEPARA for tp7 compatible value parameters
This commit is contained in:
parent
f00187e462
commit
0cadc4f3c3
@ -236,7 +236,7 @@ implementation
|
||||
{ release the registers }
|
||||
del_reference(p^.left^.location.reference);
|
||||
gettempofsizereference(256,href);
|
||||
copyshortstring(href,p^.left^.location.reference,255);
|
||||
copyshortstring(href,p^.left^.location.reference,255,false);
|
||||
ungetiftemp(p^.left^.location.reference);
|
||||
|
||||
{ does not hurt: }
|
||||
@ -363,7 +363,7 @@ implementation
|
||||
{ add a range or a single element? }
|
||||
if p^.right^.treetype=setelementn then
|
||||
begin
|
||||
concatcopy(p^.left^.location.reference,href,32,false);
|
||||
concatcopy(p^.left^.location.reference,href,32,false,false);
|
||||
if assigned(p^.right^.right) then
|
||||
begin
|
||||
pushsetelement(p^.right^.right);
|
||||
@ -1364,7 +1364,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.28 1998-11-18 09:18:01 pierre
|
||||
Revision 1.29 1998-11-18 15:44:05 peter
|
||||
* VALUEPARA for tp7 compatible value parameters
|
||||
|
||||
Revision 1.28 1998/11/18 09:18:01 pierre
|
||||
+ automatic loading of profile unit with -pg option
|
||||
in go32v2 mode (also defines FPC_PROFILE)
|
||||
* some memory leaks removed
|
||||
|
||||
@ -137,7 +137,9 @@ implementation
|
||||
|
||||
var
|
||||
size : longint;
|
||||
{$ifndef VALUEPARA}
|
||||
stackref : treference;
|
||||
{$endif}
|
||||
otlabel,hlabel,oflabel : plabel;
|
||||
{ temporary variables: }
|
||||
tempdeftype : tdeftype;
|
||||
@ -221,8 +223,12 @@ implementation
|
||||
tempdeftype:=p^.resulttype^.deftype;
|
||||
if tempdeftype=filedef then
|
||||
CGMessage(cg_e_file_must_call_by_reference);
|
||||
{$ifndef VALUEPARA}
|
||||
if (defcoll^.paratyp=vs_const) and
|
||||
dont_copy_const_param(p^.resulttype) then
|
||||
{$else}
|
||||
if push_addr_param(p^.resulttype) then
|
||||
{$endif}
|
||||
begin
|
||||
maybe_push_open_array_high;
|
||||
inc(pushedparasize,4);
|
||||
@ -493,20 +499,20 @@ implementation
|
||||
{ 32 bit type set ? }
|
||||
if is_widestring(p^.resulttype) or
|
||||
is_ansistring(p^.resulttype) or
|
||||
((p^.resulttype^.deftype=setdef) and
|
||||
(psetdef(p^.resulttype)^.settype=smallset)) then
|
||||
is_smallset(p^.resulttype) then
|
||||
begin
|
||||
inc(pushedparasize,4);
|
||||
if inlined then
|
||||
begin
|
||||
r:=new_reference(procinfo.framepointer,para_offset-pushedparasize);
|
||||
concatcopy(tempreference,r^,4,false);
|
||||
concatcopy(tempreference,r^,4,false,false);
|
||||
end
|
||||
else
|
||||
emit_push_mem(tempreference);
|
||||
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
|
||||
@ -554,14 +560,19 @@ implementation
|
||||
if is_shortstring(p^.resulttype) then
|
||||
begin
|
||||
copyshortstring(stackref,p^.left^.location.reference,
|
||||
pstringdef(p^.resulttype)^.len);
|
||||
pstringdef(p^.resulttype)^.len,false);
|
||||
end
|
||||
else
|
||||
begin
|
||||
concatcopy(p^.left^.location.reference,
|
||||
stackref,p^.resulttype^.size,true);
|
||||
stackref,p^.resulttype^.size,true,false);
|
||||
end;
|
||||
end;
|
||||
{$else VALUEPARA}
|
||||
begin
|
||||
internalerror(8954);
|
||||
end;
|
||||
{$endif VALUEPARA}
|
||||
end;
|
||||
else
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
@ -1552,7 +1563,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.44 1998-11-16 15:35:36 peter
|
||||
Revision 1.45 1998-11-18 15:44:07 peter
|
||||
* VALUEPARA for tp7 compatible value parameters
|
||||
|
||||
Revision 1.44 1998/11/16 15:35:36 peter
|
||||
* rename laod/copystring -> load/copyshortstring
|
||||
* fixed int-bool cnv bug
|
||||
+ char-ansistring conversion
|
||||
|
||||
@ -405,7 +405,7 @@ implementation
|
||||
stringdispose(p^.location.reference.symbol);
|
||||
gettempofsizereference(p^.resulttype^.size,p^.location.reference);
|
||||
del_reference(p^.left^.location.reference);
|
||||
copyshortstring(p^.location.reference,p^.left^.location.reference,pstringdef(p^.resulttype)^.len);
|
||||
copyshortstring(p^.location.reference,p^.left^.location.reference,pstringdef(p^.resulttype)^.len,false);
|
||||
ungetiftemp(p^.left^.location.reference);
|
||||
end;
|
||||
st_longstring:
|
||||
@ -579,7 +579,7 @@ implementation
|
||||
|
||||
{ generates the copy code }
|
||||
{ and we need the source never }
|
||||
concatcopy(p^.left^.location.reference,p^.location.reference,l,true);
|
||||
concatcopy(p^.left^.location.reference,p^.location.reference,l,true,false);
|
||||
|
||||
{ correct the string location }
|
||||
dec(p^.location.reference.offset);
|
||||
@ -1297,7 +1297,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.33 1998-11-17 00:36:39 peter
|
||||
Revision 1.34 1998-11-18 15:44:08 peter
|
||||
* VALUEPARA for tp7 compatible value parameters
|
||||
|
||||
Revision 1.33 1998/11/17 00:36:39 peter
|
||||
* more ansistring fixes
|
||||
|
||||
Revision 1.32 1998/11/16 15:35:38 peter
|
||||
|
||||
@ -242,7 +242,7 @@ implementation
|
||||
newreference(temp1))));
|
||||
end
|
||||
else
|
||||
concatcopy(p^.right^.location.reference,temp1,hs,false);
|
||||
concatcopy(p^.right^.location.reference,temp1,hs,false,false);
|
||||
end
|
||||
else temptovalue:=false;
|
||||
|
||||
@ -754,7 +754,10 @@ do_jmp:
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.23 1998-11-12 16:43:32 florian
|
||||
Revision 1.24 1998-11-18 15:44:09 peter
|
||||
* VALUEPARA for tp7 compatible value parameters
|
||||
|
||||
Revision 1.23 1998/11/12 16:43:32 florian
|
||||
* functions with ansi strings as result didn't work, solved
|
||||
|
||||
Revision 1.22 1998/10/29 15:42:44 florian
|
||||
|
||||
@ -184,10 +184,14 @@ implementation
|
||||
end;
|
||||
{ in case call by reference, then calculate: }
|
||||
if (pvarsym(p^.symtableentry)^.varspez=vs_var) or
|
||||
{$ifndef VALUEPARA}
|
||||
((pvarsym(p^.symtableentry)^.varspez=vs_const) and
|
||||
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
|
||||
@ -228,8 +232,7 @@ implementation
|
||||
begin
|
||||
{!!!!! Be aware, work on virtual methods too }
|
||||
stringdispose(p^.location.reference.symbol);
|
||||
p^.location.reference.symbol:=
|
||||
stringdup(pprocsym(p^.symtableentry)^.definition^.mangledname);
|
||||
p^.location.reference.symbol:=stringdup(pprocsym(p^.symtableentry)^.definition^.mangledname);
|
||||
maybe_concat_external(p^.symtable,p^.symtableentry^.mangledname);
|
||||
end;
|
||||
typedconstsym :
|
||||
@ -435,7 +438,7 @@ implementation
|
||||
|
||||
end;
|
||||
concatcopy(p^.right^.location.reference,
|
||||
p^.left^.location.reference,p^.left^.resulttype^.size,false);
|
||||
p^.left^.location.reference,p^.left^.resulttype^.size,false,false);
|
||||
ungetiftemp(p^.right^.location.reference);
|
||||
end;
|
||||
end;
|
||||
@ -686,7 +689,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.28 1998-11-17 11:32:44 peter
|
||||
Revision 1.29 1998-11-18 15:44:11 peter
|
||||
* VALUEPARA for tp7 compatible value parameters
|
||||
|
||||
Revision 1.28 1998/11/17 11:32:44 peter
|
||||
* optimize str:='' in H+ mode
|
||||
+ -! to test ansistrings
|
||||
|
||||
|
||||
@ -403,26 +403,29 @@ implementation
|
||||
{ call by reference/const ? }
|
||||
if (regvars[i]^.varspez=vs_var) or
|
||||
((regvars[i]^.varspez=vs_const) and
|
||||
dont_copy_const_param(regvars[i]^.definition)) then
|
||||
{$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;
|
||||
end
|
||||
else
|
||||
if (regvars[i]^.definition^.deftype=orddef) and
|
||||
(porddef(regvars[i]^.definition)^.typ in [bool8bit,uchar,u8bit,s8bit]) then
|
||||
(porddef(regvars[i]^.definition)^.size=1) then
|
||||
begin
|
||||
{$ifdef i386}
|
||||
|
||||
regvars[i]^.reg:=reg32toreg8(varregs[i]);
|
||||
{$endif}
|
||||
regsize:=S_B;
|
||||
end
|
||||
else if (regvars[i]^.definition^.deftype=orddef) and
|
||||
(porddef(regvars[i]^.definition)^.typ in [bool16bit,u16bit,s16bit]) then
|
||||
else
|
||||
if (regvars[i]^.definition^.deftype=orddef) and
|
||||
(porddef(regvars[i]^.definition)^.size=2) then
|
||||
begin
|
||||
{$ifdef i386}
|
||||
|
||||
regvars[i]^.reg:=reg32toreg16(varregs[i]);
|
||||
{$endif}
|
||||
regsize:=S_W;
|
||||
@ -451,7 +454,6 @@ implementation
|
||||
procinfo.aktentrycode^.concat(new(pai68k,op_ref_reg(A_MOVE,regsize,
|
||||
hr,regvars[i]^.reg)));
|
||||
{$endif m68k}
|
||||
|
||||
unused:=unused - [regvars[i]^.reg];
|
||||
end;
|
||||
{ procedure uses this register }
|
||||
@ -461,7 +463,6 @@ implementation
|
||||
{$ifdef m68k}
|
||||
usedinproc:=usedinproc or ($800 shr word(varregs[i]));
|
||||
{$endif m68k}
|
||||
|
||||
end;
|
||||
nextreg:
|
||||
{ dummy }
|
||||
@ -496,7 +497,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 1998-11-13 15:40:21 pierre
|
||||
Revision 1.10 1998-11-18 15:44:14 peter
|
||||
* VALUEPARA for tp7 compatible value parameters
|
||||
|
||||
Revision 1.9 1998/11/13 15:40:21 pierre
|
||||
+ added -Se in Makefile cvstest target
|
||||
+ lexlevel cleanup
|
||||
normal_function_level main_program_level and unit_init_level defined
|
||||
|
||||
@ -1979,12 +1979,20 @@
|
||||
while assigned(pdc) do
|
||||
begin
|
||||
case pdc^.paratyp of
|
||||
vs_value : inc(l,align(pdc^.data^.size,target_os.stackalignment));
|
||||
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;
|
||||
@ -3199,7 +3207,10 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.69 1998-11-10 17:54:56 peter
|
||||
Revision 1.70 1998-11-18 15:44:16 peter
|
||||
* VALUEPARA for tp7 compatible value parameters
|
||||
|
||||
Revision 1.69 1998/11/10 17:54:56 peter
|
||||
* removed warning
|
||||
|
||||
Revision 1.68 1998/11/05 23:34:36 peter
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
left:=nil;
|
||||
right:=nil;
|
||||
{$ifdef nextfield}
|
||||
nextsym:=nil;
|
||||
nextsym:=nil;
|
||||
{$endif nextfield}
|
||||
setname(n);
|
||||
typ:=abstractsym;
|
||||
@ -831,6 +831,10 @@
|
||||
_mangledname:=nil;
|
||||
varspez:=vs_value;
|
||||
address:=0;
|
||||
{$ifdef VALUEPARA}
|
||||
localaddress:=-1;
|
||||
islocalcopy:=false;
|
||||
{$endif}
|
||||
refs:=0;
|
||||
is_valid := 1;
|
||||
var_options:=0;
|
||||
@ -864,6 +868,10 @@
|
||||
address:=readlong
|
||||
else
|
||||
address:=0;
|
||||
{$ifdef VALUEPARA}
|
||||
localaddress:=-1;
|
||||
islocalcopy:=false;
|
||||
{$endif}
|
||||
definition:=readdefref;
|
||||
refs := 0;
|
||||
is_valid := 1;
|
||||
@ -907,7 +915,7 @@
|
||||
writebyte(byte(varspez));
|
||||
|
||||
if read_member then
|
||||
writelong(address);
|
||||
writelong(address);
|
||||
|
||||
writedefref(definition);
|
||||
if (var_options and vo_is_C_var)<>0 then
|
||||
@ -944,6 +952,7 @@
|
||||
mangledname:=prefix+name;
|
||||
end;
|
||||
|
||||
{$ifndef VALUEPARA}
|
||||
function tvarsym.getsize : longint;
|
||||
begin
|
||||
{ only if the definition is set, we could determine the }
|
||||
@ -989,6 +998,54 @@
|
||||
else
|
||||
getsize:=0;
|
||||
end;
|
||||
{$else}
|
||||
function tvarsym.getsize : longint;
|
||||
begin
|
||||
if assigned(definition) and (varspez=vs_value) then
|
||||
getsize:=definition^.size
|
||||
else
|
||||
getsize:=0;
|
||||
end;
|
||||
|
||||
|
||||
function tvarsym.getpushsize : longint;
|
||||
begin
|
||||
if assigned(definition) then
|
||||
begin
|
||||
case varspez of
|
||||
vs_var :
|
||||
begin
|
||||
{ open arrays push also the high valye }
|
||||
if is_open_array(definition) then
|
||||
getpushsize:=target_os.size_of_pointer+target_os.size_of_pointer
|
||||
else
|
||||
getpushsize:=target_os.size_of_pointer;
|
||||
end;
|
||||
vs_value,
|
||||
vs_const :
|
||||
begin
|
||||
case definition^.deftype of
|
||||
setdef,
|
||||
stringdef,
|
||||
recorddef,
|
||||
objectdef :
|
||||
getpushsize:=target_os.size_of_pointer;
|
||||
arraydef :
|
||||
if is_open_array(definition) then
|
||||
getpushsize:=target_os.size_of_pointer+target_os.size_of_pointer
|
||||
else
|
||||
getpushsize:=target_os.size_of_pointer;
|
||||
else
|
||||
getpushsize:=definition^.size;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
getpushsize:=0;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
||||
procedure tvarsym.insert_in_data;
|
||||
var
|
||||
@ -1018,119 +1075,128 @@
|
||||
|
||||
l:=getsize;
|
||||
case owner^.symtabletype of
|
||||
|
||||
stt_exceptsymtable:
|
||||
{ can contain only one symbol, address calculated later }
|
||||
;
|
||||
localsymtable : begin
|
||||
is_valid := 0;
|
||||
modulo:=owner^.datasize and 3;
|
||||
stt_exceptsymtable:
|
||||
{ can contain only one symbol, address calculated later }
|
||||
;
|
||||
localsymtable :
|
||||
begin
|
||||
is_valid := 0;
|
||||
modulo:=owner^.datasize and 3;
|
||||
{$ifdef m68k}
|
||||
{ word alignment required for motorola }
|
||||
if (l=1) then
|
||||
l:=2
|
||||
else
|
||||
{ word alignment required for motorola }
|
||||
if (l=1) then
|
||||
l:=2
|
||||
else
|
||||
{$endif}
|
||||
if (l>=4) and (modulo<>0) then
|
||||
inc(l,4-modulo)
|
||||
else
|
||||
if (l>=2) and ((modulo and 1)<>0) then
|
||||
inc(l,2-(modulo and 1));
|
||||
inc(owner^.datasize,l);
|
||||
address:=owner^.datasize;
|
||||
end;
|
||||
staticsymtable : begin
|
||||
if (cs_smartlink in aktmoduleswitches) then
|
||||
bsssegment^.concat(new(pai_cut,init));
|
||||
{$ifdef GDB}
|
||||
if cs_debuginfo in aktmoduleswitches then
|
||||
concatstabto(bsssegment);
|
||||
{$endif GDB}
|
||||
if (cs_smartlink in aktmoduleswitches) or
|
||||
((var_options and vo_is_c_var)<>0) then
|
||||
bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)))
|
||||
else
|
||||
bsssegment^.concat(new(pai_datablock,init(mangledname,l)));
|
||||
{ increase datasize }
|
||||
inc(owner^.datasize,l);
|
||||
{ this symbol can't be loaded to a register }
|
||||
var_options:=var_options and not vo_regable;
|
||||
end;
|
||||
globalsymtable : begin
|
||||
if (cs_smartlink in aktmoduleswitches) then
|
||||
bsssegment^.concat(new(pai_cut,init));
|
||||
{$ifdef GDB}
|
||||
if cs_debuginfo in aktmoduleswitches then
|
||||
concatstabto(bsssegment);
|
||||
{$endif GDB}
|
||||
bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)));
|
||||
inc(owner^.datasize,l);
|
||||
{ this symbol can't be loaded to a register }
|
||||
var_options:=var_options and not vo_regable;
|
||||
end;
|
||||
recordsymtable,
|
||||
objectsymtable : begin
|
||||
{ this symbol can't be loaded to a register }
|
||||
var_options:=var_options and not vo_regable;
|
||||
{ align record and object fields }
|
||||
if (l=1) or (aktpackrecords=1) then
|
||||
begin
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l)
|
||||
end
|
||||
else
|
||||
if (l=2) or (aktpackrecords=2) then
|
||||
begin
|
||||
owner^.datasize:=(owner^.datasize+1) and (not 1);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l)
|
||||
end
|
||||
else
|
||||
if (l<=4) or (aktpackrecords=4) then
|
||||
begin
|
||||
owner^.datasize:=(owner^.datasize+3) and (not 3);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l);
|
||||
end
|
||||
else
|
||||
if (l<=8) or (aktpackrecords=8) then
|
||||
begin
|
||||
owner^.datasize:=(owner^.datasize+7) and (not 7);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l);
|
||||
end
|
||||
else
|
||||
if (l<=16) or (aktpackrecords=16) then
|
||||
begin
|
||||
owner^.datasize:=(owner^.datasize+15) and (not 15);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l);
|
||||
end
|
||||
else
|
||||
if (l<=32) or (aktpackrecords=32) then
|
||||
begin
|
||||
owner^.datasize:=(owner^.datasize+31) and (not 31);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l);
|
||||
end;
|
||||
end;
|
||||
parasymtable : begin
|
||||
address:=owner^.datasize;
|
||||
owner^.datasize:=align(owner^.datasize+l,target_os.stackalignment);
|
||||
end
|
||||
else
|
||||
begin
|
||||
modulo:=owner^.datasize and 3 ;
|
||||
if (l>=4) and (modulo<>0) then
|
||||
inc(owner^.datasize,4-modulo)
|
||||
else
|
||||
if (l>=4) and (modulo<>0) then
|
||||
inc(l,4-modulo)
|
||||
else
|
||||
if (l>=2) and ((modulo and 1)<>0) then
|
||||
inc(owner^.datasize);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l);
|
||||
inc(l,2-(modulo and 1));
|
||||
inc(owner^.datasize,l);
|
||||
address:=owner^.datasize;
|
||||
end;
|
||||
staticsymtable :
|
||||
begin
|
||||
if (cs_smartlink in aktmoduleswitches) then
|
||||
bsssegment^.concat(new(pai_cut,init));
|
||||
{$ifdef GDB}
|
||||
if cs_debuginfo in aktmoduleswitches then
|
||||
concatstabto(bsssegment);
|
||||
{$endif GDB}
|
||||
if (cs_smartlink in aktmoduleswitches) or
|
||||
((var_options and vo_is_c_var)<>0) then
|
||||
bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)))
|
||||
else
|
||||
bsssegment^.concat(new(pai_datablock,init(mangledname,l)));
|
||||
{ increase datasize }
|
||||
inc(owner^.datasize,l);
|
||||
{ this symbol can't be loaded to a register }
|
||||
var_options:=var_options and not vo_regable;
|
||||
end;
|
||||
globalsymtable :
|
||||
begin
|
||||
if (cs_smartlink in aktmoduleswitches) then
|
||||
bsssegment^.concat(new(pai_cut,init));
|
||||
{$ifdef GDB}
|
||||
if cs_debuginfo in aktmoduleswitches then
|
||||
concatstabto(bsssegment);
|
||||
{$endif GDB}
|
||||
bsssegment^.concat(new(pai_datablock,init_global(mangledname,l)));
|
||||
inc(owner^.datasize,l);
|
||||
{ this symbol can't be loaded to a register }
|
||||
var_options:=var_options and not vo_regable;
|
||||
end;
|
||||
recordsymtable,
|
||||
objectsymtable :
|
||||
begin
|
||||
{ this symbol can't be loaded to a register }
|
||||
var_options:=var_options and not vo_regable;
|
||||
{ align record and object fields }
|
||||
if (l=1) or (aktpackrecords=1) then
|
||||
begin
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l)
|
||||
end
|
||||
else
|
||||
if (l=2) or (aktpackrecords=2) then
|
||||
begin
|
||||
owner^.datasize:=(owner^.datasize+1) and (not 1);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l)
|
||||
end
|
||||
else
|
||||
if (l<=4) or (aktpackrecords=4) then
|
||||
begin
|
||||
owner^.datasize:=(owner^.datasize+3) and (not 3);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l);
|
||||
end
|
||||
else
|
||||
if (l<=8) or (aktpackrecords=8) then
|
||||
begin
|
||||
owner^.datasize:=(owner^.datasize+7) and (not 7);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l);
|
||||
end
|
||||
else
|
||||
if (l<=16) or (aktpackrecords=16) then
|
||||
begin
|
||||
owner^.datasize:=(owner^.datasize+15) and (not 15);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l);
|
||||
end
|
||||
else
|
||||
if (l<=32) or (aktpackrecords=32) then
|
||||
begin
|
||||
owner^.datasize:=(owner^.datasize+31) and (not 31);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l);
|
||||
end;
|
||||
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
|
||||
else
|
||||
begin
|
||||
modulo:=owner^.datasize and 3 ;
|
||||
if (l>=4) and (modulo<>0) then
|
||||
inc(owner^.datasize,4-modulo)
|
||||
else
|
||||
if (l>=2) and ((modulo and 1)<>0) then
|
||||
inc(owner^.datasize);
|
||||
address:=owner^.datasize;
|
||||
inc(owner^.datasize,l);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$ifdef GDB}
|
||||
@ -1169,7 +1235,11 @@
|
||||
case varspez of
|
||||
vs_value : st := 'p';
|
||||
vs_var : st := 'v';
|
||||
{$ifdef VALUEPARA}
|
||||
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 }
|
||||
else
|
||||
st := 'p';
|
||||
@ -1733,7 +1803,10 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.60 1998-11-16 10:13:51 peter
|
||||
Revision 1.61 1998-11-18 15:44:18 peter
|
||||
* VALUEPARA for tp7 compatible value parameters
|
||||
|
||||
Revision 1.60 1998/11/16 10:13:51 peter
|
||||
* label defines are checked at the end of the proc
|
||||
|
||||
Revision 1.59 1998/11/13 12:09:11 peter
|
||||
|
||||
@ -173,6 +173,10 @@
|
||||
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;
|
||||
@ -188,6 +192,9 @@
|
||||
function mangledname : string;virtual;
|
||||
procedure insert_in_data;virtual;
|
||||
function getsize : longint;
|
||||
{$ifdef VALUEPARA}
|
||||
function getpushsize : longint;
|
||||
{$endif}
|
||||
procedure write;virtual;
|
||||
procedure deref;virtual;
|
||||
{$ifdef GDB}
|
||||
@ -319,7 +326,10 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.7 1998-11-16 10:13:50 peter
|
||||
Revision 1.8 1998-11-18 15:44:19 peter
|
||||
* VALUEPARA for tp7 compatible value parameters
|
||||
|
||||
Revision 1.7 1998/11/16 10:13:50 peter
|
||||
* label defines are checked at the end of the proc
|
||||
|
||||
Revision 1.6 1998/11/13 10:18:12 peter
|
||||
|
||||
@ -103,11 +103,15 @@ implementation
|
||||
p^.location.loc:=LOC_MEM;
|
||||
{ we need a register for call by reference parameters }
|
||||
if (pvarsym(p^.symtableentry)^.varspez=vs_var) or
|
||||
{$ifndef VALUEPARA}
|
||||
((pvarsym(p^.symtableentry)^.varspez=vs_const) and
|
||||
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}
|
||||
p^.registers32:=1;
|
||||
if p^.symtable^.symtabletype=withsymtable then
|
||||
inc(p^.registers32);
|
||||
@ -423,7 +427,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 1998-11-17 00:36:49 peter
|
||||
Revision 1.10 1998-11-18 15:44:23 peter
|
||||
* VALUEPARA for tp7 compatible value parameters
|
||||
|
||||
Revision 1.9 1998/11/17 00:36:49 peter
|
||||
* more ansistring fixes
|
||||
|
||||
Revision 1.8 1998/11/10 10:09:18 peter
|
||||
|
||||
@ -70,6 +70,9 @@ unit types;
|
||||
{ true if p is a pchar def }
|
||||
function is_pchar(p : pdef) : boolean;
|
||||
|
||||
{ true if p is a smallset def }
|
||||
function is_smallset(p : pdef) : boolean;
|
||||
|
||||
{ returns true, if def defines a signed data type (only for ordinal types) }
|
||||
function is_signed(def : pdef) : boolean;
|
||||
|
||||
@ -82,8 +85,13 @@ unit types;
|
||||
{ true if uses a parameter as return value }
|
||||
function ret_in_param(def : pdef) : boolean;
|
||||
|
||||
{$ifndef VALUEPARA}
|
||||
{ true if a const parameter is too large to copy }
|
||||
function dont_copy_const_param(def : pdef) : boolean;
|
||||
{$else}
|
||||
function push_addr_param(def : pdef) : boolean;
|
||||
{$endif}
|
||||
|
||||
{ true if we must never copy this parameter }
|
||||
const
|
||||
never_copy_const_param : boolean = false;
|
||||
@ -318,6 +326,14 @@ unit types;
|
||||
end;
|
||||
|
||||
|
||||
{ true if p is a smallset def }
|
||||
function is_smallset(p : pdef) : boolean;
|
||||
begin
|
||||
is_smallset:=(p^.deftype=setdef) and
|
||||
(psetdef(p)^.settype=smallset);
|
||||
end;
|
||||
|
||||
|
||||
{ true if the return value is in accumulator (EAX for i386), D0 for 68k }
|
||||
function ret_in_acc(def : pdef) : boolean;
|
||||
|
||||
@ -341,7 +357,7 @@ 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
|
||||
@ -350,7 +366,16 @@ unit types;
|
||||
((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
|
||||
push_addr_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;
|
||||
{$endif}
|
||||
|
||||
{ test if l is in the range of def, outputs error if out of range }
|
||||
procedure testrange(def : pdef;l : longint);
|
||||
@ -995,7 +1020,10 @@ unit types;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.37 1998-11-13 10:15:50 peter
|
||||
Revision 1.38 1998-11-18 15:44:24 peter
|
||||
* VALUEPARA for tp7 compatible value parameters
|
||||
|
||||
Revision 1.37 1998/11/13 10:15:50 peter
|
||||
* fixed ptr() with constants
|
||||
|
||||
Revision 1.36 1998/11/10 10:09:21 peter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user