mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 15:59:27 +02:00
![]() svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/branches/wpo ........ r11878 | jonas | 2008-10-11 02:25:18 +0200 (Sat, 11 Oct 2008) | 19 lines + initial implementation of whole-program optimisation framework + implementation of whole-program devirtualisation o use: a) generate whole-program optimisation information (no need to completely compile the program and all of its units with -OW/-FW, only the main program is sufficient) fpc -OWdevirtcalls -FWmyprog.wpo myprog b) use it to optimise the program fpc -B -Owdevirtcalls -Fwmyprog.wpo myprog (the -B is not required, but only sources recompiled during the second pass will actually be optimised -- if you want, you can even rebuild the rtl devirtualised for a particular program; and these options can obviously also be used together with regular optimisation switches) o warning: - there are no checks yet to ensure that you do not use units optimised for a particular program with another program (or with a changed version of the same program) ........ r11881 | jonas | 2008-10-11 19:35:52 +0200 (Sat, 11 Oct 2008) | 13 lines * extracted code to detect constructed class/object types from tcallnode.gen_vmt_tree into its own method to avoid clutter * detect x.classtype.create constructs (with classtype = the system.tobject.classtype method), and treat them as if a "class of x" has been instantiated rather than a "class of tobject". this required storing the instantiated classrefs in their own array though, because at such a point we don't have a "class of x" tdef available (so now "x", and all other defs instantiated via a classref, are now stored as tobjectdefs in a separate array) + support for devirtualising class methods (including constructors) ........ r11882 | jonas | 2008-10-11 20:44:02 +0200 (Sat, 11 Oct 2008) | 7 lines + -Owoptvmts whole program optimisation which replaces vmt entries with method names of child classes in case the current class' method can never be called (e.g., because this class is never instantiated). As a result, such methods can then be removed by dead code removal/smart linking (not much effect for either the compiler, lazarus or a trivial lazarus app though). ........ r11889 | jonas | 2008-10-12 14:29:54 +0200 (Sun, 12 Oct 2008) | 2 lines * some comment fixes ........ r11891 | jonas | 2008-10-12 18:49:13 +0200 (Sun, 12 Oct 2008) | 4 lines * fixed twpofilereader.getnextnoncommentline() when reusing a previously read line * fixed skipping of unnecessary wpo feedback file sections ........ r11892 | jonas | 2008-10-12 23:42:43 +0200 (Sun, 12 Oct 2008) | 31 lines + symbol liveness wpo information extracted from smartlinked programs (-OW/-Owsymbolliveness) + use symbol liveness information to improve devirtualisation (don't consider classes created in code that has been dead code stripped). This requires at least two passes of using wpo (first uses dead code info to locate classes that are constructed only in dead code, second pass uses this info to potentially further devirtualise). I.e.: 1) generate initial liveness and devirtualisation feedback fpc -FWtt.wpo -OWall tt.pp -Xs- -CX -XX 2) use previously generated feedback, and regenerate new feedback based on this (i.e., disregard classes created in dead code) fpc -FWtt-1.wpo -OWall -Fwtt.wo -Owall tt.pp -Xs- -CX -XX 3) use the newly generated feedback (in theory, it is possible that even more opportunities pop up afterwards; you can continue until the program does not get smaller anymore) fpc -Fwtt-1.wpo -Owall tt.pp -CX -XX * changed all message() to cgmessage() calls so the set codegenerror * changed static fsectionhandlers field to a regular field called fwpocomponents * changed registration of wpocomponents: no longer happens in the initialization section of their unit, but in the InitWpo routine (which has been moved from the woinfo to the wpo unit). This way you can register different classes based on the target/parameters. + added static method to twpocomponentbase for checking whether the command line parameters don't conflict with the requested optimisations (e.g. generating liveness info requires that smartlinking is turned on) + added static method to twpocomponentbase to request the section name ........ r11893 | jonas | 2008-10-12 23:53:57 +0200 (Sun, 12 Oct 2008) | 3 lines * fixed comment error (twpodeadcodeinfo keeps a list of live, not dead symbols) ........ r11895 | jonas | 2008-10-13 00:13:59 +0200 (Mon, 13 Oct 2008) | 2 lines + documented -OW<x>, -Ow<x>, -FW<x> and -Fw<x> wpo parameters ........ r11899 | jonas | 2008-10-14 22:14:56 +0200 (Tue, 14 Oct 2008) | 2 lines * replaced hardcoded string with objdumpsearchstr constant ........ r11900 | jonas | 2008-10-14 22:15:25 +0200 (Tue, 14 Oct 2008) | 2 lines * reset wpofeedbackinput and wpofeedbackoutput in wpodone ........ r11901 | jonas | 2008-10-14 22:16:07 +0200 (Tue, 14 Oct 2008) | 2 lines * various additional comments and comment fixes ........ r11902 | jonas | 2008-10-15 18:09:42 +0200 (Wed, 15 Oct 2008) | 5 lines * store vmt procdefs in the ppu files so we don't have to use a hack to regenerate them for whole-program optimisation * fixed crash when performing devirtualisation optimisation on programs that do not construct any classes/objects with optimisable vmts ........ r11935 | jonas | 2008-10-19 12:24:26 +0200 (Sun, 19 Oct 2008) | 4 lines * set the vmt entries of non-class virtual methods of not instantiated objects/classes to FPC_ABSTRACTERROR so the code they refer to can be thrown away if it is not referred to in any other way either ........ r11938 | jonas | 2008-10-19 20:55:02 +0200 (Sun, 19 Oct 2008) | 7 lines * record all classrefdefs/objdefs for which a loadvmtaddrnode is generated, and instead of marking all classes that derive from instantiated classrefdefs as instantiated, only mark those classes from the above collection that derive from instantiated classrefdefs as instantiated (since to instantiate a class, you have to load its vmt somehow -- this may be broken by using assembler code though) ........ r12212 | jonas | 2008-11-23 12:26:34 +0100 (Sun, 23 Nov 2008) | 3 lines * fixed to work with the new vmtentries that are always available and removed previously added code to save/load vmtentries to ppu files ........ r12304 | jonas | 2008-12-05 22:23:30 +0100 (Fri, 05 Dec 2008) | 4 lines * check whether the correct wpo feedback file is used in the current compilation when using units that were compiled using wpo information during a previous compilation run ........ r12308 | jonas | 2008-12-06 18:03:39 +0100 (Sat, 06 Dec 2008) | 2 lines * abort compilation if an error occurred during wpo initialisation ........ r12309 | jonas | 2008-12-06 18:04:28 +0100 (Sat, 06 Dec 2008) | 3 lines * give an error message instead of crashing with an io exception if the compiler is unable to create the wpo feedback file specified using -FW ........ r12310 | jonas | 2008-12-06 18:12:43 +0100 (Sat, 06 Dec 2008) | 3 lines * don't let the used wpo feedback file influence the interface crc (there's a separate check for such changes) ........ r12316 | jonas | 2008-12-08 19:08:25 +0100 (Mon, 08 Dec 2008) | 3 lines * document the format of the sections of the wpo feedback file inside the feedback file itself ........ r12330 | jonas | 2008-12-10 22:26:47 +0100 (Wed, 10 Dec 2008) | 2 lines * use sysutils instead of dos to avoid command line length limits ........ r12331 | jonas | 2008-12-10 22:31:11 +0100 (Wed, 10 Dec 2008) | 3 lines + support for testing whole program optimisation tests (multiple compilations using successively generated feedback files) ........ r12332 | jonas | 2008-12-10 22:31:40 +0100 (Wed, 10 Dec 2008) | 2 lines + whole program optimisation tests ........ r12334 | jonas | 2008-12-10 22:38:07 +0100 (Wed, 10 Dec 2008) | 2 lines - removed unused local variable ........ r12339 | jonas | 2008-12-11 18:06:36 +0100 (Thu, 11 Dec 2008) | 2 lines + comments for newly added fields to tobjectdef for devirtualisation ........ r12340 | jonas | 2008-12-11 18:10:01 +0100 (Thu, 11 Dec 2008) | 2 lines * increase ppu version (was no longer different from trunk due to merging) ........ git-svn-id: trunk@12341 - |
||
---|---|---|
.. | ||
bench | ||
tbf | ||
tbs | ||
test | ||
units | ||
utils | ||
webtbf | ||
webtbs | ||
dbdigest.cfg.example | ||
Makefile | ||
Makefile.fpc | ||
MPWMake | ||
readme.txt |
Usage ----- To start the test suite execute: make full TEST_FPC=path_to_your_compiler This should run all tests, scan the created log file and output some statistics. make digest TEST_FPC=path_to_your_compiler scans the created log file and outputs some statistics make digest USESQL=YES TEST_FPC=path_to_your_compiler sends the results to an SQL database When the tests are performed, first the units (e.g. rtl) needed by the tests are compiled in a clean determined way and put in the units directory. Then webtbs/webtbf/test/tbs/tbf are searched for t*.pp to be compiled and executed as tests. Directories ----------- webtbs...........Tests for web-bug-database bugs (should compile/run) Digits in filename refer to bug database entry webtbf...........Tests for web-bug-database bugs (should not compile/run) Digits in filename refer to bug database entry test.............Test suites for different aspects of the compiler/rtl etc test/packages....Tests depending on packages. The tests are sorted by package though this is not mandatory because tests can depend on multiple packages tbs..............Tests for other bugs, added by the fpc core team (success in compilation) Digits in filename is a serial no tbf..............Tests for other bugs, added by the fpc core team (fail compile) Digits in filename is a serial no units............Helper units for doing the tests utils............Utilities for processing tests Writing a test -------------- A test should have a name on the form t*.pp, to be recognized as a test. It should return 0 on success, any other value indicates failure. Test directives --------------- At the top of the test source code, some directives can be used to determine how the tests will be processed (if processed automatically via make), e.g. {%CPU=i386}: OPT................Compiler option required to compile CPU................Only for these CPU's (i386,m68k,etc). Might be a list. SKIPCPU............Not for these CPU's (i386,m68k,etc). Might be a list. TARGET.............Only for these OS targets (win32,MacOS,etc). Might be a list. SKIPTARGET.........Not for these OS targets (win32,MacOS,etc). Might be a list. VERSION............Compiler with at lest this version number required. MAXVERSION.........Compiler with at most this version number required. RESULT.............Exit code of execution of test expected TIMEOUT............Timeout indication for test in seconds (only used if enabled by defining TEST_TIMEOUT) FILES..............List of files (separated by spaces) required by test, will be copied to remote before execution GRAPH..............Requires graph unit FAIL...............Compilation must fail RECOMPILE..........After compiling a test, recompile the test for a second time. This is needed to test ppu loading issues. NORUN..............Do not execute test, only compile it INTERACTIVE........Do not execute test, as it requires user intervention NOTE...............Output note when compiling/executing test NEEDLIBRARY........Adds -rpath to the linker for unix. This is needed to test runtime library tests. The library needs the -FE. option to place the .so in the correct directory. KNOWNRUNERROR......Known bug, which manifest itself at runtime. To the right of the equal sign is the expected exit code, followed by an optional note. Will not be logged as a bug. KNOWNCOMPILEERROR..Known bug, which manifest itself at compile time. To the right of the equal sign is the expected exit code from compiler, followed by an optional note. Will not be logged as a bug. QUICKTEST..........If set, only tests without package dependencies are executed WPOPARAS...........Parameters to be added after -OW/-Ow to perform whole program optimization tests WPOPASSES..........Number of whole program optimization iterations to perform ("1" means compile once with "-FWsomefile -OW<wpoparas>" and then again with "-FWsomefile2 -OW<wpoparas> -Fwsomefile1 -Ow<wpoparas>", "2" means another pass but using somefile2 as input and somefile3 as output, etc.) NOTE: A list consists of comma separated items, e. g. CPU=i386,m68k,powerpc No space between the elements and the comma. Controling testing in more detail --------------------------------- Calling "make full" will perform tests in a standard manner. To have more control of the test process one must distinguish between: * Driver enviroment: compiler/rtl etc. to be used by the tools which runs and analyze the tests. All normal options to make, like FPC OS_TARGET, OPT etc. controls this. * Test environment: compiler/rtl etc. to be tested, to be used *in* the tests. Ususal options, prepended with TEST_ , controls this. If no such options are given, test and driver environment will be the same. This differentiation also enables cross testing. The following test options can be given: TEST_FPC compiler to test (no default) TEST_OS_TARGET defaults to default target of TEST_FPC TEST_CPU_TARGET defaults to default target of TEST_FPC TEST_OPT defaults to "" TEST_FPC_VERSION defaults to version of TEST_FPC TEST_CCOMPILER defaults to installed gcc compiler, but only if driver and test full-targets are the same. TEST_VERBOSE let dotest be more verbose, only usefull for debugging TEST_DELTEMP delete temporary executable/object/ppu file, default is off TEST_TIMEOUT use timeout wrapper for (remote) execution V print dotest commandline TEST_ABI test a certain abi, this influences where the c object files are taken from: TEST_ABI=eabi takes the c*.o files from test/cg/obj/linux/arm-eabi (Please add more test options if needed) NOTE: To clean after a test session, "make clean TEST_FPC=path_to_your_compiler" must be given the same options as when running the tests. The utils directory is considerd to belong to the driver environment, all other directories belong to the test environment. Remote execution ---------------- Also remote execution of the test suite is possible. Requirements: - rsh/ssh must work without keyboard interaction or extra parameters Test options: TEST_RSH set this to the hostname when you want to use rsh/rcp to execute/copy the test TEST_SSH set this to use ssh/scp to execute the test TEST_PUTTY test using putty when remote testing (pscp and plink) TEST_REMOTEOPT extra options to remote program TEST_REMOTEPATH set remote path to use, default is /tmp TEST_DELBEFORE delete remote executable before uploading TEST_DELTEMP delete executable after running, so the remote system doesn't need much free disk space TEST_REMOTEPW pass a password with -pw to remote tools, mainly usefull for putty Examples: ------- make TEST_FPC=$HOME/fpc/compiler/ppcsparc TEST_BINUTILSPREFIX=sparc-linux- \ TEST_RSH=sunny TEST_REMOTEPATH=/tmp/tests make TEST_FPC=$HOME/fpc/compiler/ppcsparc TEST_BINUTILSPREFIX=sparc-linux- \ TEST_SSH=fpc@sunny TEST_REMOTEPATH=/tmp/tests Example for win32/putty: make TEST_FPC=c:\fpc\compiler\ppcarm TEST_BINUTILSPREFIX=arm-linux- \ TEST_PUTTY=root@192.168.42.210 TEST_REMOTEPATH=/tmp TEST_DELTEMP=1 \ "TEST_REMOTEPW=xxx" FPC=c:\fpc\compiler\ppc386 Emulator execution ------------------ Emulator execution is possible as well. It can't be combined with remote execution though. EMULATOR: name of the emulator to use Examples: make TEST_FPC=~/fpc/compiler/ppcrossarm TEST_OPT=-XParm-linux- \ EMULATOR=qemu-arm make TEST_FPC=~/fpc/compiler/ppcrossarm TEST_OPT=-XParm-linux- \ EMULATOR=qemu-arm digest DBDIGESTOPT="-C qemu-arm" USESQL=YES Example cross testing of target Mac OS with driver Darwin -------------------------------------------------------- NOTE: Today, it is possible to run the test suite Mac OS native. A machine with both Mac OS X and classic Mac OS installed is required. Note that make will not run the tests. This has to be done in MPW with the scripts in utils/MacOS. make clean alltest TEST_OS_TARGET=MacOS TEST_OPT="-WT -st" \ USEUNITDIR=/Projekt/Freepascal/fpc/rtl/MacOS To clean. Note that same options as above has to be given so that the correct files will be removed. make clean TEST_OS_TARGET=MacOS USEUNITDIR=/Projekt/Freepascal/fpc/rtl/MacOS Example cross testing of target arm-wince ----------------------------------------- //arm-wince example: see FPCTRUNK\DEMO\WINCE\TESTEMU\ for additionally required tools Connect your device via ActiveSync and execute: make TEST_FPC=ppcrossarm TEST_CPU_TARGET=arm TEST_OS_TARGET=wince \ TEST_OPT="-XParm-wince- -WC -Xs" \ EMULATOR=MyDisc:\My\Path\to\wcetemu.exe Tests will be performed in the \fpctests folder on the device. Result uploading ---------------- Results can be uploaded to the test suite result DB (http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi) by executing make uploadrun On unix: - The testing machine must be enabled to login on www.freepascal.org automatically as user fpc with ssh. On Windows: - The putty utilities plink.exe and pscp.exe must be in the path - There must be a putty session named fpc@www.freepascal.org which is enabled to login automatically into www.freepascal.org