[LLVMdev] bug in the JIT global variable emitter

Nuno Lopes nunoplopes at sapo.pt
Thu Oct 16 11:29:50 PDT 2008


> + /// allocateSpace - reserves space in the current block if any, or
> + /// allocate a new one of the given size + virtual void
> *allocateSpace(intptr_t Size, unsigned Alignment); +
> Please capitalize "reserves".

ok.


> + /// allocateSpace - general-purpose space allocator
> Better comments please. :-) Also please end the sentence with a period
> or Chris' head will explode. :-)

ok, sure, I guess we don't want that :)


> unsigned char *result = (unsigned char *)CurBlock+1;
>  +
>  + if (Alignment == 0) Alignment = 1;
> + result = (unsigned char*)(((intptr_t)result+Alignment-1) &
> + ~(intptr_t)(Alignment-1));
> If type of result is intptr_t, you can avoid some of the casting, right?

Well, I basically copied that code from the MachineCodeEmitter class :P
I must confess that I don't know what the standard says about casting. In 
the last times I tried guessing (when implementing some parts in clang) I 
was wrong, so.. :)

Apart of fixing these minor things, may I commit the patch?

Thanks,
Nuno 




More information about the llvm-dev mailing list