* fixed with <calln> do

* fixed finalize/initialize call for new/dispose
This commit is contained in:
peter 1999-09-10 15:42:50 +00:00
parent ee77c458c2
commit 9ef54daf28
2 changed files with 45 additions and 24 deletions

View File

@ -104,9 +104,10 @@ implementation
reset_reference(r^);
r^.symbol:=ppointerdef(p^.left^.resulttype)^.definition^.get_inittable_label;
emitpushreferenceaddr(r^);
{ push pointer adress }
emitpushreferenceaddr(p^.location.reference);
dispose(r);
{ push pointer we just allocated, we need to initialize the
data located at that pointer not the pointer self (PFV) }
emit_push_loc(p^.location);
emitcall('FPC_INITIALIZE');
end;
popusedregisters(pushed);
@ -186,14 +187,9 @@ implementation
reset_reference(r^);
r^.symbol:=ppointerdef(p^.left^.resulttype)^.definition^.get_inittable_label;
emitpushreferenceaddr(r^);
{ push pointer adress }
case p^.left^.location.loc of
LOC_CREGISTER : emit_reg(A_PUSH,S_L,
p^.left^.location.register);
LOC_REFERENCE:
emitpushreferenceaddr(p^.left^.location.reference);
end;
dispose(r);
{ push pointer adress }
emit_push_loc(p^.left^.location);
emitcall('FPC_FINALIZE');
end;
emitcall('FPC_FREEMEM');
@ -207,14 +203,8 @@ implementation
reset_reference(r^);
r^.symbol:=ppointerdef(p^.left^.resulttype)^.definition^.get_inittable_label;
emitpushreferenceaddr(r^);
{ push pointer adress }
case p^.left^.location.loc of
LOC_CREGISTER : emit_reg(A_PUSH,S_L,
p^.left^.location.register);
LOC_REFERENCE:
emitpushreferenceaddr(p^.left^.location.reference);
end;
dispose(r);
emit_push_loc(p^.left^.location);
emitcall('FPC_INITIALIZE');
end;
end;
@ -810,17 +800,17 @@ implementation
p^.islocal:=true;
end
else
if (p^.left^.resulttype^.deftype=objectdef) and
{ call can happend with a property }
if (p^.left^.treetype=calln) and
(p^.left^.resulttype^.deftype=objectdef) and
pobjectdef(p^.left^.resulttype)^.is_class then
begin
emit_ref_reg(A_MOV,S_L,
newreference(p^.left^.location.reference),R_EDI);
emit_mov_loc_reg(p^.left^.location,R_EDI);
usetemp:=true;
end
else
begin
emit_ref_reg(A_LEA,S_L,
newreference(p^.left^.location.reference),R_EDI);
emit_lea_loc_reg(p^.left^.location,R_EDI,true);
usetemp:=true;
end;
@ -851,7 +841,11 @@ implementation
end.
{
$Log$
Revision 1.54 1999-08-25 11:59:46 jonas
Revision 1.55 1999-09-10 15:42:50 peter
* fixed with <calln> do
* fixed finalize/initialize call for new/dispose
Revision 1.54 1999/08/25 11:59:46 jonas
* changed pai386, paippc and paiapha (same for tai*) to paicpu (taicpu)
Revision 1.53 1999/08/23 23:49:21 pierre

View File

@ -68,6 +68,8 @@ unit cgai386;
procedure emit_mov_loc_ref(const t:tlocation;const ref:treference;siz:topsize);
procedure emit_mov_loc_reg(const t:tlocation;reg:tregister);
procedure emit_lea_loc_ref(const t:tlocation;const ref:treference;freetemp:boolean);
procedure emit_lea_loc_reg(const t:tlocation;reg:tregister;freetemp:boolean);
procedure emit_push_loc(const t:tlocation);
{ pushes qword location to the stack }
@ -78,7 +80,6 @@ unit cgai386;
procedure release_loc(const t : tlocation);
procedure emit_pushw_loc(const t:tlocation);
procedure emit_lea_loc_ref(const t:tlocation;const ref:treference;freetemp:boolean);
procedure emit_push_lea_loc(const t:tlocation;freetemp:boolean);
procedure emit_to_reference(var p:ptree);
procedure emit_to_reg16(var hr:tregister);
@ -497,6 +498,28 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
end;
end;
procedure emit_lea_loc_reg(const t:tlocation;reg:tregister;freetemp:boolean);
begin
case t.loc of
LOC_MEM,
LOC_REFERENCE : begin
if t.reference.is_immediate then
internalerror(331)
else
begin
emit_ref_reg(A_LEA,S_L,
newreference(t.reference),reg);
end;
if freetemp then
ungetiftemp(t.reference);
end;
else
internalerror(332);
end;
end;
procedure emit_movq_reg_loc(reghigh,reglow: TRegister;t:tlocation);
begin
case t.loc of
@ -3306,7 +3329,11 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
end.
{
$Log$
Revision 1.38 1999-09-04 20:50:08 florian
Revision 1.39 1999-09-10 15:42:51 peter
* fixed with <calln> do
* fixed finalize/initialize call for new/dispose
Revision 1.38 1999/09/04 20:50:08 florian
* bug 580 fixed
Revision 1.37 1999/09/02 17:07:38 florian