Re: Implementation of "class inheritance" in a compiler

A Pietu Pohjalainen <pohjalai@cc.helsinki.fi>
13 Sep 2004 10:46:59 -0400

          From comp.compilers

Related articles
Implementation of "class inheritance" in a compiler dev@gioelebarabucci.com (Gioele Barabucci) (2004-09-08)
Re: Implementation of "class inheritance" in a compiler pohjalai@cc.helsinki.fi (A Pietu Pohjalainen) (2004-09-13)
Re: Implementation of "class inheritance" in a compiler arnold@skeeve.com (2004-09-13)
Re: Implementation of "class inheritance" in a compiler tzvetanmi@yahoo.com (2004-09-13)
Re: Implementation of "class inheritance" in a compiler dev@gioelebarabucci.com (Gioele Barabucci) (2004-09-24)
Re: Implementation of "class inheritance" in a compiler hannah@schlund.de (2004-10-02)
Re: Implementation of "class inheritance" in a compiler arnold@skeeve.com (2004-10-04)
| List of all articles for this month |
From: A Pietu Pohjalainen <pohjalai@cc.helsinki.fi>
Newsgroups: comp.compilers
Date: 13 Sep 2004 10:46:59 -0400
Organization: University of Helsinki
References: 04-09-072
Keywords: OOP, Java
Posted-Date: 13 Sep 2004 10:46:59 EDT

Gioele Barabucci <dev@gioelebarabucci.com> wrote:
> may you suggest me some readings (web, books, magazines) that examplain how
> compilers can implement classes (memory layout...), templates and
> inheritance in compiled languages like C++ or Java?


> Usually the standards don't mandate a precise implementation, so compilers'
> writers must have deal with these problems. Are there papers or books that
> on this topics that reports their attempts?




Java defines the exact representation of inheritance in the bytecode
form. In the bytecode file, there is a field that defines that class'
super class, this field being an index in the class constant pool.


Then, all the interfaces implemented by this class are listed in two
fields, where the first field tells the number of implemented interfaces
and the next one lists indexes to constant pool, where the actual names
of the interfaces are specified.


This organization is possible, as the resolving of inheritance is
performed at run-time. For further information, I'd suggest O'Reilly's
book 'Java Virtual Machine'; it is a bit old in terms of years, but the
class file format hasn't changed since its printing, which seems to have
been 1997.


br,
Pietu Pohjalainen



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.