[PATCH] MCObjectSymbolizer

Stephen Checkoway s at pahtak.org
Mon Oct 14 15:49:14 PDT 2013


MCObjectSymbolizer currently iterates through each symbol every time it is asked to tryAddingSymbolicOperand. With many symbols, this takes a very long time.

The attached patch iterates through the symbols the first time this is needed and puts them in a sorted vector. Subsequent lookups use std::upper_bound() to find the symbol in log(n) time.

Without the patch, calling MCObjectDisassembler::buildModule(/* withCFG */ false) on an unstripped build of Chromium took more than 2 hours (which is when I gave up on it). With the patch, it takes 24 seconds.

My particular build of Chromium has 474,222 symbols (as counted with nm chrome|wc -l) and is 2.1 GB.

It is difficult to test the speedup with llvm-objdump because passing true for withCFG uses more than my available 32 GB of RAM when run on a 7.3 MB file and on smaller files, e.g., my 3 MB ninja binary, the difference in speed is in the noise. And even then, it's using about 6 GB of RAM.

-- 
Stephen Checkoway


-------------- next part --------------
A non-text attachment was scrubbed...
Name: put-symbols-in-map.diff
Type: application/octet-stream
Size: 4289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131014/dc9643fe/attachment.obj>
-------------- next part --------------





More information about the llvm-commits mailing list