broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(classes, objects, roots):
    def ref_slots(o):
        ob = objects[o]
        cls = classes[ob['class']]
        if cls['kind'] == 'objarray':
            return list(range(3, 3 + ob['words'][2]))
        if cls['kind'] == 'primarray':
            return []
        slots = []
        c = ob['class']
        while c is not None:
            for off, cnt in classes[c]['maps']:
                slots.extend(range(off, cnt))
            c = classes[c]['super']
        return slots
    seen = set()
    stack = list(roots)
    bad = []
    while stack:
        o = stack.pop()
        if o in seen:
            continue
        seen.add(o)
        words = objects[o]['words']
        for s in ref_slots(o):
            v = words[s]
            if v == 0:
                continue
            if v not in objects:
                bad.append([o, s])
                continue
            stack.append(v)
    return {'live': sorted(seen), 'bad': sorted(bad)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: trace through fields, arrays and subclasses',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [100]),
   {'bad': [], 'live': [100, 101, 102, 103, 104, 107]}),
  ('object array elements and trailing padding',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [102]),
   {'bad': [], 'live': [102, 103, 104, 107]}),
  ('primitive array contents are not references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [103]),
   {'bad': [], 'live': [103]}),
  ('inherited reference field of a subclass',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [104]),
   {'bad': [], 'live': [104, 107]}),
  ('integer field that equals an object id',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [109, 101]),
   {'bad': [], 'live': [101, 105, 109]}),
  ('control: base object without references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [106]),
   {'bad': [], 'live': [106]})],
 [('regression: trace through fields, arrays and subclasses',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [100]),
   {'bad': [], 'live': [100, 101, 102, 103, 104, 107]}),
  ('object array elements and trailing padding',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [102]),
   {'bad': [], 'live': [102, 103, 104, 107]}),
  ('primitive array contents are not references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [103]),
   {'bad': [], 'live': [103]}),
  ('inherited reference field of a subclass',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [104]),
   {'bad': [], 'live': [104, 107]}),
  ('integer field that equals an object id',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [109, 101]),
   {'bad': [], 'live': [101, 105, 109]}),
  ('control: base object without references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [107]),
   {'bad': [], 'live': [107]})],
 [('regression: trace through fields, arrays and subclasses',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [100]),
   {'bad': [], 'live': [100, 101, 102, 103, 104, 107]}),
  ('object array elements and trailing padding',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [102]),
   {'bad': [], 'live': [102, 103, 104, 107]}),
  ('primitive array contents are not references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [103]),
   {'bad': [], 'live': [103]}),
  ('inherited reference field of a subclass',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [104]),
   {'bad': [], 'live': [104, 107]}),
  ('integer field that equals an object id',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [109, 101]),
   {'bad': [], 'live': [101, 105, 109]}),
  ('control: base object without references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [105]),
   {'bad': [], 'live': [105]})],
 [('regression: trace through fields, arrays and subclasses',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [100]),
   {'bad': [], 'live': [100, 101, 102, 103, 104, 107]}),
  ('object array elements and trailing padding',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [102]),
   {'bad': [], 'live': [102, 103, 104, 107]}),
  ('primitive array contents are not references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [103]),
   {'bad': [], 'live': [103]}),
  ('inherited reference field of a subclass',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [104]),
   {'bad': [], 'live': [104, 107]}),
  ('integer field that equals an object id',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [109, 101]),
   {'bad': [], 'live': [101, 105, 109]}),
  ('control: base object without references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [106]),
   {'bad': [], 'live': [106]})],
 [('regression: trace through fields, arrays and subclasses',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [100]),
   {'bad': [], 'live': [100, 101, 102, 103, 104, 107]}),
  ('object array elements and trailing padding',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [102]),
   {'bad': [], 'live': [102, 103, 104, 107]}),
  ('primitive array contents are not references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [103]),
   {'bad': [], 'live': [103]}),
  ('inherited reference field of a subclass',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [104]),
   {'bad': [], 'live': [104, 107]}),
  ('integer field that equals an object id',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [109, 101]),
   {'bad': [], 'live': [101, 105, 109]}),
  ('control: base object without references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [107]),
   {'bad': [], 'live': [107]})]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(classes, objects, roots):
    def ref_slots(o):
        ob = objects[o]
        cls = classes[ob['class']]
        if cls['kind'] == 'objarray':
            return list(range(3, 3 + ob['words'][2]))
        if cls['kind'] == 'primarray':
            return []
        slots = []
        c = ob['class']
        while c is not None:
            for off, cnt in classes[c]['maps']:
                slots.extend(range(off, off + cnt + 1))
            c = classes[c]['super']
        return slots
    seen = set()
    stack = list(roots)
    bad = []
    while stack:
        o = stack.pop()
        if o in seen:
            continue
        seen.add(o)
        words = objects[o]['words']
        for s in ref_slots(o):
            v = words[s]
            if v == 0:
                continue
            if v not in objects:
                bad.append([o, s])
                continue
            stack.append(v)
    return {'live': sorted(seen), 'bad': sorted(bad)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: trace through fields, arrays and subclasses',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [100]),
   {'bad': [], 'live': [100, 101, 102, 103, 104, 107]}),
  ('object array elements and trailing padding',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [102]),
   {'bad': [], 'live': [102, 103, 104, 107]}),
  ('primitive array contents are not references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [103]),
   {'bad': [], 'live': [103]}),
  ('inherited reference field of a subclass',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [104]),
   {'bad': [], 'live': [104, 107]}),
  ('integer field that equals an object id',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [109, 101]),
   {'bad': [], 'live': [101, 105, 109]}),
  ('control: base object without references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 6, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [106]),
   {'bad': [], 'live': [106]})],
 [('regression: trace through fields, arrays and subclasses',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [100]),
   {'bad': [], 'live': [100, 101, 102, 103, 104, 107]}),
  ('object array elements and trailing padding',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [102]),
   {'bad': [], 'live': [102, 103, 104, 107]}),
  ('primitive array contents are not references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [103]),
   {'bad': [], 'live': [103]}),
  ('inherited reference field of a subclass',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [104]),
   {'bad': [], 'live': [104, 107]}),
  ('integer field that equals an object id',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [109, 101]),
   {'bad': [], 'live': [101, 105, 109]}),
  ('control: base object without references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 7, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [107]),
   {'bad': [], 'live': [107]})],
 [('regression: trace through fields, arrays and subclasses',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [100]),
   {'bad': [], 'live': [100, 101, 102, 103, 104, 107]}),
  ('object array elements and trailing padding',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [102]),
   {'bad': [], 'live': [102, 103, 104, 107]}),
  ('primitive array contents are not references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [103]),
   {'bad': [], 'live': [103]}),
  ('inherited reference field of a subclass',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [104]),
   {'bad': [], 'live': [104, 107]}),
  ('integer field that equals an object id',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [109, 101]),
   {'bad': [], 'live': [101, 105, 109]}),
  ('control: base object without references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 8, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [105]),
   {'bad': [], 'live': [105]})],
 [('regression: trace through fields, arrays and subclasses',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [100]),
   {'bad': [], 'live': [100, 101, 102, 103, 104, 107]}),
  ('object array elements and trailing padding',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [102]),
   {'bad': [], 'live': [102, 103, 104, 107]}),
  ('primitive array contents are not references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [103]),
   {'bad': [], 'live': [103]}),
  ('inherited reference field of a subclass',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [104]),
   {'bad': [], 'live': [104, 107]}),
  ('integer field that equals an object id',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [109, 101]),
   {'bad': [], 'live': [101, 105, 109]}),
  ('control: base object without references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 9, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [106]),
   {'bad': [], 'live': [106]})],
 [('regression: trace through fields, arrays and subclasses',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [100]),
   {'bad': [], 'live': [100, 101, 102, 103, 104, 107]}),
  ('object array elements and trailing padding',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [102]),
   {'bad': [], 'live': [102, 103, 104, 107]}),
  ('primitive array contents are not references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [103]),
   {'bad': [], 'live': [103]}),
  ('inherited reference field of a subclass',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [104]),
   {'bad': [], 'live': [104, 107]}),
  ('integer field that equals an object id',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [109, 101]),
   {'bad': [], 'live': [101, 105, 109]}),
  ('control: base object without references',
   ({'Base': {'kind': 'instance', 'maps': [[2, 1]], 'super': None},
     'Derived': {'kind': 'instance', 'maps': [[4, 2]], 'super': 'Base'},
     'Leaf': {'kind': 'instance', 'maps': [], 'super': 'Derived'},
     'Object[]': {'kind': 'objarray', 'maps': [], 'super': None},
     'int[]': {'kind': 'primarray', 'maps': [], 'super': None}},
    {100: {'class': 'Derived', 'words': [51966, 0, 101, 7, 102, 0, 999]},
     101: {'class': 'Base', 'words': [51966, 0, 0, 105]},
     102: {'class': 'Object[]', 'words': [51966, 0, 2, 103, 104, 106]},
     103: {'class': 'int[]', 'words': [51966, 0, 3, 106, 10, 107]},
     104: {'class': 'Leaf', 'words': [51966, 0, 0, 108, 0, 107, 0]},
     105: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     106: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     107: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     108: {'class': 'Base', 'words': [51966, 0, 0, 0]},
     109: {'class': 'Derived', 'words': [51966, 0, 105, 106, 0, 0, 0]}},
    [107]),
   {'bad': [], 'live': [107]})]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Reference runs that start beyond their count scan nothing, so referenced objects are missed.

Precise tracing with per-class reference maps. Objects are word lists: words 0-1 are the header; object arrays keep their length in word 2 and elements in words 3..3+len-1 (anything after is padding); primitive arrays contain no references. Instance classes list [offset, count] runs of reference words and inherit all superclass runs. A reference word of 0 is null; a nonzero reference that is not an object id is reported as [object, word]. Return the reachable ids and the bad references.

split: open-access