Sign in Join

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

Mailing lists / fpc-devel / 2006-08

The "implements" keyword

7 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

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

Christian Iversen

Finally I got some spare time for coding.

So, after quite a bit of help from Florian (Thank you!), the implements-keyword is.... well, IMPLEMENTED! Finally!

It's not yet in trunk, but it will be soon.

As far as I can tell, it's completely hack-free, but I will submit the revisions as patches for code review.

The code is still not complete, and there are some needed changes that will happen when I can find the time (for instance, what's the procedure to add new compiler messages? should I just add them to errore.msg?)

The current version of the patch adds 2*sizeof(pointer) to each TInterfaceEntry. That might seem like a lot, but with bitpacking this can be brought down to just 1*sizeof(pointer).

Now, to make the bitpacking I need to be able to assume VMT's are always aligned to at least 4-byte boundaries. I think this is a safe assumption, but maybe it's not?

(if this is not possible, it's not a huge problem, just a slight waste of space)

I'd be happy to answer any questions, or hear any comments regarding this new feature.

Regards, Christian Iversen

Reply by email

Christian Iversen
to Christian Iversen

Ok, so now it IS in trunk. It works with fields assignments (virtual and static interface-proxy methods are not yet supported)

There's a few debug statements left in as comments, but those will be removed soon.

Regards, Christian Iversen

Reply by email

Martin Schreiber
to Christian Iversen: Finally I got some spare time for coding. So, after quite a bit of help from Florian…
Christian Iversen wrote 5 lines
Finally I got some spare time for coding. So, after quite a bit of help from Florian (Thank you!), the implements-keyword is.... well, IMPLEMENTED! Finally!

Great, thank you very much!
I really like this feature.
Do method resolution clauses ("procedure interface.interfacemethod = implementingmethod") work too?

Martin

Reply by email

Florian Klaempfl
to Christian Iversen: Finally I got some spare time for coding. So, after quite a bit of help from Florian…
Christian Iversen wrote 13 lines
Finally I got some spare time for coding. So, after quite a bit of help from Florian (Thank you!), the implements-keyword is.... well, IMPLEMENTED! Finally! It's not yet in trunk, but it will be soon. As far as I can tell, it's completely hack-free, but I will submit the revisions as patches for code review. The code is still not complete, and there are some needed changes that will happen when I can find the time (for instance, what's the procedure to add new compiler messages? should I just add them to errore.msg?)

Yes, at the appropriate place. Then run make msg in fpc/compiler and commit the changed msg*.inc files as well.

Show quoted text 8 lines
The current version of the patch adds 2*sizeof(pointer) to each TInterfaceEntry. That might seem like a lot, but with bitpacking this can be brought down to just 1*sizeof(pointer). Now, to make the bitpacking I need to be able to assume VMT's are always aligned to at least 4-byte boundaries. I think this is a safe assumption, but maybe it's not?

Well, when compiling optimized for size it isn't I fear.

Show quoted text 7 lines
(if this is not possible, it's not a huge problem, just a slight waste of space) I'd be happy to answer any questions, or hear any comments regarding this new feature.

Reply by email

Christian Iversen
to Martin Schreiber: Great, thank you very much! I really like this feature. Do method resolution clauses…
Martin Schreiber wrote 10 lines
On Sunday 06 August 2006 02.39, Christian Iversen wrote: > Finally I got some spare time for coding. > > So, after quite a bit of help from Florian (Thank you!), the > implements-keyword is.... well, IMPLEMENTED! Finally! Great, thank you very much! I really like this feature. Do method resolution clauses ("procedure interface.interfacemethod = implementingmethod") work too?

Yes I'm almost sure that works too - although I didn't make it.

Regards, Christian Iversen

Reply by email

Christian Iversen
to Florian Klaempfl: Yes, at the appropriate place. Then run make msg in fpc/compiler and commit the changed…
Florian Klaempfl wrote 17 lines
Christian Iversen wrote: > Finally I got some spare time for coding. > > So, after quite a bit of help from Florian (Thank you!), the > implements-keyword is.... well, IMPLEMENTED! Finally! > > It's not yet in trunk, but it will be soon. > > As far as I can tell, it's completely hack-free, but I will submit the > revisions as patches for code review. > > The code is still not complete, and there are some needed changes that > will happen when I can find the time (for instance, what's the procedure > to add new compiler messages? should I just add them to errore.msg?) Yes, at the appropriate place. Then run make msg in fpc/compiler and commit the changed msg*.inc files as well.

Ok, I'll do that.

Show quoted text 9 lines
> The current version of the patch adds 2*sizeof(pointer) to each > TInterfaceEntry. That might seem like a lot, but with bitpacking this can > be brought down to just 1*sizeof(pointer). > > Now, to make the bitpacking I need to be able to assume VMT's are always > aligned to at least 4-byte boundaries. I think this is a safe assumption, > but maybe it's not? Well, when compiling optimized for size it isn't I fear.

It would really save a lot of space if we could just agree to always align VMTs to 4-byte boundaries. Trying to pack them together actually hurts the size, in the case of interfaces.

Regards, Christian Iversen

Reply by email

Peter Vreman
to Christian Iversen
you wrote 34 lines
On Sunday 06 August 2006 12:12, Florian Klaempfl wrote: > Christian Iversen wrote: > > Finally I got some spare time for coding. > > > > So, after quite a bit of help from Florian (Thank you!), the > > implements-keyword is.... well, IMPLEMENTED! Finally! > > > > It's not yet in trunk, but it will be soon. > > > > As far as I can tell, it's completely hack-free, but I will submit the > > revisions as patches for code review. > > > > The code is still not complete, and there are some needed changes that > > will happen when I can find the time (for instance, what's the procedure > > to add new compiler messages? should I just add them to errore.msg?) > > Yes, at the appropriate place. Then run make msg in fpc/compiler and > commit the changed msg*.inc files as well. Ok, I'll do that. > > The current version of the patch adds 2*sizeof(pointer) to each > > TInterfaceEntry. That might seem like a lot, but with bitpacking this can > > be brought down to just 1*sizeof(pointer). > > > > Now, to make the bitpacking I need to be able to assume VMT's are always > > aligned to at least 4-byte boundaries. I think this is a safe assumption, > > but maybe it's not? > > Well, when compiling optimized for size it isn't I fear. It would really save a lot of space if we could just agree to always align VMTs to 4-byte boundaries. Trying to pack them together actually hurts the size, in the case of interfaces.

It is already always aligned. See code in nobj.pas. There is no check for optimization on sizes.

Peter

Reply by email