[PATCH] D26068: Support: Simplify MemoryObject interface.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 06:00:28 PDT 2016


Can we just delete it and the streaming reader?

My understanding was that it was just used for PNaCl and PNaCl is
moving to subzero.

Cheers,
Rafael


On 28 October 2016 at 05:14, Peter Collingbourne via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> pcc created this revision.
> pcc added a reviewer: mehdi_amini.
> pcc added a subscriber: llvm-commits.
>
> This simplifies the existing MemoryObject interface to the following:
>
> /// Returns a reference to a buffer containing all of the data read so far.
> ArrayRef<uint8_t> getBuffer() const;
>
> /// Try to extend the buffer held by this MemoryObject to at least Size
> /// bytes. Calling this function invalidates any buffer previously
> /// returned by getBuffer().
> ///
> /// @result True if successful.
> bool tryExtendTo(uint64_t Size);
>
> /// Returns the size of the region in bytes.  (The region is contiguous, so
> /// the highest valid address of the region is getExtent() - 1). Calling this
> /// function invalidates any buffer previously returned by getBuffer().
> ///
> /// @result The size of the region.
> uint64_t getExtent();
>
> This interface is not only smaller, but it results in better performance
> likely as a result of avoiding a virtual call and a copy for each word we
> read. I observed a performance improvement of 7.5% when using "llvm-dis
> -disable-output" and 3% when using "opt -disable-output -disable-verify"
> to read a bitcode file of size ~11MB (median of 100 runs).
>
>
> https://reviews.llvm.org/D26068
>
> Files:
>   llvm/include/llvm/Bitcode/BitstreamReader.h
>   llvm/include/llvm/Support/MemoryObject.h
>   llvm/include/llvm/Support/StreamingMemoryObject.h
>   llvm/lib/Bitcode/Reader/BitcodeReader.cpp
>   llvm/lib/Support/StreamingMemoryObject.cpp
>   llvm/unittests/Support/StreamingMemoryObjectTest.cpp
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>


More information about the llvm-commits mailing list