JIT and garbage collection

If I recall correctly, the garbage collector interface consists mostly of
some fuctions that one calls during execution to notify the collector
about a GC root. There's one othr thing that's needed if you do JIT
compilation: you have to garbage-collect the generated code. This means
that the collector must be able to find where the pointers are in the
generated code together with metadata.

Is there any support for this?

Yes, the JIT implementation was recently improved to add support for
this. There's nothing you need to do (or emit). The JIT implementation
will automatically collect memory that is not being used. See the
JITMemoryManager in lib/ExecutionEngine/JIT/JITEmitter.cpp for details.

Reid.

Yes, the JIT implementation was recently improved to add support for
this. There's nothing you need to do (or emit). The JIT implementation
will automatically collect memory that is not being used. See the
JITMemoryManager in lib/ExecutionEngine/JIT/JITEmitter.cpp for details.

The JIT doesn't automatically do this. I don't track where function pointers are and autoreclaim. The client must specifically request that specific functions code be deallocated.

-Chris

Would it be a huge change for it to do this? Besides issues of whether
the garbage collector itself contains garbage-collected code, of course.

-- hendrik

How would it work? How would the JIT know where you put function pointers?

-Chris