[LLVMdev] JIT allocates global data in function body memory

Reid Kleckner rnk at mit.edu
Thu Jul 2 17:20:57 PDT 2009

On Thu, Jul 2, 2009 at 3:09 PM, Evan Cheng<evan.cheng at apple.com> wrote:
> The patch looks good to me. But we cannot allow AllocateGVsWithCode to
> be initialized to be false yet. Can you add a mechanism to define the
> behavior when the JIT is created / initialized?

That makes four optional arguments to ExecutionEngine::create.  Do you
mind if I go ahead and add an EngineBuilder?

> Also, I am not crazy about this being moved to JITMemoryManager.h.
> This seems like implementation detail that should be kept hidden.
> +  // If the PoisonMemory parameter is true, freed memory should be
> overwritten
> +  // with garbage.  This parameter is useful for testing and debugging.
> +#ifdef NDEBUG
> +#define POISON true
> +#else
> +#define POISON false
> +#endif

I wasn't crazy about it either, but it was hard to construct a
unittest that fails properly under release mode without it.  It also
seems like it would be a useful feature for writing unit tests for
other custom memory managers.  I can either axe it and let the test
only do proper testing in debug mode, or I could add a
setPoisonMemory(bool poison) method to the JITMemoryManager interface.
 Which would you prefer?


More information about the llvm-dev mailing list