On 2023-04-11 07:23, Hairy Pixels via fpc-devel wrote:
Strange question but I heard it brought up during a discussion and I
was very curious what compiler people think about it.
The question is, instead of using a virtual method table would it be
feasible to use a case statement on the
On 11-4-2023 12:11, Hairy Pixels via fpc-devel wrote:
Btw, I was curious because I haven’t done this in so many years but is this
basically how a VTable looks in procedural code?
Every class has a reference to class type information stored at negative
offsets. The class type info contains
> On Apr 11, 2023, at 4:02 PM, Marco van de Voort via fpc-devel
> wrote:
>
> That's what I thought, yes. But the whole analysis stays the same:
>
> - you don't have a list of all possible polymorphic types in the application
> when you compile the average dispatch point, that is in the
On 11-4-2023 10:41, Hairy Pixels via fpc-devel wrote:
case animal.type of
TDog: TDog(animal).DoSomething;
TCat: TCat(animal).DoSomething;
TMouse: TMouse(animal).DoSomething;
end;
This doesn't happen. There is no class that is TDog,Cat and mouse. Usually a
VMT governs the
> On Apr 11, 2023, at 2:58 PM, Marco van de Voort via fpc-devel
> wrote:
>
> But the core problem is that you don't have an overview of all other
> descendants in the compiler. Those can be fragmented over multiple units, and
> then you touch the problem that whole program optimization like
> On Apr 11, 2023, at 2:58 PM, Marco van de Voort via fpc-devel
> wrote:
>
>> case animal.type of
>>TDog: TDog(animal).DoSomething;
>>TCat: TCat(animal).DoSomething;
>>TMouse: TMouse(animal).DoSomething;
>> end;
>
> This doesn't happen. There is no class that is TDog,Cat and
On 11-4-2023 07:23, Hairy Pixels via fpc-devel wrote:
Strange question but I heard it brought up during a discussion and I was very
curious what compiler people think about it.
I hope you don't mind me replying as non compiler person :-)
The question is, instead of using a virtual method
Strange question but I heard it brought up during a discussion and I was very
curious what compiler people think about it.
The question is, instead of using a virtual method table would it be feasible
to use a case statement on the real class type and make a dispatch routine for
each method