mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-09-27 17:38:08 +03:00
Delegates "weakly" reference objects, meaning that referenced objects can be deleted. Delegate invocations must not invoke on deleted objects. This is achieved as follows: * Each heap object has a sequential number. * Each delegate object is backed by a page storing (object, function, seq) triples. * Deleted objects can be detected by comparing the sequential number stored in the delegate with the sequential number of the object currently on the heap. This is consistent with the AliceSoft's implementation (presumed from the contents of resume save). This implementation removes dead objects from the delegate in DG_CALL and DG_NUMOF instructions. (We could do that more often, e.g. when an object is added to a delegate.) This breaks existing resume saves that contain delegates. For games that predate delegate support, this does not affect the save format.