The hand-written self-hosting TObjectList stored bare Pointers and
took no ARC ref when adding. In loops like
while Check(tkIdent) do
begin
CD := TConstDecl.Create;
...
ABlock.ConstDecls.Add(CD);
end;
reassigning CD on the next iteration released the prior CD (its only
strong ref) and the list's pointer dangled. When a later allocation
reused that heap slot, the list silently contained the wrong object,
and semantic analysis crashed in TSymbol.Create reading CD.Name from
an unrelated object's memory.
Add/Put/Delete/Clear/Destroy now AddRef on insert and Release on
remove or destroy, gated on FOwnsObjects so the semantics match the
real compiler's TObjectList. Extract continues to transfer the ref
to the caller without release.
Lets stage-2 compile the hand source far enough to hit the next bug
(currently a nil Self in TRecordTypeDesc.AddVTableSlot during
AnalyseTypeDecls) — more hand-source polish to follow.