* ansistring fixes, decr_ansistr called after all temp ansi reuses

This commit is contained in:
peter 1999-05-31 20:35:45 +00:00
parent 1c129626c0
commit 20d56ae2a4
3 changed files with 36 additions and 24 deletions

View File

@ -179,7 +179,8 @@ implementation
{ push data }
clear_location(p^.location);
p^.location.loc:=LOC_MEM;
gettempansistringreference(p^.location.reference);
if gettempansistringreference(p^.location.reference) then
decrstringref(cansistringdef,p^.location.reference);
emitpushreferenceaddr(p^.location.reference);
emit_push_loc(p^.right^.location);
emit_push_loc(p^.left^.location);
@ -2110,7 +2111,10 @@ implementation
end.
{
$Log$
Revision 1.62 1999-05-27 19:44:04 peter
Revision 1.63 1999-05-31 20:35:45 peter
* ansistring fixes, decr_ansistr called after all temp ansi reuses
Revision 1.62 1999/05/27 19:44:04 peter
* removed oldasm
* plabel -> pasmlabel
* -a switches to source writing automaticly

View File

@ -312,7 +312,8 @@ implementation
begin
clear_location(pto^.location);
pto^.location.loc:=LOC_REFERENCE;
gettempansistringreference(pto^.location.reference);
if gettempansistringreference(pto^.location.reference) then
decrstringref(cansistringdef,pto^.location.reference);
pushusedregisters(pushed,$ff);
emit_push_lea_loc(pfrom^.location);
emit_push_lea_loc(pto^.location);
@ -489,7 +490,8 @@ implementation
end;
st_ansistring :
begin
gettempansistringreference(pto^.location.reference);
if gettempansistringreference(pto^.location.reference) then
decrstringref(cansistringdef,pto^.location.reference);
release_loc(pfrom^.location);
pushusedregisters(pushed,$ff);
push_int(l);
@ -534,7 +536,8 @@ implementation
end;
st_ansistring :
begin
gettempansistringreference(pto^.location.reference);
if gettempansistringreference(pto^.location.reference) then
decrstringref(cansistringdef,pto^.location.reference);
release_loc(pfrom^.location);
pushusedregisters(pushed,$ff);
emit_pushw_loc(pfrom^.location);
@ -1052,7 +1055,8 @@ implementation
st_ansistring:
begin
pto^.location.loc:=LOC_REFERENCE;
gettempansistringreference(pto^.location.reference);
if gettempansistringreference(pto^.location.reference) then
decrstringref(cansistringdef,pto^.location.reference);
case pfrom^.location.loc of
LOC_REFERENCE,LOC_MEM:
begin
@ -1296,7 +1300,10 @@ implementation
end.
{
$Log$
Revision 1.74 1999-05-27 19:44:09 peter
Revision 1.75 1999-05-31 20:35:46 peter
* ansistring fixes, decr_ansistr called after all temp ansi reuses
Revision 1.74 1999/05/27 19:44:09 peter
* removed oldasm
* plabel -> pasmlabel
* -a switches to source writing automaticly

View File

@ -76,7 +76,8 @@ unit temp_gen;
function istemp(const ref : treference) : boolean;
procedure ungetiftemp(const ref : treference);
function ungetiftempansi(const ref : treference) : boolean;
procedure gettempansistringreference(var ref : treference);
function gettempansistringreference(var ref : treference):boolean;
implementation
@ -287,11 +288,13 @@ unit temp_gen;
end;
function gettempansioffset : longint;
function gettempansistringreference(var ref : treference):boolean;
var
ofs : longint;
foundslot,tl : ptemprecord;
begin
{ do a reset, because the reference isn't used }
reset_reference(ref);
ref.base:=procinfo.framepointer;
{ Reuse old ansi slot ? }
foundslot:=nil;
tl:=templist;
@ -310,27 +313,22 @@ unit temp_gen;
if assigned(foundslot) then
begin
foundslot^.temptype:=tt_ansistring;
ofs:=foundslot^.pos;
ref.offset:=foundslot^.pos;
{ we're reusing an old slot then set the function result to true
so that we can call a decr_ansistr }
gettempansistringreference:=true;
end
else
begin
ofs:=newtempofsize(target_os.size_of_pointer);
ref.offset:=newtempofsize(target_os.size_of_pointer);
{$ifdef EXTDEBUG}
templist^.posinfo:=aktfilepos;
{$endif}
templist^.temptype:=tt_ansistring;
{ set result to false, we don't need an decr_ansistr }
gettempansistringreference:=false;
end;
exprasmlist^.concat(new(paitempalloc,alloc(ofs,target_os.size_of_pointer)));
gettempansioffset:=ofs;
end;
procedure gettempansistringreference(var ref : treference);
begin
{ do a reset, because the reference isn't used }
reset_reference(ref);
ref.offset:=gettempansioffset;
ref.base:=procinfo.framepointer;
exprasmlist^.concat(new(paitempalloc,alloc(ref.offset,target_os.size_of_pointer)));
end;
@ -526,7 +524,10 @@ begin
end.
{
$Log$
Revision 1.29 1999-05-27 19:45:26 peter
Revision 1.30 1999-05-31 20:35:47 peter
* ansistring fixes, decr_ansistr called after all temp ansi reuses
Revision 1.29 1999/05/27 19:45:26 peter
* removed oldasm
* plabel -> pasmlabel
* -a switches to source writing automaticly