Thanks Aleks for the quick response. That cleared things
up for me. I was naively assuming that the TBP would be
implemented as a function pointer component of the variable
instance (sort of a cached lookup I suppose), but you're
right that this is potentially a lot of unnecessary memory
overhead for a function associated to type and not instance.
So if reducing runtime overhead is of prime importance, it
would be better to use procedure pointer components instead
where necessary.
-Neil
On Thu, 2008-10-09 at 11:14 -0700, Aleksandar Donev wrote:
> On Thursday 09 October 2008 11:07, Neil N. Carlson wrote:
>
> > Am I right in my belief that there
> > should be no need behind the scenes to determine the dynamic type
> There will be overhead of dynamic dispatch.
>
> > the address of the TBP is found at the same offset from the address of
> > variable regardless of type (or some similar mumbo jumbo)?
> For data and procedure components, this is the idea. The TBP, however, does
> not have an offset, because it is not stored in the variable itself (imagine
> the memory overheads!). The TBP is part of the type, and so it is stored in a
> so-called dispatch table which is a table of types along with associated
> procedures and other mumbo jumbo.
>
> So there needs to be a lookup into the table of types. Then, the procedure
> address needs to be read, and then the procedure invoked. So there is more
> overhead than both a regular procedure call and a procedure pointer call.
> But, these overheads migth be small, depending on what is in the TBP.
>
> Never actually implemented or seen the details, but I am not sure if vendors
> would ever actually answer your question, so this is my best.
>
> Aleks
>
Neil Carlson
Email: [log in to unmask]
Los Alamos National Laboratory
Office: 505.665.6386
CCS-2, Computational Physics and
Methods
P.O. Box 1663, MS D413
Los Alamos, NM 87545
|