mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-31 11:50:51 +02:00
* fpc_freemem fpc_getmem new callings updated
This commit is contained in:
parent
1841460577
commit
f4932cb67b
@ -761,64 +761,18 @@ do_jmp:
|
||||
*****************************************************************************}
|
||||
|
||||
procedure secondfail(var p : ptree);
|
||||
{var
|
||||
hp : preference;
|
||||
nofreememcall, afterfreememcall : pasmlabel; }
|
||||
begin
|
||||
(* { check if getmem was called :
|
||||
VMT at 8(%ebp) is set to -1 after call to getmem PM }
|
||||
{ also reset to zero in the stack }
|
||||
getlabel(nofreememcall);
|
||||
getlabel(afterfreememcall);
|
||||
new(hp);
|
||||
reset_reference(hp^);
|
||||
hp^.offset:=8;
|
||||
hp^.base:=procinfo^.framepointer;
|
||||
emit_const_ref(A_CMP,S_L,-1,hp);
|
||||
emitjmp(C_NE,nofreememcall);
|
||||
new(hp);
|
||||
reset_reference(hp^);
|
||||
hp^.offset:=procinfo^._class^.vmt_offset;
|
||||
hp^.base:=R_ESI;
|
||||
emit_ref_reg(A_MOV,S_L,hp,R_EDI);
|
||||
new(hp);
|
||||
reset_reference(hp^);
|
||||
hp^.base:=R_EDI;
|
||||
{hp^.offset:=0; done in reset_reference }
|
||||
emit_ref(A_PUSH,S_L,hp);
|
||||
new(hp);
|
||||
reset_reference(hp^);
|
||||
hp^.offset:=procinfo^.ESI_offset;
|
||||
hp^.base:=procinfo^.framepointer;
|
||||
emit_ref_reg(A_LEA,S_L,hp,R_EDI);
|
||||
emit_reg(A_PUSH,S_L,R_EDI);
|
||||
emitcall('FPC_FREEMEM');
|
||||
emitjmp(C_None,afterfreememcall);
|
||||
|
||||
|
||||
emitlab(nofreememcall);
|
||||
{ reset VMT field for static object }
|
||||
new(hp);
|
||||
reset_reference(hp^);
|
||||
hp^.offset:=procinfo^._class^.vmt_offset;
|
||||
hp^.base:=R_ESI;
|
||||
emit_const_ref(A_MOV,S_L,0,hp);
|
||||
emitlab(afterfreememcall);
|
||||
emit_reg_reg(A_XOR,S_L,R_ESI,R_ESI);
|
||||
{ also reset to zero in the stack }
|
||||
new(hp);
|
||||
reset_reference(hp^);
|
||||
hp^.offset:=procinfo^.ESI_offset;
|
||||
hp^.base:=procinfo^.framepointer;
|
||||
emit_reg_ref(A_MOV,S_L,R_ESI,hp); *)
|
||||
emitjmp(C_None,faillabel);
|
||||
emitjmp(C_None,faillabel);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.54 1999-10-21 16:41:37 florian
|
||||
Revision 1.55 1999-10-30 17:35:26 peter
|
||||
* fpc_freemem fpc_getmem new callings updated
|
||||
|
||||
Revision 1.54 1999/10/21 16:41:37 florian
|
||||
* problems with readln fixed: esi wasn't restored correctly when
|
||||
reading ordinal fields of objects futher the register allocation
|
||||
didn't take care of the extra register when reading ordinal values
|
||||
|
@ -90,14 +90,13 @@ implementation
|
||||
begin
|
||||
pushusedregisters(pushed,$ff);
|
||||
|
||||
{ code copied from simplenewdispose PM }
|
||||
gettempofsizereference(target_os.size_of_pointer,p^.location.reference);
|
||||
|
||||
{ determines the size of the mem block }
|
||||
push_int(ppointerdef(p^.resulttype)^.definition^.size);
|
||||
|
||||
gettempofsizereference(target_os.size_of_pointer,p^.location.reference);
|
||||
emitpushreferenceaddr(p^.location.reference);
|
||||
|
||||
emit_push_lea_loc(p^.location,false);
|
||||
emitcall('FPC_GETMEM');
|
||||
|
||||
if ppointerdef(p^.resulttype)^.definition^.needs_inittable then
|
||||
begin
|
||||
new(r);
|
||||
@ -166,16 +165,6 @@ implementation
|
||||
exit;
|
||||
|
||||
pushusedregisters(pushed,$ff);
|
||||
{ determines the size of the mem block }
|
||||
push_int(ppointerdef(p^.left^.resulttype)^.definition^.size);
|
||||
|
||||
{ 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;
|
||||
|
||||
{ call the mem handling procedures }
|
||||
case p^.treetype of
|
||||
@ -192,10 +181,14 @@ implementation
|
||||
emit_push_loc(p^.left^.location);
|
||||
emitcall('FPC_FINALIZE');
|
||||
end;
|
||||
emit_push_lea_loc(p^.left^.location,true);
|
||||
emitcall('FPC_FREEMEM');
|
||||
end;
|
||||
simplenewn:
|
||||
begin
|
||||
{ determines the size of the mem block }
|
||||
push_int(ppointerdef(p^.left^.resulttype)^.definition^.size);
|
||||
emit_push_lea_loc(p^.left^.location,true);
|
||||
emitcall('FPC_GETMEM');
|
||||
if ppointerdef(p^.left^.resulttype)^.definition^.needs_inittable then
|
||||
begin
|
||||
@ -868,7 +861,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.58 1999-09-17 17:14:02 peter
|
||||
Revision 1.59 1999-10-30 17:35:26 peter
|
||||
* fpc_freemem fpc_getmem new callings updated
|
||||
|
||||
Revision 1.58 1999/09/17 17:14:02 peter
|
||||
* @procvar fixes for tp mode
|
||||
* @<id>:= gives now an error
|
||||
|
||||
|
@ -1052,6 +1052,7 @@ begin
|
||||
def_symbol('HASINTERNMATH');
|
||||
def_symbol('SYSTEMTVARREC');
|
||||
def_symbol('INCLUDEOK');
|
||||
def_symbol('NEWMM');
|
||||
|
||||
{ some stuff for TP compatibility }
|
||||
{$ifdef i386}
|
||||
@ -1237,7 +1238,10 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.28 1999-10-28 11:13:36 pierre
|
||||
Revision 1.29 1999-10-30 17:35:26 peter
|
||||
* fpc_freemem fpc_getmem new callings updated
|
||||
|
||||
Revision 1.28 1999/10/28 11:13:36 pierre
|
||||
* fix for cygwin make problem with -iTP
|
||||
|
||||
Revision 1.27 1999/10/26 13:13:47 peter
|
||||
|
Loading…
Reference in New Issue
Block a user