[llvm] r264549 - Support: Implement StreamingMemoryObject::getPointer

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 04:24:11 PDT 2016


> +const uint8_t *StreamingMemoryObject::getPointer(uint64_t Address,
> +                                                 uint64_t Size) const {
> +  fetchToPos(Address + Size - 1);
> +  return &Bytes[Address + BytesSkipped];
> +}
> +

BTW, any thoughts about using a std::vector<std::pair<unsigned,
uint8_t*>> Bytes in StreamingMemoryObject?

The idea is that each read advances the file from Pos and reads it
into a new buffer whose offset and pointer is added to Bytes. The
restriction to using getPointer then is just that the entire blob be
fetched in one read, but the returned pointers would always be valid.

Cheers,
Rafael


More information about the llvm-commits mailing list