mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
Implemented deserialization of references. References are handled
just like pointers, except that they cannot be backpatched. This means that references are essentially non-owning pointers where the referred object must be deserialized prior to the reference being deserialized. Because of the nature of references, this ordering of objects is always possible. Fixed a bug in backpatching code (returning the backpatched pointer would accidentally include a bit flag). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43570 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -115,7 +115,7 @@ void Deserializer::ReadUIntPtr(uintptr_t& PtrRef) {
|
||||
BPatchEntry& E = BPatchMap[PtrId];
|
||||
|
||||
if (E.hasFinalPtr())
|
||||
PtrRef = E.getRawPtr();
|
||||
PtrRef = E.getFinalPtr();
|
||||
else {
|
||||
// Register backpatch. Check the freelist for a BPNode.
|
||||
BPNode* N;
|
||||
@ -132,6 +132,18 @@ void Deserializer::ReadUIntPtr(uintptr_t& PtrRef) {
|
||||
}
|
||||
}
|
||||
|
||||
uintptr_t Deserializer::ReadInternalRefPtr() {
|
||||
unsigned PtrId = ReadInt();
|
||||
|
||||
assert (PtrId != 0 && "References cannot refer the NULL address.");
|
||||
|
||||
BPatchEntry& E = BPatchMap[PtrId];
|
||||
|
||||
assert (E.hasFinalPtr() &&
|
||||
"Cannot backpatch references. Object must be already deserialized.");
|
||||
|
||||
return E.getFinalPtr();
|
||||
}
|
||||
|
||||
void Deserializer::BPatchEntry::setFinalPtr(BPNode*& FreeList, void* P) {
|
||||
assert (!hasFinalPtr());
|
||||
|
Reference in New Issue
Block a user