- implemented the backend for dynamic arrays. Still needs thorough testing but it should be complete.

- use a memory arena to store flat pointers so that the messed up cleanup can be avoided by deallocating this in bulk.
- added a new SO opcode to the VM to execute a write barrier. This is necessary for all objects that are not linked into one global table, i.e. everything except thinkers and class types.
- always use the cheaper LOS opcode for reading pointers to classes and defaults because these cannot be destroyed during normal operation.
- removed the pointless validation from String.Mid. If the values are read as unsigned the internal validation of FString::Mid will automatically ensure proper results.
This commit is contained in:
Christoph Oelckers 2017-02-07 14:48:27 +01:00
commit 56024a1ebe
8 changed files with 376 additions and 147 deletions

View file

@ -397,6 +397,23 @@ size_t DObject::PropagateMark()
GC::Mark((DObject **)((BYTE *)this + *offsets));
offsets++;
}
offsets = info->ArrayPointers;
if (offsets == NULL)
{
const_cast<PClass *>(info)->BuildArrayPointers();
offsets = info->ArrayPointers;
}
while (*offsets != ~(size_t)0)
{
auto aray = (TArray<DObject*>*)((BYTE *)this + *offsets);
for (auto &p : *aray)
{
GC::Mark(&p);
}
offsets++;
}
return info->Size;
}
return 0;
@ -427,6 +444,28 @@ size_t DObject::PointerSubstitution (DObject *old, DObject *notOld)
}
offsets++;
}
offsets = info->ArrayPointers;
if (offsets == NULL)
{
const_cast<PClass *>(info)->BuildArrayPointers();
offsets = info->ArrayPointers;
}
while (*offsets != ~(size_t)0)
{
auto aray = (TArray<DObject*>*)((BYTE *)this + *offsets);
for (auto &p : *aray)
{
if (p == old)
{
p = notOld;
changed++;
}
}
offsets++;
}
return changed;
}