Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Unified Diff: tools/pnacl-llc/ThreadedStreamingCache.h

Issue 940243003: PNaCl localmod mods in LLVM to 223109 (local files only) (Closed)
Patch Set: xx Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/pnacl-llc/ThreadedStreamingCache.h
diff --git a/tools/pnacl-llc/ThreadedStreamingCache.h b/tools/pnacl-llc/ThreadedStreamingCache.h
index b646dc6afb4009aa70ca57a7e7bac8b26a7b5e74..f68492d2d85cfda3148e5ce5a85cc39a31276756 100644
--- a/tools/pnacl-llc/ThreadedStreamingCache.h
+++ b/tools/pnacl-llc/ThreadedStreamingCache.h
@@ -12,7 +12,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Mutex.h"
-#include "llvm/Support/StreamableMemoryObject.h"
+#include "llvm/Support/StreamingMemoryObject.h"
namespace llvm {
@@ -25,13 +25,11 @@ namespace llvm {
class ThreadedStreamingCache : public llvm::StreamingMemoryObject {
public:
explicit ThreadedStreamingCache(llvm::StreamingMemoryObject *S);
- uint64_t getBase() const override { return 0; }
uint64_t getExtent() const override;
- int readByte(uint64_t address, uint8_t* ptr) const override;
- int readBytes(uint64_t address, uint64_t size,
- uint8_t *buf) const override;
- const uint8_t *getPointer(uint64_t address,
- uint64_t size) const override {
+ uint64_t readBytes(uint8_t *Buf, uint64_t Size,
+ uint64_t Address) const override;
+ const uint8_t *getPointer(uint64_t Address,
+ uint64_t Size) const override {
// This could be fixed by ensuring the bytes are fetched and making a copy,
// requiring that the bitcode size be known, or otherwise ensuring that
// the memory doesn't go away/get reallocated, but it's
@@ -39,31 +37,32 @@ class ThreadedStreamingCache : public llvm::StreamingMemoryObject {
llvm_unreachable("getPointer in streaming memory objects not allowed");
return NULL;
}
- bool isValidAddress(uint64_t address) const override;
- bool isObjectEnd(uint64_t address) const override;
+ bool isValidAddress(uint64_t Address) const override;
/// Drop s bytes from the front of the stream, pushing the positions of the
/// remaining bytes down by s. This is used to skip past the bitcode header,
/// since we don't know a priori if it's present, and we can't put bytes
/// back into the stream once we've read them.
- bool dropLeadingBytes(size_t s) override;
+ bool dropLeadingBytes(size_t S) override;
/// If the data object size is known in advance, many of the operations can
/// be made more efficient, so this method should be called before reading
/// starts (although it can be called anytime).
- void setKnownObjectSize(size_t size) override;
+ void setKnownObjectSize(size_t Size) override;
private:
const static uint64_t kCacheSize = 4 * 4096;
const static uint64_t kCacheSizeMask = ~(kCacheSize - 1);
static llvm::sys::SmartMutex<false> StreamerLock;
- int fetchCacheLine(uint64_t address) const;
+ // Fetch up to kCacheSize worth of data starting from Address, into the
+ // CacheBase, and set MinObjectSize to the new known edge.
+ // If at EOF, MinObjectSize reflects the final size.
+ void fetchCacheLine(uint64_t Address) const;
llvm::StreamingMemoryObject *Streamer;
// Cached data for addresses [CacheBase, CacheBase + kCacheSize)
mutable std::vector<unsigned char> Cache;
- // The MemoryObject is at least this size. Used as a cache for isObjectEnd and
- // isValidAddress
+ // The MemoryObject is at least this size. Used as a cache for isValidAddress.
mutable uint64_t MinObjectSize;
// Current base address for the cache.
mutable uint64_t CacheBase;

Powered by Google App Engine
This is Rietveld 408576698