Re: Efficency in OCaml

From: Hendrik Tews (tews@tcs.inf.tu-dresden.de)
Date: Fri Sep 10 1999 - 17:19:39 MET DST


Date: Fri, 10 Sep 1999 17:19:39 +0200
Message-Id: <199909101519.RAA18663@ithif20.inf.tu-dresden.de>
From: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
To: caml-list@inria.fr
Subject: Re: Efficency in OCaml
In-Reply-To: <19990902010939.12962@pauillac.inria.fr>
 <199909011840.OAA01846@bismarck.chet.org>

Jerome Vouillon writes:
   From: Jerome Vouillon <Jerome.Vouillon@inria.fr>
   Date: Thu, 2 Sep 1999 01:09:39 +0200
   Subject: Re: Efficency in OCaml
   
   [...]
   
   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?

Bye,

Hendrik



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