mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-31 17:10:14 +02:00
* moved a bunch of tprocdef fields that are only required when compiling the
procdef to a dynamically allocated record that is not created when loading the procdef from ppu git-svn-id: trunk@26332 -
This commit is contained in:
parent
471d0a5164
commit
32b149c622
@ -602,15 +602,53 @@ interface
|
|||||||
end;
|
end;
|
||||||
{$endif oldregvars}
|
{$endif oldregvars}
|
||||||
|
|
||||||
|
timplprocdefinfo = record
|
||||||
|
resultname : pshortstring;
|
||||||
|
parentfpstruct: tsym;
|
||||||
|
parentfpstructptrtype: tdef;
|
||||||
|
parentfpinitblock: tnode;
|
||||||
|
procstarttai,
|
||||||
|
procendtai : tai;
|
||||||
|
skpara: pointer;
|
||||||
|
forwarddef,
|
||||||
|
interfacedef : boolean;
|
||||||
|
hasforward : boolean;
|
||||||
|
end;
|
||||||
|
pimplprocdefinfo = ^timplprocdefinfo;
|
||||||
|
|
||||||
{ tprocdef }
|
{ tprocdef }
|
||||||
|
|
||||||
tprocdef = class(tabstractprocdef)
|
tprocdef = class(tabstractprocdef)
|
||||||
private
|
private
|
||||||
{$ifdef symansistr}
|
{$ifdef symansistr}
|
||||||
_mangledname : ansistring;
|
_mangledname : ansistring;
|
||||||
{$else symansistr}
|
{$else symansistr}
|
||||||
_mangledname : pshortstring;
|
_mangledname : pshortstring;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
{ information that is only required until the implementation of the
|
||||||
|
procdef has been handled }
|
||||||
|
implprocdefinfo : pimplprocdefinfo;
|
||||||
|
|
||||||
|
function GetResultName: PShortString;
|
||||||
|
procedure SetResultName(AValue: PShortString);
|
||||||
|
function GetParentFPStruct: tsym;
|
||||||
|
procedure SetParentFPStruct(AValue: tsym);
|
||||||
|
function GetParentFPStructPtrType: tdef;
|
||||||
|
procedure SetParentFPStructPtrType(AValue: tdef);
|
||||||
|
function GetParentFPInitBlock: tnode;
|
||||||
|
procedure SetParentFPInitBlock(AValue: tnode);
|
||||||
|
function Getprocstarttai: tai;
|
||||||
|
procedure Setprocstarttai(AValue: tai);
|
||||||
|
function Getprocendtai: tai;
|
||||||
|
procedure Setprocendtai(AValue: tai);
|
||||||
|
function Getskpara: pointer;
|
||||||
|
procedure Setskpara(AValue: pointer);
|
||||||
|
function Getforwarddef: boolean;
|
||||||
|
procedure Setforwarddef(AValue: boolean);
|
||||||
|
function Getinterfacedef: boolean;
|
||||||
|
procedure Setinterfacedef(AValue: boolean);
|
||||||
|
function Gethasforward: boolean;
|
||||||
|
procedure Sethasforward(AValue: boolean);
|
||||||
public
|
public
|
||||||
messageinf : tmessageinf;
|
messageinf : tmessageinf;
|
||||||
dispid : longint;
|
dispid : longint;
|
||||||
@ -639,8 +677,6 @@ interface
|
|||||||
libsym : tsym;
|
libsym : tsym;
|
||||||
libsymderef : tderef;
|
libsymderef : tderef;
|
||||||
{$endif powerpc or m68k}
|
{$endif powerpc or m68k}
|
||||||
{ name of the result variable to insert in the localsymtable }
|
|
||||||
resultname : pshortstring;
|
|
||||||
{ import info }
|
{ import info }
|
||||||
import_dll,
|
import_dll,
|
||||||
import_name : pshortstring;
|
import_name : pshortstring;
|
||||||
@ -652,27 +688,9 @@ interface
|
|||||||
easily write out all methods grouped per class }
|
easily write out all methods grouped per class }
|
||||||
exprasmlist : TAsmList;
|
exprasmlist : TAsmList;
|
||||||
{$endif jvm}
|
{$endif jvm}
|
||||||
{ temporary reference to structure containing copies of all local
|
|
||||||
variables and parameters accessed by nested routines; reference to
|
|
||||||
this structure is passed as "parent frame pointer" on targets that
|
|
||||||
lack this concept (at least JVM and LLVM); no need to save to/
|
|
||||||
restore from ppu, since nested routines are always in the same
|
|
||||||
unit (no need to save to ppu) }
|
|
||||||
parentfpstruct: tsym;
|
|
||||||
{ pointer to parentfpstruct's type (not yet valid during parsing, so
|
|
||||||
cannot be used for $parentfp parameter) (no need to save to ppu) }
|
|
||||||
parentfpstructptrtype: tdef;
|
|
||||||
{ code to copy the parameters accessed from nested routines into the
|
|
||||||
parentfpstruct (no need to save to ppu) }
|
|
||||||
parentfpinitblock: tnode;
|
|
||||||
{$ifdef oldregvars}
|
{$ifdef oldregvars}
|
||||||
regvarinfo: pregvarinfo;
|
regvarinfo: pregvarinfo;
|
||||||
{$endif oldregvars}
|
{$endif oldregvars}
|
||||||
{ First/last assembler symbol/instruction in aasmoutput list.
|
|
||||||
Note: initialised after compiling the code for the procdef, but
|
|
||||||
not saved to/restored from ppu. Used when inserting debug info }
|
|
||||||
procstarttai,
|
|
||||||
procendtai : tai;
|
|
||||||
import_nr : word;
|
import_nr : word;
|
||||||
extnumber : word;
|
extnumber : word;
|
||||||
{$if defined(i386) or defined(i8086)}
|
{$if defined(i386) or defined(i8086)}
|
||||||
@ -692,17 +710,8 @@ interface
|
|||||||
{ set to a value different from tsk_none in case this procdef is for
|
{ set to a value different from tsk_none in case this procdef is for
|
||||||
a routine that has to be internally generated by the compiler }
|
a routine that has to be internally generated by the compiler }
|
||||||
synthetickind : tsynthetickind;
|
synthetickind : tsynthetickind;
|
||||||
{ optional parameter for the synthetic routine generation logic }
|
|
||||||
skpara: pointer;
|
|
||||||
{ true, if the procedure contains no code }
|
{ true, if the procedure contains no code }
|
||||||
isempty,
|
isempty: boolean;
|
||||||
{ true, if the procedure is only declared
|
|
||||||
(forward procedure) }
|
|
||||||
forwarddef,
|
|
||||||
{ true if the procedure is declared in the interface }
|
|
||||||
interfacedef : boolean;
|
|
||||||
{ true if the procedure has a forward declaration }
|
|
||||||
hasforward : boolean;
|
|
||||||
constructor create(level:byte);
|
constructor create(level:byte);
|
||||||
constructor ppuload(ppufile:tcompilerppufile);
|
constructor ppuload(ppufile:tcompilerppufile);
|
||||||
destructor destroy;override;
|
destructor destroy;override;
|
||||||
@ -735,6 +744,37 @@ interface
|
|||||||
function is_methodpointer:boolean;override;
|
function is_methodpointer:boolean;override;
|
||||||
function is_addressonly:boolean;override;
|
function is_addressonly:boolean;override;
|
||||||
procedure make_external;
|
procedure make_external;
|
||||||
|
|
||||||
|
{ aliases to fields only required when a function is implemented in
|
||||||
|
the current unit }
|
||||||
|
property resultname: PShortString read GetResultName write SetResultName;
|
||||||
|
{ temporary reference to structure containing copies of all local
|
||||||
|
variables and parameters accessed by nested routines; reference to
|
||||||
|
this structure is passed as "parent frame pointer" on targets that
|
||||||
|
lack this concept (at least JVM and LLVM); no need to save to/
|
||||||
|
restore from ppu, since nested routines are always in the same
|
||||||
|
unit }
|
||||||
|
property parentfpstruct: tsym read GetParentFPStruct write SetParentFPStruct;
|
||||||
|
{ pointer to parentfpstruct's type (not yet valid during parsing, so
|
||||||
|
cannot be used for $parentfp parameter) (no need to save to ppu) }
|
||||||
|
property parentfpstructptrtype: tdef read GetParentFPStructPtrType write SetParentFPStructPtrType;
|
||||||
|
{ code to copy the parameters accessed from nested routines into the
|
||||||
|
parentfpstruct (no need to save to ppu) }
|
||||||
|
property parentfpinitblock: tnode read GetParentFPInitBlock write SetParentFPInitBlock;
|
||||||
|
{ First/last assembler symbol/instruction in aasmoutput list.
|
||||||
|
Note: initialised after compiling the code for the procdef, but
|
||||||
|
not saved to/restored from ppu. Used when inserting debug info }
|
||||||
|
property procstarttai: tai read Getprocstarttai write Setprocstarttai;
|
||||||
|
property procendtai: tai read Getprocendtai write Setprocendtai;
|
||||||
|
{ optional parameter for the synthetic routine generation logic }
|
||||||
|
property skpara: pointer read Getskpara write Setskpara;
|
||||||
|
{ true, if the procedure is only declared
|
||||||
|
(forward procedure) }
|
||||||
|
property forwarddef: boolean read Getforwarddef write Setforwarddef;
|
||||||
|
{ true if the procedure is declared in the interface }
|
||||||
|
property interfacedef: boolean read Getinterfacedef write Setinterfacedef;
|
||||||
|
{ true if the procedure has a forward declaration }
|
||||||
|
property hasforward: boolean read Gethasforward write Sethasforward;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ single linked list of overloaded procs }
|
{ single linked list of overloaded procs }
|
||||||
@ -4456,9 +4496,130 @@ implementation
|
|||||||
TPROCDEF
|
TPROCDEF
|
||||||
***************************************************************************}
|
***************************************************************************}
|
||||||
|
|
||||||
|
function tprocdef.GetResultName: PShortString;
|
||||||
|
begin
|
||||||
|
result:=implprocdefinfo^.resultname;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocdef.SetResultName(AValue: PShortString);
|
||||||
|
begin
|
||||||
|
implprocdefinfo^.resultname:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tprocdef.GetParentFPInitBlock: tnode;
|
||||||
|
begin
|
||||||
|
result:=implprocdefinfo^.parentfpinitblock;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tprocdef.GetParentFPStruct: tsym;
|
||||||
|
begin
|
||||||
|
result:=implprocdefinfo^.parentfpstruct;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tprocdef.GetParentFPStructPtrType: tdef;
|
||||||
|
begin
|
||||||
|
result:=implprocdefinfo^.parentfpstructptrtype;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocdef.SetParentFPInitBlock(AValue: tnode);
|
||||||
|
begin
|
||||||
|
implprocdefinfo^.parentfpinitblock:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tprocdef.Getprocendtai: tai;
|
||||||
|
begin
|
||||||
|
result:=implprocdefinfo^.procendtai;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tprocdef.Getprocstarttai: tai;
|
||||||
|
begin
|
||||||
|
result:=implprocdefinfo^.procstarttai;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocdef.Setprocendtai(AValue: tai);
|
||||||
|
begin
|
||||||
|
implprocdefinfo^.procendtai:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tprocdef.Getskpara: pointer;
|
||||||
|
begin
|
||||||
|
result:=implprocdefinfo^.skpara;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocdef.Setskpara(AValue: pointer);
|
||||||
|
begin
|
||||||
|
implprocdefinfo:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tprocdef.Getforwarddef: boolean;
|
||||||
|
begin
|
||||||
|
result:=implprocdefinfo^.forwarddef;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tprocdef.Gethasforward: boolean;
|
||||||
|
begin
|
||||||
|
result:=implprocdefinfo^.hasforward;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tprocdef.Getinterfacedef: boolean;
|
||||||
|
begin
|
||||||
|
result:=implprocdefinfo^.interfacedef;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocdef.Setforwarddef(AValue: boolean);
|
||||||
|
begin
|
||||||
|
implprocdefinfo^.forwarddef:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocdef.Sethasforward(AValue: boolean);
|
||||||
|
begin
|
||||||
|
implprocdefinfo^.hasforward:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocdef.Setinterfacedef(AValue: boolean);
|
||||||
|
begin
|
||||||
|
implprocdefinfo^.interfacedef:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocdef.Setprocstarttai(AValue: tai);
|
||||||
|
begin
|
||||||
|
implprocdefinfo^.procstarttai:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocdef.SetParentFPStruct(AValue: tsym);
|
||||||
|
begin
|
||||||
|
implprocdefinfo^.parentfpstruct:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tprocdef.SetParentFPStructPtrType(AValue: tdef);
|
||||||
|
begin
|
||||||
|
implprocdefinfo^.parentfpstructptrtype:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
constructor tprocdef.create(level:byte);
|
constructor tprocdef.create(level:byte);
|
||||||
begin
|
begin
|
||||||
inherited create(procdef,level);
|
inherited create(procdef,level);
|
||||||
|
implprocdefinfo:=allocmem(sizeof(implprocdefinfo^));
|
||||||
localst:=tlocalsymtable.create(self,parast.symtablelevel);
|
localst:=tlocalsymtable.create(self,parast.symtablelevel);
|
||||||
{$ifdef symansistr}
|
{$ifdef symansistr}
|
||||||
_mangledname:='';
|
_mangledname:='';
|
||||||
@ -4573,9 +4734,6 @@ implementation
|
|||||||
(tf_need_export in target_info.flags) and
|
(tf_need_export in target_info.flags) and
|
||||||
(po_exports in procoptions) then
|
(po_exports in procoptions) then
|
||||||
deffile.AddExport(mangledname);
|
deffile.AddExport(mangledname);
|
||||||
forwarddef:=false;
|
|
||||||
interfacedef:=false;
|
|
||||||
hasforward:=false;
|
|
||||||
{ Disable po_has_inlining until the derefimpl is done }
|
{ Disable po_has_inlining until the derefimpl is done }
|
||||||
exclude(procoptions,po_has_inlininginfo);
|
exclude(procoptions,po_has_inlininginfo);
|
||||||
{$ifdef i386}
|
{$ifdef i386}
|
||||||
@ -4615,7 +4773,12 @@ implementation
|
|||||||
{$ifdef jvm}
|
{$ifdef jvm}
|
||||||
exprasmlist.free;
|
exprasmlist.free;
|
||||||
{$endif}
|
{$endif}
|
||||||
stringdispose(resultname);
|
if assigned(implprocdefinfo) then
|
||||||
|
begin
|
||||||
|
stringdispose(implprocdefinfo^.resultname);
|
||||||
|
freemem(implprocdefinfo);
|
||||||
|
implprocdefinfo:=nil;
|
||||||
|
end;
|
||||||
stringdispose(import_dll);
|
stringdispose(import_dll);
|
||||||
stringdispose(import_name);
|
stringdispose(import_name);
|
||||||
stringdispose(deprecatedmsg);
|
stringdispose(deprecatedmsg);
|
||||||
@ -4898,8 +5061,11 @@ implementation
|
|||||||
{$if defined(powerpc) or defined(m68k)}
|
{$if defined(powerpc) or defined(m68k)}
|
||||||
tprocdef(result).libsym:=libsym;
|
tprocdef(result).libsym:=libsym;
|
||||||
{$endif powerpc or m68k}
|
{$endif powerpc or m68k}
|
||||||
if assigned(resultname) then
|
if assigned(implprocdefinfo) then
|
||||||
tprocdef(result).resultname:=stringdup(resultname^);
|
begin
|
||||||
|
if assigned(resultname) then
|
||||||
|
tprocdef(result).resultname:=stringdup(resultname^);
|
||||||
|
end;
|
||||||
if assigned(import_dll) then
|
if assigned(import_dll) then
|
||||||
tprocdef(result).import_dll:=stringdup(import_dll^);
|
tprocdef(result).import_dll:=stringdup(import_dll^);
|
||||||
if assigned(import_name) then
|
if assigned(import_name) then
|
||||||
|
Loading…
Reference in New Issue
Block a user