Two-phase compiling
We modified our compiler to compile in two stages. First stage is doing analysis, the second stage the actual compiling.
This helps us in several ways (in order of importance, when we did
the changes):
- LocAlloc can be implemented. Localloc is a way to allocate memory
in the local heap. On method exit, the allocated memory is freed again.
This means we have to put the memory pointers on the stack. This
involves reserving space in the method header, and cleaning up the
space (and freeing the memory) in the method footer.
Now during analysis stage, we check to see how many LocAllocs are
performed (and we keep track of which localloc is at which position),
and during compiling, we use that information to make it work.
- Accuracy of the progress bar during compilation. In the past the
progress bar in the compilation window wasn't really accurate (read:
was unreliable to see the actual state). Now after the first state, the
compiler knows what methods, fields, types, etc are to be compiled, so
after that, the progress bar is reliable.
- Speed. This is not yet implemented, but will be at some point.
This two-phase compilation stage will help us implement some
performance enhancements in the compiler:
- Incremental compilation. Most of the time you compile your
Cosmos kernel, only one or two assemblies change (both the actual
content of the methods, as the methods/types used from an assembly).
Right now, all needed methods are recompiled again. As we now first see
what's needed and then start compiling, we could also see if we can
reuse some compiler artifacts from a previous compilation, to speed up
compilation.
- Incremental builds. Most developers are using machines which contain dual-core (or quadcore) CPUs. Right now, our compiler just uses one thread. The two-stage compiling changes help us implementing multithreaded processing in the future.
Lately, our kernel became tick-less. This means, when idling (waiting for a readline or so) it only consumes like 3Mhz.
Things the team is working on:
Networking (RTL8139, UDP, ICMP, TCP?): Chad and Frode
GC: Ralf
ATA/Ext2/Compiler bugfixes: Matthijs