[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Dotgnu-libjit] using Libjit with boehm collector
From: |
Basile Starynkevitch |
Subject: |
Re: [Dotgnu-libjit] using Libjit with boehm collector |
Date: |
Wed, 26 Sep 2012 14:50:03 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Sep 14, 2012 at 01:40:16PM +0200, Tommaso Tagliapietra wrote:
> Hi. I've seen that the Portable .NET uses both libjit and Boehm collector.
> I'm very interested in this interaction.
It has been a long time I didn't look inside libjit, so my memory may be rusty.
However...
> However I've seen that Libjit uses standard malloc/calloc/free and
> mmap/VirtualAlloc and I don't understand how this can work with the
> collector.
libjit is using standard malloc... for its own dynamic memory management, hence
in
particular it does not require Boehm's GC to be able to work.
> I'm trying to build an interpreter using Libjit but I'm afraid
> of the usage of function allocations and premature object collections.
Boehm's GC being conservative, as long as there exist some pointers
from the machine call stack to (or just after) the start of GC-ed objects, they
won't be colloected.
> Potentially, jit-ed functions may contain static references to allocated
> object (with boehm collector), then how can I permit boehm to scan "static
> allocations" inside those jit-ed functions?
I believe you don't have to bother (but I might be wrong). For such static
references,
you could also for safety either keep some (indirect) reference on the stack
(i.e. by having closures in your langauge which explicitly references them)
or make them explicit GC roots (by calling GC_add_roots on your segment
of static data containing them).
Hope this helps.
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***