Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-11

Suggestion regarding dynamic packages

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Max Vlasov

Hi,
I recently read the info about current implementation of packages and a post that dynamic packages support is at the early stage or not started yet. Knowing that fpc developers is very skilled and they probably the know things better than me I just wanted to suggest to implement something toward the needed direction without even deciding on major details (sorry if it's already considered)

A little history. When the dynamic packages were introduced in Delphi, I did a little inquiry about the magic behind it and the major change I noticed was actually changing everything addressable in interface sections of units from direct addressing to indirect addressing. So, if there's a variable in the interface section of a unit, the corresponding dcu would not have a direct entry to be linked, but actually an entry that contained the address to the actuall variable. Interesting was the fact that it was true even for everything statically linked (as I suppose, in order not to do the things too complex). This would allow for the compiler to make a long table of entries from one package that it needs from other packages, and the long list of entries of the entries it offers to other packages. After that depending on the build type, this tables were directly linked (single exe) or splitted to import and export sections of dlls (bpl).

So, I just wanted to suggest that regardless of the magic different platform has about such dynamic linking, there's something similar to this indirect addressing possibly should be done with interfaces sections of the unit. So even without actual dynamic packages implementation details, the fpc compiler could start support intdirect addressing for ppu files. It may be a conditional mode and in this case every ppu just can introduce a flag indicating the mode it was compiled with or just be gradually implemented unconditionally. The latter is not good for performance reasons and as I recall after the discovery about indirect addressing we did some tests and some artificial projects (for example a loop variable placed in the interface section of a unit) showed very little performance degradation, but for general approach it was almost unnoticeable.

What you think?

Thanks,

Max Vlasov,
maxerist.net

Reply by email

Willibald Krenn
to Max Vlasov

Hi,

Max Vlasov wrote
I recently read the info about current implementation of packages and a post that dynamic packages support is at the early stage or not started yet. Knowing that fpc developers is very skilled and they probably the

I've been very busy lately, so the implementation did not really start yet. All I've done so far is contributing some fixes for the win64 target so that I can actually debug the fpc compiler on my machine... ;-)

<...snip...>

Show quoted text 15 lines
So, I just wanted to suggest that regardless of the magic different platform has about such dynamic linking, there's something similar to this indirect addressing possibly should be done with interfaces sections of the unit. So even without actual dynamic packages implementation details, the fpc compiler could start support intdirect addressing for ppu files. It may be a conditional mode and in this case every ppu just can introduce a flag indicating the mode it was compiled with or just be gradually implemented unconditionally. The latter is not good for performance reasons and as I recall after the discovery about indirect addressing we did some tests and some artificial projects (for example a loop variable placed in the interface section of a unit) showed very little performance degradation, but for general approach it was almost unnoticeable. What you think?

This is interesting information and it sounds very reasonable. However, I haven't made much progress on the package front yet and I still need to read up (better: read again) on what fpc stores in it's .ppu files -- hence I cannot really say what is the best way to implement this feature.. ;) (Obviously I want to change as few things as possible in the fpc internals..)

BTW: My main goal for this year still is to do a proof of concept and to compile the system unit into a "fpcrtl.ppl" with a simple application that uses this package.

Cheers,
Willi

Reply by email

Max Vlasov
to Willibald Krenn
Willibald Krenn wrote 46 lines
Hi, Am 21.11.2010 12:49, schrieb Max Vlasov: I recently read the info about current implementation of packages and a > post that dynamic packages support is at the early stage or not started > yet. Knowing that fpc developers is very skilled and they probably the > I've been very busy lately, so the implementation did not really start yet. All I've done so far is contributing some fixes for the win64 target so that I can actually debug the fpc compiler on my machine... ;-) <...snip...> So, I just wanted to suggest that regardless of the magic different > platform has about such dynamic linking, there's something similar to > this indirect addressing possibly should be done with interfaces > sections of the unit. So even without actual dynamic packages > implementation details, the fpc compiler could start support intdirect > addressing for ppu files. It may be a conditional mode and in this case > every ppu just can introduce a flag indicating the mode it was compiled > with or just be gradually implemented unconditionally. The latter is not > good for performance reasons and as I recall after the discovery about > indirect addressing we did some tests and some artificial projects (for > example a loop variable placed in the interface section of a unit) > showed very little performance degradation, but for general approach it > was almost unnoticeable. > > What you think? > This is interesting information and it sounds very reasonable. However, I haven't made much progress on the package front yet and I still need to read up (better: read again) on what fpc stores in it's .ppu files -- hence I cannot really say what is the best way to implement this feature.. ;) (Obviously I want to change as few things as possible in the fpc internals..) BTW: My main goal for this year still is to do a proof of concept and to compile the system unit into a "fpcrtl.ppl" with a simple application that uses this package.

Willi,
great to know that there's a activity about it. And wanting to change as few things as possible sounds also reasonable. This is also related to the long-time question of the usability of packages in general. On one side they remind Wirth's ideas in Oberon (modules) and would probably allow not only make things better for Lazarus IDE, but also creating lite/full versions of programs easily. On the other side, at least in Delphi the linkage was always strictly bound to detect smallest version changes that is probably good for compiler and not always for the developer. Good luck! :)

Max

Reply by email