On Fri, Oct 29, 2004 at 05:19:35PM +0200, Leopold Toetsch wrote:

> The method_lookup doesn't have a vtable indirection. And having a direct
> array lookup doesn't really scale. So the actual code is a bit more
> complicated (and in no way optimized).

Something that just struck me reading this whole thread - can we take
advantage of the lazy approach the prederef cores use? Prime all the slots
in the vtable array with pointers to the same function that actually does
the real work of the method lookup. So we take the lookup hit only when
we call the method. This would also mean that cache invalidation is easy -
if the method is changed (or deleted) just unconditionally reset all the
slots that refer to it back to pointers to the initial lookup function.

However this way we'd suffer on copy on write shared memory pages becoming
unshared if something forked, so (massive premature optimisation alarm bells
ring here) maybe it would also be useful to have an API hook to call to
say "stop being lazy; do whatever work is needed to optimise the situation
for being a parent process that will spawn many children".

Nicholas Clark

Reply via email to