[fpc-pascal] Basics of profiling -- some comments on fpprofiler bugs

Žilvinas Ledas zilvinas.ledas at dict.lt
Sat Sep 18 14:10:06 CEST 2010


  On 2010-09-17 01:28, Darius Blaszyk wrote:
> On Mon, 2010-09-06 at 16:58 +0300, Žilvinas Ledas wrote:
>>
>> Few notes (parts that need some improvement):
>> 1) fpp.pp needs at least tkAsm in "case tokenlist[i].token of" in
>> "procedure ModifyCode(AFileName: string; tokenlist: TPasTokenList);"
>> 2) it works wrong with ifdef's (it leaves only ELSE code) -- (I modified
>> my copy to output comments as well and had to "modify" pscanner.pp to
>> have directives as simple comments);
>> 3) in "procedure TPasTokenList.SaveToFile(const AFileName: string);" no
>> need for writeLN's - writes are enough;
>> 4) Asm procedures are handeled wrong (fpprof_exit_profile; is inserted
>> before end;)
>> function IsCPUID_Available : Boolean; register; assembler;
>> asm
>>     ...
>> end;
>> 5) records with cases (or some other type) is handeled wrong
>> (fpprof_exit_profile; is inserted before end;) -- I don't remember what
>> type it was exactly.
>>
>> In my opinion 2) is the biggest problem now :)
> I have added some tests for all the issues you describe above (asm /
> ifdef and case). According to me only asm seems to be not working
> correctly. Could you have a look and run the tests to see if you get the
> same issue? If confirmed I will work on fixing asm (and any other issue
> that pops up).
>
> Regards, Darius
Sorry for the delay - I have very little time now...
Notes about issues (I will use numbering from my previous message):
1) I think fixing asm is enougt to add tkAsm as I wrote previously.
4) Can't reproduce it now.
5) I'm attaching zip with testcase for this one (test_007.pp).
2) I'm sending test_005__as outputed_by_fpp.pp. You can see that only 
{$ELSE} branch is left, BUT I am using Windows ;) This is actually not a 
bug of fpprofiler (AS I UNDERSTAND IT), but a feature of fcl-passrc, as 
it "processes" IFDEF's, includes .inc files and so on (look at: 
pscanner.pp from 985 to 1161 lines)... I think the source code should be 
left as it is: no IFDEF's removed and no .inc files included - this 
could solve a lot of other potential bugs.

And another "bug" because of processing and removing directives is shown 
in attached test_006.pp file ;)

\fcl-passrc - at revision: 16002
At revision: 2501


Regards
Žilvinas Ledas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fpp_testcases.zip
Type: application/x-zip-compressed
Size: 760 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20100918/4a890cb9/attachment.bin>


More information about the fpc-pascal mailing list