From 2a20174317beddb72055355deda9fcd21b910431 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 27 Dec 2004 16:35:48 +0000 Subject: [PATCH] * set flag if a procedure references a symbol in staticsymtable --- compiler/globtype.pas | 10 +++++++--- compiler/psub.pas | 22 ++++------------------ compiler/symtable.pas | 11 ++++++++++- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/compiler/globtype.pas b/compiler/globtype.pas index f486d962e1..d93f1cfc7d 100644 --- a/compiler/globtype.pas +++ b/compiler/globtype.pas @@ -237,8 +237,9 @@ than 255 characters. That's why using Ansi Strings} pi_uses_fpu, { procedure uses GOT for PIC code } pi_needs_got, - { references local var/proc } - pi_inline_local_only + { references var/proc/type/const in static symtable, + i.e. not allowed for inlining from other units } + pi_uses_static_symtable ); tprocinfoflags=set of tprocinfoflag; @@ -315,7 +316,10 @@ implementation end. { $Log$ - Revision 1.65 2004-12-15 21:08:15 peter + Revision 1.66 2004-12-27 16:35:48 peter + * set flag if a procedure references a symbol in staticsymtable + + Revision 1.65 2004/12/15 21:08:15 peter * disable inlining across units when the inline procedure references a variable or procedure in the static symtable diff --git a/compiler/psub.pas b/compiler/psub.pas index 5cde7d2051..ecfac45c21 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -959,20 +959,6 @@ implementation end; - function checklocalinlining(var n: tnode; arg: pointer): foreachnoderesult; - begin - result:=fen_false; - case n.nodetype of - loadn : - if tloadnode(n).symtableentry.owner.symtabletype=staticsymtable then - result:=fen_norecurse_true; - calln : - if tcallnode(n).procdefinition.owner.symtabletype=staticsymtable then - result:=fen_norecurse_true; - end; - end; - - procedure tcgprocinfo.parse_body; var oldprocinfo : tprocinfo; @@ -1060,9 +1046,6 @@ implementation include(procdef.procoptions,po_has_inlininginfo); procdef.inlininginfo^.code:=code.getcopy; procdef.inlininginfo^.flags:=current_procinfo.flags; - { References a local var or proc? } - if foreachnodestatic(procdef.inlininginfo^.code,@checklocalinlining,nil) then - include(procdef.inlininginfo^.flags,pi_inline_local_only); { The blocknode needs to set an exit label } if procdef.inlininginfo^.code.nodetype=blockn then include(procdef.inlininginfo^.code.flags,nf_block_with_exit); @@ -1464,7 +1447,10 @@ implementation end. { $Log$ - Revision 1.226 2004-12-27 14:41:09 jonas + Revision 1.227 2004-12-27 16:35:48 peter + * set flag if a procedure references a symbol in staticsymtable + + Revision 1.226 2004/12/27 14:41:09 jonas - disable inlining for any procedure that contains assembler. Could be enabled again if the procedure has neither local variables nor parameters. diff --git a/compiler/symtable.pas b/compiler/symtable.pas index 75220d6e8b..d7fcd3b777 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -1799,6 +1799,12 @@ implementation end; if Tsym(srsym).is_visible_for_object(topclass) then begin + { we need to know if a procedure references symbols + in the static symtable, because then it can't be + inlined from outside this unit } + if assigned(current_procinfo) and + (srsym.owner.symtabletype=staticsymtable) then + include(current_procinfo.flags,pi_uses_static_symtable); searchsym:=true; exit; end; @@ -2312,7 +2318,10 @@ implementation end. { $Log$ - Revision 1.166 2004-12-21 08:38:16 michael + Revision 1.167 2004-12-27 16:35:48 peter + * set flag if a procedure references a symbol in staticsymtable + + Revision 1.166 2004/12/21 08:38:16 michael + Enable local debug info in methods Revision 1.165 2004/12/15 15:59:54 peter