Incremental compilation and type checking

This is a discussion on Incremental compilation and type checking within the Compilers forums in Theory and Concepts category; Hi, 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 ...

Go Back   Application Development Forum > Theory and Concepts > Compilers

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 07-01-2008, 02:41 AM
Gabriele Farina
Guest
 
Default Incremental compilation and type checking

Hi,

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.

In general it would be great if someone can provide me some links to
useful documentation about this topic.

Gabriele
Reply With Quote
  #2  
Old 07-02-2008, 11:48 AM
Eliot Miranda
Guest
 
Default Re: Incremental compilation and type checking

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

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:18 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.