This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Speeding up GOOPS


thi <ttn@mingle.glug.org> writes:

> Mikael Djurfeldt writes:
> 
>  > 1. Rewriting compile.scm (code itself 108 lines) into compile.c.
>  > 2. Rewriting dispatch.scm (222 lines) into dispatch.c.
>  > 
>  > Anyone?  :-)
> 
> i'd like to take this task.

Great!  I assume that this means both 1 and 2.

Note that these two modules communicate only with eachother, and that
the only one exported to the "world" is `memoize-method!' from
dispatch.scm.  And this method is imported into the (oop goops) module
only to be captured by C code in goops.c.

This means that you can translate everything to pure C.  You don't
need to create any primitives.

Also, a short note about what these two files do:

Standard generic functions contains a method cache.  When a generic
function is applied to a particular combination of types, hashing is
used to find a matching compiled method in the cache.

In order to optimize the frequency of cache hits and enable a more
compact representation of the cache, every class stores 8 hashvalues.
In the generic function is stored which of these 8 "hashsets" gives
optimal hashing.  If the GF selects hashset 3, the sum of hash value 3
from all argument classes modulo a mask is calculated and used as
index in the cache.

`memoize-method!' is called from the evaluator at cache miss.  It then
computes the list of applicable methods and uses this list and the
argument types as input to the method compiler.  The result of the
method compiler is stored in the cache, which essentially means
testing from scratch which of the 8 hashsets is optimal now and
selecting that one.

The current task if the method compiler is only to prepare for lazy
unfolding of the chain of next-methods, or to take the decision not to
add any next-method at all.

(The future task will be to do some data flow analysis.  Note that we
know the actual types of the arguments.  This information can be used
to eliminate a whole lot of type dispatches...  particularly most
accessor dispatches. :) This means that, with an improved method
compiler, slot accesses through accessors is reduced to a referenc to
a fixed offset in the object.)

[Let's continue any further discussion off this list.]

Best regards,
/mdj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]