Module handling rewrite: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Module handling rewrite
| Old | New | Line | |
|---|---|---|---|
| 1 | + | This page describes the planned unit handling rewrite. It is done in a branch in svn, the url of the branch is <http://svn.freepascal.org/svn/fpc/branches/unitrw/compiler> | |
| 2 | + | ||
| 3 | + | While implementing this, it should be taken care of running this in multiple threads in the middle/far future. | |
| 4 | + | ||
| 5 | + | ## Task list | |
| 6 | + | ||
| 7 | + | - open file | |
| 8 | + | - Parse header | |
| 9 | + | - Parse uses | |
| 10 | + | - Parse interface | |
| 11 | + | - parse impl. header | |
| 12 | + | - parse impl. uses | |
| 13 | + | ||
| 14 | + | - load unit | |
| 15 | + | - find unit | |
| 16 | + | - load ppu header | |
| 17 | + | - load ppu interface | |
| 18 | + | - load ppu impl. | |
| 19 | + | ||
| 20 | + | - write ppu | |
| 21 | + | - write object file | |
| 22 | + | ||
| 23 | + | ## Task queue | |
| 24 | + | ||
| 25 | + | - each task gets a two lists: task which must be processed before itself and tasks which depend on itself | |
| 26 | + | - each task class gets a counter each time a new task to process is search, that counter is increased when searching a task to process, | |
| 27 | + | - the queue is walked if a task without empty dependencies is found, it is moved to the end of the queue | |
| 28 | + | - if a task is found with the same number as the current queue walking, the dependencies can't be resolved =\> error | |
| 29 | + | - if a task with an empty dependencies list is found, it is executed after it is finished, it gets removed from the dependency lists of tasks waiting for it | |
| 30 | + | ||
| 31 | + | ## Misc | |
| 32 | + | ||
| 33 | + | Two lesser problems with the module system: | |
| 34 | + | ||
| 35 | + | - Currently there is no way to have a set of units in one (or two) files. It would clean up tremendously if the all .ppu's and all .o/.a's could be in one file (or one file each), and the need for a dir structure to store all units would go away. | |
| 36 | + | - Currently there is no scheme to efficiently have a different set of units in the path. E.g. .ppu's suitable for dynamic linking, units that are a result of devirtualization attempts etc, short of have separate hierarchies. I personally didn't like the oder attempts (shared/ and smart/ directory) with separate hierarchies. | |
| 37 | + | ||
| 38 | + | --- | |
| 39 | + | *From the Free Pascal wiki, page "Module handling rewrite", as it stood on 2015-07-25 after a change by FTurtle, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 40 | + | Category: Old or unknown pages |
