Hack to work-around the current PyPy implementation
Currently PyPy objects use uptr
to point to vtables which contain Mu funcref
fields. Mu require all T
in uptr<T>
to be "native safe", i.e. cannot contain traced references, including Mu function references.
Ideally, vtables should be ordinary heap objects in Mu. But the current official RPython implementation seems to decide that vtables are not managed and are allocated as C global variables. We can simulate this behaviour by putting vtables into global cells and point to them using pointers. This is only a hack. Perhaps the RPython object model needs to be carefully redesigned to fit into Mu without the hack.