Re: Incremental compilation and type checking

Eliot Miranda <eliotm@pacbell.net>
Wed, 02 Jul 2008 08:48:34 -0700

          From comp.compilers

Related articles
Incremental compilation and type checking darkbard@gmail.com (Gabriele Farina) (2008-06-30)
Re: Incremental compilation and type checking eliotm@pacbell.net (Eliot Miranda) (2008-07-02)
| List of all articles for this month |
From: Eliot Miranda <eliotm@pacbell.net>
Newsgroups: comp.compilers
Date: Wed, 02 Jul 2008 08:48:34 -0700
Organization: at&t http://my.att.net/
References: 08-07-002
Keywords: types
Posted-Date: 03 Jul 2008 08:28:26 EDT

Gabriele Farina wrote:
> I'm going to start writing a compiler for a typed OO language (similar
> to Java or JS 2.0). This is my first real compiler and I'd like to ask
> you some questions hoping u can help me out in designing the compiler
> correctly.
>
> What I want to do is to support incremental and multithreaded
> compilation, so I can compile each class file separately in an object
> and recompile only the files that have been changed between different
> compilations.
>
> My idea is to compile each file in its own thread, generating an
> itermediate object code which contains a data section and an header
> section. In the data section I'll put the bytecode and the required
> tables (class table, constants table, etc ...), and in the header
> section I'll put some additional informations related to type
> dependencies. During compilation I'll do a partial type check when
> possible, reserving type checking for externally defined types while
> linking the object files.
>
> Linking will be done by one single thread, doing the final checks and
> mergin them together the data sections (adding offsets to the tables
> when necessary).
>
> Do you think that this could work ?
>
> I'm asking about type checking because I've no idea how it is handled
> by multithreaded compilers.


Read up on in-line caches and polymorphic in-line caches in dynamic
languages like Smalltalk and Self. Then leave the type checking to
send time when a message is first sent. If the type check fails rase
a dynamic error. if the type check succeeds the in-line cache at the
send site is suitably updated and subsequent sends for the same type
avoid the type check.


Provide static type checking in a separate whole-program analysis tool
that is not used by the compiler. See Gilad bracha's papers on
typechecking Smalltalk.


You will get both excellent run-time performance form using in-line
caches and a more flexible and pleasant to use type system from keeping
it independent from the run-time.


--
The surest sign that intelligent life exists elsewhere in Calvin &
the universe is that none of it has tried to contact us. Hobbes.
--
Eliot ,,,^..^,,, Smalltalk - scene not herd



Post a followup to this message

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