[Mono-list] JITer / Windows

Paolo Molaro lupus@ximian.com
Sat, 6 Apr 2002 16:13:39 +0200


On 04/03/02 Serge wrote:
> > That way we do not need
> > macros, which are quite confusing IMO.
> 
> I completely agree, will change this.
> Actually, in the future I'd prefer to use some mono-defined structure rather
> than straight sigcontext. As a part of os/arch interface or host API. Some
> things that also seems suitable for such interface are i-cache flushing
> (some OSes have API/syscall for this) and code-memory allocation (it seems
> that under Windows g_malloc always allocates memory that is executable, but
> anyway).

We'll need to handle this for Linux, too: there is no guarantee malloc()
returns executable memory. I think the beter approach on unix-like
systems is to just use an anonymous mmap() call and sequentially
write the code into that area. Say, you allocate 64-128 KB with mmap
at once and just write the methods one after another: this should
automatically give also some code locality for related methods since
we compile them as needed. A different buffer could be used for
static constructors, since they are executed just once tipically
the code could be discarded after it's executed and so it may be better
to alloc that with malloc.
i-cache flushing is processor-specific, it doesn't depend on the OS,
AFAIK (though it may need to be coded in the compiler-specific asm
keyword variant).

Anyway, I don't know if it makes sense to have OS-specific directories
or modules since the OS details should be really small and can be
#ifdeffed in the source (the io-layer is an exception, of course, but
I don't consider it an OS-specific detail:-).

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better