Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Efficency in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jerome Vouillon <Jerome.Vouillon@i...>
Subject: Re: Efficency in OCaml
On Fri, Sep 10, 1999 at 05:19:39PM +0200, Hendrik Tews wrote:
>    Each object holds a table containing its methods (the table is shared
>    among all objets of a same class). A unique integer is assigned at
>    run-time to each method name of a program.  This integer is used as an
>    index in this table to find the method. As the table is rather sparse,
>    it is implemented as a two-level array (an array of arrays of
>    functions). So, a method call
>      "object#m e1 ... en"
>    is compile in something that looks like
>      "object.(0).(idx mod N).(idx / N) objet e1 ... en"
>    where idx is the integer associated to the method name "m".
>    
> Sorry, I don't understand this. How can the compiler know idx, if
> it is not known until run-time?

idx is a variable which is bound at run-time at the beginning of the
toplevel module containing the method invocation.

-- Jérôme