|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Incremental compilation and type checking
Hi,
I'm going to start writing a compiler for a typed 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 |
|
#2
|
|||
|
|||
|
Incremental compilation and type checking
Gabriele Farina wrote:
I'm going to start writing a compiler for a typed 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 |
![]() |
| Viewing: Web Development Archives > FAQs > Compilers > Incremental compilation and type checking |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|