[PATCH] D26068: Support: Simplify MemoryObject interface.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 10:04:32 PDT 2016


Agreed that we should consider removing it, but I'd like to first make sure
this is ok with the PNaCl developers. I'll send an RFC to llvm-dev.

Separately though this patch would seem to be a useful step towards
removing it due to the switch to a mostly buffer-based interface.

Peter

On Fri, Oct 28, 2016 at 6:00 AM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> 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
> >
>



-- 
-- 
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161028/8eee76aa/attachment.html>


More information about the llvm-commits mailing list