Re: Efficency in OCaml

From: Jerome Vouillon (Jerome.Vouillon@inria.fr)
Date: Wed Sep 15 1999 - 14:39:24 MET DST


Date: Wed, 15 Sep 1999 14:39:24 +0200
From: Jerome Vouillon <Jerome.Vouillon@inria.fr>
To: Hendrik Tews <tews@tcs.inf.tu-dresden.de>, caml-list@inria.fr
Subject: Re: Efficency in OCaml
In-Reply-To: <199909101519.RAA18663@ithif20.inf.tu-dresden.de>; from Hendrik Tews on Fri, Sep 10, 1999 at 05:19:39PM +0200

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



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:25 MET