[vmkit-commits] fix ThreadAllocator regression

Allan Tong actong88 at gmail.com
Sat Aug 7 23:59:09 PDT 2010


Attached patch fixes a regression caused by replacing alloca with
ThreadAllocator.  The threadAllocator goes out of scope too early,
causing the temporary UTF8 object to be freed prematurely before it
has actually had a chance to be used.

Note I also removed the allocation failure check, mostly because it
doesn't seem to be possible for ThreadAllocator to return a NULL (or
at least it'll segfault long before returning).  I'm not really sure
what the strategy is for handling allocation failures.  It seems most
of the code base simply ignores that possibility.  If you do choose to
keep the allocation failure check, at the very least it should be
moved ahead of the temp->size assignment.

I had an earlier patch that simply replaced the whole thing with a
call to asciizConstructUTF8, but I wasn't sure if that was correct
since it would hash the name even if it couldn't find the class.  Is
hashUTF8 only supposed to map strings of classes that are actually
loaded?

 - Allan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loadClassFromAsciiz.patch
Type: text/x-patch
Size: 1005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/vmkit-commits/attachments/20100808/c6dcdf00/attachment.bin>


More information about the vmkit-commits mailing list