mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
Revised implementation of BatchReadOwnedPtrs() that deserializes an
array of pointers to not allocate a second array to contain the pointer ids. Fixed bug in the same member function where deserialized pointers were not being registered with the backpatcher. llvm-svn: 43855
This commit is contained in:
parent
076d1903ec
commit
eaafbccdd8
@ -168,17 +168,20 @@ public:
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void BatchReadOwnedPtrs(unsigned NumPtrs, T** Ptrs) {
|
||||
llvm::SmallVector<unsigned,20> PtrIDs;
|
||||
PtrIDs.reserve(NumPtrs);
|
||||
|
||||
void BatchReadOwnedPtrs(unsigned NumPtrs, T** Ptrs, bool AutoRegister=true) {
|
||||
for (unsigned i = 0; i < NumPtrs; ++i)
|
||||
PtrIDs.push_back(ReadInt());
|
||||
|
||||
for (unsigned i = 0; i < NumPtrs; ++i)
|
||||
Ptrs[i] = PtrIDs[i] ? SerializeTrait<T>::Materialize(*this) : NULL;
|
||||
}
|
||||
reinterpret_cast<uintptr_t&>(Ptrs[i]) = ReadInt();
|
||||
|
||||
for (unsigned i = 0; i < NumPtrs; ++i) {
|
||||
unsigned PtrID = reinterpret_cast<uintptr_t>(Ptrs[i]);
|
||||
T* p = PtrID ? SerializeTrait<T>::Materialize(*this) : NULL;
|
||||
|
||||
if (PtrID && AutoRegister)
|
||||
RegisterPtr(PtrID,p);
|
||||
|
||||
Ptrs[i] = p;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ReadPtr(T*& PtrRef, bool AllowBackpatch = true) {
|
||||
|
Loading…
Reference in New Issue
Block a user