mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-22 14:09:13 +02:00
* fixed some bugs related to temp. ansistrings and functions results
which return records/objects/arrays which need init/final.
This commit is contained in:
parent
e8bf496ae8
commit
d7b52d0183
@ -179,7 +179,7 @@ implementation
|
||||
end;
|
||||
|
||||
{ push the still used registers }
|
||||
pushusedregisters(pushedregs,$ff);
|
||||
pushusedregisters(exprasmlist,pushedregs,$ff);
|
||||
{ push data }
|
||||
clear_location(p^.location);
|
||||
p^.location.loc:=LOC_MEM;
|
||||
@ -188,7 +188,7 @@ implementation
|
||||
emit_push_loc(p^.right^.location);
|
||||
emit_push_loc(p^.left^.location);
|
||||
emitcall('FPC_ANSISTR_CONCAT',true);
|
||||
popusedregisters(pushedregs);
|
||||
popusedregisters(exprasmlist,pushedregs);
|
||||
maybe_loadesi;
|
||||
ungetiftempansi(p^.left^.location.reference);
|
||||
ungetiftempansi(p^.right^.location.reference);
|
||||
@ -214,7 +214,7 @@ implementation
|
||||
ungetregister32(p^.left^.location.register);
|
||||
end;
|
||||
{ push the still used registers }
|
||||
pushusedregisters(pushedregs,$ff);
|
||||
pushusedregisters(exprasmlist,pushedregs,$ff);
|
||||
{ push data }
|
||||
case p^.right^.location.loc of
|
||||
LOC_REFERENCE,LOC_MEM:
|
||||
@ -230,7 +230,7 @@ implementation
|
||||
end;
|
||||
emitcall('FPC_ANSISTR_COMPARE',true);
|
||||
emit_reg_reg(A_OR,S_L,R_EAX,R_EAX);
|
||||
popusedregisters(pushedregs);
|
||||
popusedregisters(exprasmlist,pushedregs);
|
||||
maybe_loadesi;
|
||||
{ done in temptoremove (PM)
|
||||
ungetiftemp(p^.left^.location.reference);
|
||||
@ -274,7 +274,7 @@ implementation
|
||||
{ on the right we do not need the register anymore too }
|
||||
{$IfNDef regallocfix}
|
||||
del_reference(p^.right^.location.reference);
|
||||
pushusedregisters(pushedregs,$ff);
|
||||
pushusedregisters(exprasmlist,pushedregs,$ff);
|
||||
{$Else regallocfix}
|
||||
pushusedregisters(pushedregs,$ff
|
||||
xor ($80 shr byte(p^.right^.location.reference.base))
|
||||
@ -287,7 +287,7 @@ implementation
|
||||
{$EndIf regallocfix}
|
||||
emitcall('FPC_SHORTSTR_CONCAT',true);
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushedregs);
|
||||
popusedregisters(exprasmlist,pushedregs);
|
||||
|
||||
set_location(p^.location,p^.left^.location);
|
||||
ungetiftemp(p^.right^.location.reference);
|
||||
@ -320,7 +320,7 @@ implementation
|
||||
end
|
||||
else
|
||||
begin
|
||||
pushusedregisters(pushedregs,$ff);
|
||||
pushusedregisters(exprasmlist,pushedregs,$ff);
|
||||
secondpass(p^.left);
|
||||
emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
|
||||
del_reference(p^.left^.location.reference);
|
||||
@ -329,7 +329,7 @@ implementation
|
||||
del_reference(p^.right^.location.reference);
|
||||
emitcall('FPC_SHORTSTR_COMPARE',true);
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushedregs);
|
||||
popusedregisters(exprasmlist,pushedregs);
|
||||
end;
|
||||
ungetiftemp(p^.left^.location.reference);
|
||||
ungetiftemp(p^.right^.location.reference);
|
||||
@ -403,7 +403,7 @@ implementation
|
||||
{$IfNDef regallocfix}
|
||||
del_reference(p^.left^.location.reference);
|
||||
del_reference(p^.right^.location.reference);
|
||||
pushusedregisters(pushedregs,$ff);
|
||||
pushusedregisters(exprasmlist,pushedregs,$ff);
|
||||
{$EndIf regallocfix}
|
||||
{$IfNDef NoSetInclusion}
|
||||
If (p^.treetype in [equaln, unequaln, lten]) Then
|
||||
@ -439,7 +439,7 @@ implementation
|
||||
End;
|
||||
{$EndIf NoSetInclusion}
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushedregs);
|
||||
popusedregisters(exprasmlist,pushedregs);
|
||||
ungetiftemp(p^.left^.location.reference);
|
||||
ungetiftemp(p^.right^.location.reference);
|
||||
end;
|
||||
@ -448,7 +448,7 @@ implementation
|
||||
{$IfNDef regallocfix}
|
||||
del_reference(p^.left^.location.reference);
|
||||
del_reference(p^.right^.location.reference);
|
||||
pushusedregisters(pushedregs,$ff);
|
||||
pushusedregisters(exprasmlist,pushedregs,$ff);
|
||||
{$EndIf regallocfix}
|
||||
href.symbol:=nil;
|
||||
gettempofsizereference(32,href);
|
||||
@ -502,7 +502,7 @@ implementation
|
||||
end;
|
||||
end;
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushedregs);
|
||||
popusedregisters(exprasmlist,pushedregs);
|
||||
ungetiftemp(p^.left^.location.reference);
|
||||
ungetiftemp(p^.right^.location.reference);
|
||||
p^.location.loc:=LOC_MEM;
|
||||
@ -514,7 +514,7 @@ implementation
|
||||
{$IfNDef regallocfix}
|
||||
del_reference(p^.left^.location.reference);
|
||||
del_reference(p^.right^.location.reference);
|
||||
pushusedregisters(pushedregs,$ff);
|
||||
pushusedregisters(exprasmlist,pushedregs,$ff);
|
||||
{$EndIf regallocfix}
|
||||
href.symbol:=nil;
|
||||
gettempofsizereference(32,href);
|
||||
@ -533,7 +533,7 @@ implementation
|
||||
muln : emitcall('FPC_SET_MUL_SETS',true);
|
||||
end;
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushedregs);
|
||||
popusedregisters(exprasmlist,pushedregs);
|
||||
ungetiftemp(p^.left^.location.reference);
|
||||
ungetiftemp(p^.right^.location.reference);
|
||||
p^.location.loc:=LOC_MEM;
|
||||
@ -1454,7 +1454,7 @@ implementation
|
||||
release_qword_loc(p^.right^.location);
|
||||
p^.location.registerlow:=getexplicitregister32(R_EAX);
|
||||
p^.location.registerhigh:=getexplicitregister32(R_EDX);
|
||||
pushusedregisters(pushedreg,$ff
|
||||
pushusedregisters(exprasmlist,pushedreg,$ff
|
||||
and not($80 shr byte(p^.location.registerlow))
|
||||
and not($80 shr byte(p^.location.registerhigh)));
|
||||
if cs_check_overflow in aktlocalswitches then
|
||||
@ -1469,7 +1469,7 @@ implementation
|
||||
emitcall('FPC_MUL_INT64',true);
|
||||
emit_reg_reg(A_MOV,S_L,R_EAX,p^.location.registerlow);
|
||||
emit_reg_reg(A_MOV,S_L,R_EDX,p^.location.registerhigh);
|
||||
popusedregisters(pushedreg);
|
||||
popusedregisters(exprasmlist,pushedreg);
|
||||
p^.location.loc:=LOC_REGISTER;
|
||||
end
|
||||
else
|
||||
@ -2028,7 +2028,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.57 1999-05-18 14:15:18 peter
|
||||
Revision 1.58 1999-05-18 21:58:22 florian
|
||||
* fixed some bugs related to temp. ansistrings and functions results
|
||||
which return records/objects/arrays which need init/final.
|
||||
|
||||
Revision 1.57 1999/05/18 14:15:18 peter
|
||||
* containsself fixes
|
||||
* checktypes()
|
||||
|
||||
|
@ -287,14 +287,14 @@ implementation
|
||||
iolabel:=nil;
|
||||
|
||||
{ save all used registers }
|
||||
pushusedregisters(pushed,pprocdef(p^.procdefinition)^.usedregisters);
|
||||
pushusedregisters(exprasmlist,pushed,pprocdef(p^.procdefinition)^.usedregisters);
|
||||
|
||||
{ give used registers through }
|
||||
usedinproc:=usedinproc or pprocdef(p^.procdefinition)^.usedregisters;
|
||||
end
|
||||
else
|
||||
begin
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
usedinproc:=$ff;
|
||||
{ no IO check for methods and procedure variables }
|
||||
iolabel:=nil;
|
||||
@ -1008,32 +1008,15 @@ implementation
|
||||
is_widestring(p^.resulttype) then
|
||||
begin
|
||||
gettempansistringreference(hr);
|
||||
{ cleanup the temp slot }
|
||||
exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,R_EAX)));
|
||||
decrstringref(exprasmlist,p^.resulttype,hr);
|
||||
exprasmlist^.concat(new(pai386,op_reg(A_POP,S_L,R_EAX)));
|
||||
|
||||
exprasmlist^.concat(new(pai386,op_reg_ref(A_MOV,S_L,R_EAX,
|
||||
newreference(hr))));
|
||||
p^.location.loc:=LOC_REFERENCE;
|
||||
p^.location.loc:=LOC_MEM;
|
||||
p^.location.reference:=hr;
|
||||
{ unnessary ansi/wide strings are imm. disposed }
|
||||
if not(p^.return_value_used) then
|
||||
begin
|
||||
pushusedregisters(pushedregs,$ff);
|
||||
emitpushreferenceaddr(exprasmlist,hr);
|
||||
if is_ansistring(p^.resulttype) then
|
||||
begin
|
||||
exprasmlist^.concat(new(pai386,
|
||||
op_sym(A_CALL,S_NO,newasmsymbol('FPC_ANSISTR_DECR_REF'))));
|
||||
if not (cs_compilesystem in aktmoduleswitches) then
|
||||
concat_external('FPC_ANSISTR_DECR_REF',EXT_NEAR);
|
||||
end
|
||||
else
|
||||
begin
|
||||
exprasmlist^.concat(new(pai386,
|
||||
op_sym(A_CALL,S_NO,newasmsymbol('FPC_WIDESTR_DECR_REF'))));
|
||||
if not (cs_compilesystem in aktmoduleswitches) then
|
||||
concat_external('FPC_WIDESTR_DECR_REF',EXT_NEAR);
|
||||
end;
|
||||
ungetiftemp(hr);
|
||||
popusedregisters(pushedregs);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -1062,7 +1045,7 @@ implementation
|
||||
exprasmlist^.concat(new(pai386,op_const_reg(A_ADD,S_L,pop_size,R_ESP)));
|
||||
|
||||
{ restore registers }
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
|
||||
{ at last, restore instance pointer (SELF) }
|
||||
if loadesi then
|
||||
@ -1106,8 +1089,15 @@ implementation
|
||||
if (not p^.return_value_used) and (p^.resulttype<>pdef(voiddef)) then
|
||||
begin
|
||||
if p^.location.loc in [LOC_MEM,LOC_REFERENCE] then
|
||||
{ release unused temp }
|
||||
ungetiftemp(p^.location.reference)
|
||||
begin
|
||||
{ data which must be finalized ? }
|
||||
if (p^.resulttype^.needs_inittable) and
|
||||
( (p^.resulttype^.deftype<>objectdef) or
|
||||
not(pobjectdef(p^.resulttype)^.isclass)) then
|
||||
finalize(exprasmlist,p^.resulttype,p^.location.reference);
|
||||
{ release unused temp }
|
||||
ungetiftemp(p^.location.reference)
|
||||
end
|
||||
else if p^.location.loc=LOC_FPU then
|
||||
{ release FPU stack }
|
||||
exprasmlist^.concat(new(pai386,op_reg(A_FSTP,S_NO,R_ST0)));
|
||||
@ -1192,7 +1182,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.82 1999-05-18 14:15:23 peter
|
||||
Revision 1.83 1999-05-18 21:58:24 florian
|
||||
* fixed some bugs related to temp. ansistrings and functions results
|
||||
which return records/objects/arrays which need init/final.
|
||||
|
||||
Revision 1.82 1999/05/18 14:15:23 peter
|
||||
* containsself fixes
|
||||
* checktypes()
|
||||
|
||||
|
@ -136,7 +136,7 @@ implementation
|
||||
ungetiftemp(source^.location.reference);
|
||||
{$IfNDef regallocfix}
|
||||
del_reference(source^.location.reference);
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
emit_push_mem(source^.location.reference);
|
||||
{$Else regallocfix}
|
||||
pushusedregisters(pushed,$ff
|
||||
@ -150,7 +150,7 @@ implementation
|
||||
begin
|
||||
{$IfNDef regallocfix}
|
||||
ungetregister32(source^.location.register);
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,source^.location.register)));
|
||||
{$Else regallocfix}
|
||||
pushusedregisters(pushed, $ff xor ($80 shr byte(source^.location.register)));
|
||||
@ -162,7 +162,7 @@ implementation
|
||||
push_shortstring_length(dest);
|
||||
emitpushreferenceaddr(exprasmlist,dest^.location.reference);
|
||||
emitcall('FPC_ANSISTR_TO_SHORTSTR',true);
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
maybe_loadesi;
|
||||
end;
|
||||
|
||||
@ -317,12 +317,12 @@ implementation
|
||||
clear_location(pto^.location);
|
||||
pto^.location.loc:=LOC_REFERENCE;
|
||||
gettempansistringreference(pto^.location.reference);
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
emit_push_lea_loc(pfrom^.location);
|
||||
emit_push_lea_loc(pto^.location);
|
||||
emitcall('FPC_SHORTSTR_TO_ANSISTR',true);
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
|
||||
ungetiftemp(pfrom^.location.reference);
|
||||
end;
|
||||
@ -495,12 +495,12 @@ implementation
|
||||
begin
|
||||
gettempansistringreference(pto^.location.reference);
|
||||
release_loc(pfrom^.location);
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
push_int(l);
|
||||
emitpushreferenceaddr(exprasmlist,pfrom^.location.reference);
|
||||
emitpushreferenceaddr(exprasmlist,pto^.location.reference);
|
||||
emitcall('FPC_CHARARRAY_TO_ANSISTR',true);
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
maybe_loadesi;
|
||||
end;
|
||||
st_longstring:
|
||||
@ -540,11 +540,11 @@ implementation
|
||||
begin
|
||||
gettempansistringreference(pto^.location.reference);
|
||||
release_loc(pfrom^.location);
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
emit_pushw_loc(pfrom^.location);
|
||||
emitpushreferenceaddr(exprasmlist,pto^.location.reference);
|
||||
emitcall('FPC_CHAR_TO_ANSISTR',true);
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
maybe_loadesi;
|
||||
end;
|
||||
else
|
||||
@ -976,13 +976,13 @@ implementation
|
||||
pushedregs : tpushed;
|
||||
begin
|
||||
href.symbol:=nil;
|
||||
pushusedregisters(pushedregs,$ff);
|
||||
pushusedregisters(exprasmlist,pushedregs,$ff);
|
||||
gettempofsizereference(32,href);
|
||||
emitpushreferenceaddr(exprasmlist,pfrom^.location.reference);
|
||||
emitpushreferenceaddr(exprasmlist,href);
|
||||
emitcall('FPC_SET_LOAD_SMALL',true);
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushedregs);
|
||||
popusedregisters(exprasmlist,pushedregs);
|
||||
clear_location(pto^.location);
|
||||
pto^.location.loc:=LOC_MEM;
|
||||
pto^.location.reference:=href;
|
||||
@ -1035,7 +1035,7 @@ implementation
|
||||
begin
|
||||
pto^.location.loc:=LOC_REFERENCE;
|
||||
gettempofsizereference(pto^.resulttype^.size,pto^.location.reference);
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
case pfrom^.location.loc of
|
||||
LOC_REGISTER,LOC_CREGISTER:
|
||||
begin
|
||||
@ -1051,7 +1051,7 @@ implementation
|
||||
emitpushreferenceaddr(exprasmlist,pto^.location.reference);
|
||||
emitcall('FPC_PCHAR_TO_SHORTSTR',true);
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
end;
|
||||
st_ansistring:
|
||||
begin
|
||||
@ -1062,7 +1062,7 @@ implementation
|
||||
begin
|
||||
{$IfNDef regallocfix}
|
||||
del_reference(pfrom^.location.reference);
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
emit_push_mem(pfrom^.location.reference);
|
||||
{$Else regallocfix}
|
||||
pushusedregisters(pushed,$ff
|
||||
@ -1076,7 +1076,7 @@ implementation
|
||||
begin
|
||||
{$IfNDef regallocfix}
|
||||
ungetregister32(pfrom^.location.register);
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,pfrom^.location.register)));
|
||||
{$Else regallocfix}
|
||||
pushusedregisters(pushed, $ff xor ($80 shr byte(pfrom^.location.register)));
|
||||
@ -1088,7 +1088,7 @@ implementation
|
||||
emitpushreferenceaddr(exprasmlist,pto^.location.reference);
|
||||
emitcall('FPC_PCHAR_TO_ANSISTR',true);
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
end;
|
||||
else
|
||||
begin
|
||||
@ -1205,7 +1205,7 @@ implementation
|
||||
|
||||
begin
|
||||
{ save all used registers }
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
secondpass(p^.left);
|
||||
clear_location(p^.location);
|
||||
p^.location.loc:=LOC_FLAGS;
|
||||
@ -1247,7 +1247,7 @@ implementation
|
||||
end;
|
||||
emitcall('FPC_DO_IS',true);
|
||||
exprasmlist^.concat(new(pai386,op_reg_reg(A_OR,S_B,R_AL,R_AL)));
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
maybe_loadesi;
|
||||
end;
|
||||
|
||||
@ -1262,7 +1262,7 @@ implementation
|
||||
begin
|
||||
secondpass(p^.left);
|
||||
{ save all used registers }
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
|
||||
{ push instance to check: }
|
||||
case p^.left^.location.loc of
|
||||
@ -1298,14 +1298,18 @@ implementation
|
||||
emitcall('FPC_DO_AS',true);
|
||||
{ restore register, this restores automatically the }
|
||||
{ result }
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.72 1999-05-17 21:57:00 florian
|
||||
Revision 1.73 1999-05-18 21:58:26 florian
|
||||
* fixed some bugs related to temp. ansistrings and functions results
|
||||
which return records/objects/arrays which need init/final.
|
||||
|
||||
Revision 1.72 1999/05/17 21:57:00 florian
|
||||
* new temporary ansistring handling
|
||||
|
||||
Revision 1.71 1999/05/12 00:19:40 peter
|
||||
|
@ -275,7 +275,7 @@ implementation
|
||||
|
||||
while assigned(node) do
|
||||
begin
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
hp:=node;
|
||||
node:=node^.right;
|
||||
hp^.right:=nil;
|
||||
@ -429,14 +429,14 @@ implementation
|
||||
end;
|
||||
end;
|
||||
{ load ESI in methods again }
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
maybe_loadesi;
|
||||
end;
|
||||
end;
|
||||
{ Insert end of writing for textfiles }
|
||||
if ft=ft_text then
|
||||
begin
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
emit_push_mem(aktfile);
|
||||
if doread then
|
||||
begin
|
||||
@ -452,7 +452,7 @@ implementation
|
||||
else
|
||||
emitcall('FPC_WRITE_END',true);
|
||||
end;
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
maybe_loadesi;
|
||||
end;
|
||||
{ Insert IOCheck if set }
|
||||
@ -490,7 +490,7 @@ implementation
|
||||
procedureprefix : string;
|
||||
|
||||
begin
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
node:=p^.left;
|
||||
is_real:=false;
|
||||
has_length:=false;
|
||||
@ -604,7 +604,7 @@ implementation
|
||||
end;
|
||||
disposetree(hp);
|
||||
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
end;
|
||||
|
||||
{$IfnDef OLDVAL}
|
||||
@ -656,7 +656,7 @@ implementation
|
||||
exit;
|
||||
|
||||
{save the regvars}
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
|
||||
{now that we've already pushed the addres of dest_para^.left on the
|
||||
stack, we can put the real parameters on the stack}
|
||||
@ -721,7 +721,7 @@ implementation
|
||||
|
||||
{ restore the register vars}
|
||||
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
|
||||
If has_code and Not(has_32bit_code) Then
|
||||
{only 16bit code is possible}
|
||||
@ -1123,7 +1123,7 @@ implementation
|
||||
end;
|
||||
in_reset_typedfile,in_rewrite_typedfile :
|
||||
begin
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
exprasmlist^.concat(new(pai386,op_const(A_PUSH,S_L,pfiledef(p^.left^.resulttype)^.typed_as^.size)));
|
||||
secondpass(p^.left);
|
||||
emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
|
||||
@ -1131,7 +1131,7 @@ implementation
|
||||
emitcall('FPC_RESET_TYPED',true)
|
||||
else
|
||||
emitcall('FPC_REWRITE_TYPED',true);
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
end;
|
||||
in_write_x :
|
||||
handlereadwrite(false,false);
|
||||
@ -1238,7 +1238,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.50 1999-05-17 21:57:03 florian
|
||||
Revision 1.51 1999-05-18 21:58:27 florian
|
||||
* fixed some bugs related to temp. ansistrings and functions results
|
||||
which return records/objects/arrays which need init/final.
|
||||
|
||||
Revision 1.50 1999/05/17 21:57:03 florian
|
||||
* new temporary ansistring handling
|
||||
|
||||
Revision 1.49 1999/05/12 15:46:26 pierre
|
||||
|
@ -94,7 +94,7 @@ implementation
|
||||
end
|
||||
else
|
||||
begin
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
|
||||
{ code copied from simplenewdispose PM }
|
||||
{ determines the size of the mem block }
|
||||
@ -115,7 +115,7 @@ implementation
|
||||
dispose(r);
|
||||
emitcall('FPC_INITIALIZE',true);
|
||||
end;
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
{ may be load ESI }
|
||||
maybe_loadesi;
|
||||
end;
|
||||
@ -169,7 +169,7 @@ implementation
|
||||
if codegenerror then
|
||||
exit;
|
||||
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
{ determines the size of the mem block }
|
||||
push_int(ppointerdef(p^.left^.resulttype)^.definition^.size);
|
||||
|
||||
@ -224,7 +224,7 @@ implementation
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
{ may be load ESI }
|
||||
maybe_loadesi;
|
||||
end;
|
||||
@ -438,14 +438,14 @@ implementation
|
||||
CGMessage(cg_e_illegal_expression);
|
||||
exit;
|
||||
end;
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
emitpushreferenceaddr(exprasmlist,p^.left^.location.reference);
|
||||
if is_ansistring(p^.left^.resulttype) then
|
||||
emitcall('FPC_ANSISTR_UNIQUE',true)
|
||||
else
|
||||
emitcall('FPC_WIDESTR_UNIQUE',true);
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
end;
|
||||
|
||||
if p^.left^.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
|
||||
@ -465,11 +465,11 @@ implementation
|
||||
we can use the ansistring routine here }
|
||||
if (cs_check_range in aktlocalswitches) then
|
||||
begin
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,p^.location.reference.base)));
|
||||
emitcall('FPC_ANSISTR_CHECKZERO',true);
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
end;
|
||||
|
||||
if is_ansistring(p^.left^.resulttype) then
|
||||
@ -529,13 +529,13 @@ implementation
|
||||
st_widestring,
|
||||
st_ansistring:
|
||||
begin
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
push_int(p^.right^.value);
|
||||
hp:=newreference(p^.location.reference);
|
||||
dec(hp^.offset,7);
|
||||
exprasmlist^.concat(new(pai386,op_ref(A_PUSH,S_L,hp)));
|
||||
emitcall('FPC_ANSISTR_RANGECHECK',true);
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
maybe_loadesi;
|
||||
end;
|
||||
|
||||
@ -710,13 +710,13 @@ implementation
|
||||
st_widestring,
|
||||
st_ansistring:
|
||||
begin
|
||||
pushusedregisters(pushed,$ff);
|
||||
pushusedregisters(exprasmlist,pushed,$ff);
|
||||
exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,ind)));
|
||||
hp:=newreference(p^.location.reference);
|
||||
dec(hp^.offset,7);
|
||||
exprasmlist^.concat(new(pai386,op_ref(A_PUSH,S_L,hp)));
|
||||
emitcall('FPC_ANSISTR_RANGECHECK',true);
|
||||
popusedregisters(pushed);
|
||||
popusedregisters(exprasmlist,pushed);
|
||||
maybe_loadesi;
|
||||
end;
|
||||
st_shortstring:
|
||||
@ -884,7 +884,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.40 1999-05-18 14:15:26 peter
|
||||
Revision 1.41 1999-05-18 21:58:29 florian
|
||||
* fixed some bugs related to temp. ansistrings and functions results
|
||||
which return records/objects/arrays which need init/final.
|
||||
|
||||
Revision 1.40 1999/05/18 14:15:26 peter
|
||||
* containsself fixes
|
||||
* checktypes()
|
||||
|
||||
|
@ -1054,6 +1054,15 @@ implementation
|
||||
p^.registers32:=2
|
||||
else
|
||||
p^.registers32:=1;
|
||||
|
||||
{ wide- and ansistrings are returned in EAX }
|
||||
{ but they are imm. moved to a memory location }
|
||||
if is_widestring(p^.resulttype) or
|
||||
is_ansistring(p^.resulttype) then
|
||||
begin
|
||||
p^.location.loc:=LOC_MEM;
|
||||
p^.registers32:=0;
|
||||
end;
|
||||
end
|
||||
else if (p^.resulttype^.deftype=floatdef) then
|
||||
begin
|
||||
@ -1147,7 +1156,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.43 1999-05-18 14:15:58 peter
|
||||
Revision 1.44 1999-05-18 21:58:33 florian
|
||||
* fixed some bugs related to temp. ansistrings and functions results
|
||||
which return records/objects/arrays which need init/final.
|
||||
|
||||
Revision 1.43 1999/05/18 14:15:58 peter
|
||||
* containsself fixes
|
||||
* checktypes()
|
||||
|
||||
|
@ -63,8 +63,8 @@ unit tgeni386;
|
||||
|
||||
|
||||
{ pushs and restores registers }
|
||||
procedure pushusedregisters(var pushed : tpushed;b : byte);
|
||||
procedure popusedregisters(const pushed : tpushed);
|
||||
procedure pushusedregisters(list : paasmoutput;var pushed : tpushed;b : byte);
|
||||
procedure popusedregisters(list : paasmoutput;const pushed : tpushed);
|
||||
|
||||
procedure clearregistercount;
|
||||
procedure resetusableregisters;
|
||||
@ -92,7 +92,7 @@ implementation
|
||||
uses
|
||||
globtype;
|
||||
|
||||
procedure pushusedregisters(var pushed : tpushed;b : byte);
|
||||
procedure pushusedregisters(list : paasmoutput;var pushed : tpushed;b : byte);
|
||||
|
||||
var
|
||||
r : tregister;
|
||||
@ -112,7 +112,7 @@ implementation
|
||||
if not(r in unused) then
|
||||
begin
|
||||
{ then save it }
|
||||
exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,r)));
|
||||
list^.concat(new(pai386,op_reg(A_PUSH,S_L,r)));
|
||||
{ here was a big problem !!!!!}
|
||||
{ you cannot do that for a register that is
|
||||
globally assigned to a var
|
||||
@ -132,12 +132,12 @@ implementation
|
||||
{ if the mmx register is in use, save it }
|
||||
if not(r in unused) then
|
||||
begin
|
||||
exprasmlist^.concat(new(pai386,op_const_reg(
|
||||
list^.concat(new(pai386,op_const_reg(
|
||||
A_SUB,S_L,8,R_ESP)));
|
||||
new(hr);
|
||||
reset_reference(hr^);
|
||||
hr^.base:=R_ESP;
|
||||
exprasmlist^.concat(new(pai386,op_reg_ref(
|
||||
list^.concat(new(pai386,op_reg_ref(
|
||||
A_MOVQ,S_NO,r,hr)));
|
||||
if not(is_reg_var[r]) then
|
||||
unused:=unused+[r];
|
||||
@ -147,7 +147,7 @@ implementation
|
||||
{$endif SUPPORT_MMX}
|
||||
end;
|
||||
|
||||
procedure popusedregisters(const pushed : tpushed);
|
||||
procedure popusedregisters(list : paasmoutput;const pushed : tpushed);
|
||||
|
||||
var
|
||||
r : tregister;
|
||||
@ -164,9 +164,9 @@ implementation
|
||||
new(hr);
|
||||
reset_reference(hr^);
|
||||
hr^.base:=R_ESP;
|
||||
exprasmlist^.concat(new(pai386,op_ref_reg(
|
||||
list^.concat(new(pai386,op_ref_reg(
|
||||
A_MOVQ,S_NO,hr,r)));
|
||||
exprasmlist^.concat(new(pai386,op_const_reg(
|
||||
list^.concat(new(pai386,op_const_reg(
|
||||
A_ADD,S_L,8,R_ESP)));
|
||||
unused:=unused-[r];
|
||||
end;
|
||||
@ -175,7 +175,7 @@ implementation
|
||||
for r:=R_EBX downto R_EAX do
|
||||
if pushed[r] then
|
||||
begin
|
||||
exprasmlist^.concat(new(pai386,op_reg(A_POP,S_L,r)));
|
||||
list^.concat(new(pai386,op_reg(A_POP,S_L,r)));
|
||||
unused:=unused-[r];
|
||||
end;
|
||||
end;
|
||||
@ -373,7 +373,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.23 1999-05-01 13:25:01 peter
|
||||
Revision 1.24 1999-05-18 21:58:34 florian
|
||||
* fixed some bugs related to temp. ansistrings and functions results
|
||||
which return records/objects/arrays which need init/final.
|
||||
|
||||
Revision 1.23 1999/05/01 13:25:01 peter
|
||||
* merged nasm compiler
|
||||
* old asm moved to oldasm/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user