[LLVMdev] bug in the JIT global variable emitter

Nuno Lopes nunoplopes at sapo.pt
Thu Oct 16 08:45:53 PDT 2008


>> Ok, thanks for the explanation. So my first patch doesn't work.
>> Also, to be
>> clear, this bug has nothing to do with overflowing the JIT memory
>> buffer.
>> I made another one that takes keeps the allocation of global
>> variables in
>> the JIT buffer, but it creates a new mem block if it doesn't exist
>> (i.e.
>> when dumping a global variable out of the scope of a function
>> compilation).
>> The patch is at:
>> http://web.ist.utl.pt/nuno.lopes/llvm_jit_global_emitter2.txt
>
> OK, I think I finally understand this:  the allocation in
> JIT::getOrEmitGlobalVariable doesn't call into JITEmitter but uses the
> MachineCodeEmitter directly.  Thus, if you call it from outside the
> JITEmitter, it won't update the data structures the JITEmitter relies
> on.   In the usual case, the JITEmitter calls into JIT and updates its
> own data structures, so that case works fine.

exactly! :)  Thank you for summarizing. I hope others can now follow this 
description.


> I think adding a smarter allocateSpace to JITEmitter is the right
> general idea, and your patch looks OK.   I'd like to get another pair
> of eyes on it though, as I find this area not straightfoward:)  Please
> run the testsuite before committing.

Yes, I would also appreciate more reviewers. The JIT's code is particularly 
complex and I'm also quite new to the LLVM code..

Thanks,
Nuno 




More information about the llvm-dev mailing list