Commit c23a8bce authored by Kevin Modzelewski's avatar Kevin Modzelewski

[not sure] weakrefs for old-style classes

parent 88606baf
......@@ -272,8 +272,9 @@ Box* instanceSetitem(Box* _inst, Box* key, Box* value) {
void setupClassobj() {
classobj_cls = BoxedHeapClass::create(type_cls, object_cls, &BoxedClassobj::gcHandler,
offsetof(BoxedClassobj, attrs), 0, sizeof(BoxedClassobj), false, "classobj");
instance_cls = BoxedHeapClass::create(type_cls, object_cls, &BoxedInstance::gcHandler,
offsetof(BoxedInstance, attrs), 0, sizeof(BoxedInstance), false, "instance");
instance_cls
= BoxedHeapClass::create(type_cls, object_cls, &BoxedInstance::gcHandler, offsetof(BoxedInstance, attrs),
offsetof(BoxedInstance, weakreflist), sizeof(BoxedInstance), false, "instance");
classobj_cls->giveAttr("__new__",
new BoxedFunction(boxRTFunction((void*)classobjNew, UNKNOWN, 4, 0, false, false)));
......
......@@ -54,6 +54,8 @@ public:
BoxedClassobj* inst_cls;
Box** weakreflist;
BoxedInstance(BoxedClassobj* inst_cls) : inst_cls(inst_cls) {}
DEFAULT_CLASS(instance_cls);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment