diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index ceaf7450c5..31f891ef88 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -1265,12 +1265,13 @@ implementation not(po_assembler in current_procinfo.procdef.procoptions) then begin { non-win32 can call mcout even in main } - if not (target_info.system in [system_i386_win32,system_i386_wdosx]) then - cg.g_profilecode(list) - else - { wdosx, and win32 should not call mcount before monstartup has been called } - if not (current_procinfo.procdef.proctypeoption=potype_proginit) then - cg.g_profilecode(list); + if not (target_info.system in [system_i386_win32,system_i386_wdosx]) or + not (current_procinfo.procdef.proctypeoption=potype_proginit) then + begin + cg.allocexplicitregisters(list,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_cdecl)); + cg.g_profilecode(list); + cg.deallocexplicitregisters(list,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_cdecl)); + end; end; { call startup helpers from main program } @@ -2133,7 +2134,10 @@ implementation end. { $Log$ - Revision 1.202 2004-05-23 15:23:30 peter + Revision 1.203 2004-05-28 21:14:13 peter + * first load para's to temps before calling entry code (profile + + Revision 1.202 2004/05/23 15:23:30 peter * fixed qword(longint) that removed sign from the number * removed code in the compiler that relied on wrong qword(longint) code generation diff --git a/compiler/psub.pas b/compiler/psub.pas index ab56e4ebc1..70f2a44f98 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -570,8 +570,8 @@ implementation addstatement(codestatement,bodyexitcode); addstatement(codestatement,final_asmnode); { Initialize before try...finally...end frame } - addstatement(newstatement,entry_asmnode); addstatement(newstatement,loadpara_asmnode); + addstatement(newstatement,entry_asmnode); addstatement(newstatement,init_asmnode); addstatement(newstatement,bodyentrycode); aktfilepos:=entrypos; @@ -585,8 +585,8 @@ implementation end else begin - addstatement(newstatement,entry_asmnode); addstatement(newstatement,loadpara_asmnode); + addstatement(newstatement,entry_asmnode); addstatement(newstatement,init_asmnode); addstatement(newstatement,bodyentrycode); addstatement(newstatement,code); @@ -1001,7 +1001,6 @@ implementation { parse the code ... } code:=block(current_module.islibrary); - { save exit info } exitswitches:=aktlocalswitches; exitpos:=last_endtoken_filepos; @@ -1009,8 +1008,18 @@ implementation { the procedure is now defined } procdef.forwarddef:=false; + if assigned(code) then + begin + { get a better entry point } + entrypos:=code.fileinfo; + + { Finish type checking pass } + do_resulttypepass(code); + end; + { Check for unused labels, forwards, symbols for procedures. Static - symtable is checked in pmodules } + symtable is checked in pmodules. + The check must be done after the resulttypepass } if (Errorcount=0) and (tstoredsymtable(procdef.localst).symtabletype<>staticsymtable) then begin @@ -1028,15 +1037,6 @@ implementation end; end; - if assigned(code) then - begin - { get a better entry point } - entrypos:=code.fileinfo; - - { Finish type checking pass } - do_resulttypepass(code); - end; - { store a copy of the original tree for inline, for normal procedures only store a reference to the current tree } @@ -1389,7 +1389,10 @@ implementation end. { $Log$ - Revision 1.193 2004-05-24 17:31:12 peter + Revision 1.194 2004-05-28 21:14:13 peter + * first load para's to temps before calling entry code (profile + + Revision 1.193 2004/05/24 17:31:12 peter * also check local typed const Revision 1.192 2004/05/23 18:28:41 peter