Hash lookup instead of array scan to detect circular references.