mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-03 08:55:51 +00:00
Fix a heinous inefficiency introduced in r149918, wherein reading each byte of a
BLOB (i.e., large, performance intensive data) in a bitcode file was switched to invoking one virtual method call per byte read. Now we do one virtual call per BLOB. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173065 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
afe77f33b2
commit
69582cf6c4
@ -237,12 +237,6 @@ public:
|
|||||||
static_cast<uint64_t>(pos - 1));
|
static_cast<uint64_t>(pos - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char getByte(size_t pos) {
|
|
||||||
uint8_t byte = -1;
|
|
||||||
BitStream->getBitcodeBytes().readByte(pos, &byte);
|
|
||||||
return byte;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t getWord(size_t pos) {
|
uint32_t getWord(size_t pos) {
|
||||||
uint8_t buf[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
|
uint8_t buf[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||||
BitStream->getBitcodeBytes().readBytes(pos, sizeof(buf), buf, NULL);
|
BitStream->getBitcodeBytes().readBytes(pos, sizeof(buf), buf, NULL);
|
||||||
|
@ -255,18 +255,17 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, read the number of bytes. If we can return a reference to
|
// Otherwise, inform the streamer that we need these bytes in memory.
|
||||||
// the data, do so to avoid copying it.
|
const char *Ptr = (const char*)
|
||||||
|
BitStream->getBitcodeBytes().getPointer(CurBitPos/8, NumElts);
|
||||||
|
|
||||||
|
// If we can return a reference to the data, do so to avoid copying it.
|
||||||
if (Blob) {
|
if (Blob) {
|
||||||
*Blob =
|
*Blob = StringRef(Ptr, NumElts);
|
||||||
StringRef((const char*)BitStream->getBitcodeBytes().getPointer(
|
|
||||||
CurBitPos/8, NumElts),
|
|
||||||
NumElts);
|
|
||||||
} else {
|
} else {
|
||||||
// FIXME: This is a brutally inefficient way to do this. Why isn't this
|
// Otherwise, unpack into Vals with zero extension.
|
||||||
// just using getPointer?
|
|
||||||
for (; NumElts; --NumElts)
|
for (; NumElts; --NumElts)
|
||||||
Vals.push_back(Read(8));
|
Vals.push_back((unsigned char)*Ptr++);
|
||||||
}
|
}
|
||||||
// Skip over tail padding.
|
// Skip over tail padding.
|
||||||
JumpToBit(NewEnd);
|
JumpToBit(NewEnd);
|
||||||
|
Loading…
Reference in New Issue
Block a user