caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Nathaniel Gray <n8gray@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Representation of objects
Date: Tue, 16 Aug 2005 15:04:30 -0700	[thread overview]
Message-ID: <aee06c9e050816150491c35f9@mail.gmail.com> (raw)

I've been poking around a bit into the representation of objects in
OCaml and I'm a bit confused.  Based on caml_get_public_method in
asmrun/obj.c and various bits of stdlib/camlinternalOO.ml I see that
the method table is an "array" where the even entries are closures and
the odd entries "tags" -- hashed method names.  (The first two entries
are special.)  The table is stored sorted in order of increasing tag
value.  Please correct me if I've misunderstood something here.

I've got two questions:

1.  Does this mean that essentially all method invocations need to
search the method table?  The method table of a superclass is no
longer a prefix of that of a subclass.  There's a GETMETHOD(i,obj)
bytecode, but I'm struggling to figure out when you could use it.

2.  What about hash collisions?  There's no collision resolution code
in the method lookup functions.

Cheers,
-n8

-- 
>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->


             reply	other threads:[~2005-08-16 22:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-16 22:04 Nathaniel Gray [this message]
2005-08-16 22:40 ` [Caml-list] " Jacques Garrigue
2005-08-16 23:01   ` Nathaniel Gray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aee06c9e050816150491c35f9@mail.gmail.com \
    --to=n8gray@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).