Commit 7025806b authored by Kevin Modzelewski's avatar Kevin Modzelewski

Remove old __getattr__ dependency tracking

It's no longer being used, and isn't safe to use any more
since it's not invalidated the times it needs to be.
parent 6a63b319
......@@ -454,9 +454,6 @@ struct _typeobject {
void* _hcls;
void* _hcattrs;
// FIXME: this is hardcoding the size of this particular implementation of std::unordered_map
char _dep_getattrs[56]; // gcc 4.8
// char _dep_getattrs[64]; // gcc 4.9
char _ics[32];
void* _gcvisit_func;
void* _dtor;
......
......@@ -2964,7 +2964,6 @@ extern "C" int PyType_Ready(PyTypeObject* cls) noexcept {
assert(cls->attrs.hcls == NULL);
new (&cls->attrs) HCAttrs(HiddenClass::makeSingleton());
#define INITIALIZE(a) new (&(a)) decltype(a)
INITIALIZE(cls->dependent_icgetattrs);
#undef INITIALIZE
BoxedClass* base = cls->tp_base;
......
......@@ -1934,17 +1934,6 @@ void setattrGeneric(Box* obj, const std::string& attr, Box* val, SetattrRewriteA
if (isSubclass(obj->cls, type_cls)) {
BoxedClass* self = static_cast<BoxedClass*>(obj);
if (attr == getattr_str || attr == getattribute_str) {
if (rewrite_args)
REWRITE_ABORTED("");
// Will have to embed the clear in the IC, so just disable the patching for now:
rewrite_args = NULL;
// TODO should put this clearing behavior somewhere else, since there are probably more
// cases in which we want to do it.
self->dependent_icgetattrs.invalidateAll();
}
if (attr == "__base__" && self->getattr("__base__"))
raiseExcHelper(TypeError, "readonly attribute");
......@@ -3997,17 +3986,6 @@ extern "C" void delattrGeneric(Box* obj, const std::string& attr, DelattrRewrite
if (isSubclass(obj->cls, type_cls)) {
BoxedClass* self = static_cast<BoxedClass*>(obj);
if (attr == getattr_str || attr == getattribute_str) {
if (rewrite_args)
REWRITE_ABORTED("");
// Will have to embed the clear in the IC, so just disable the patching for now:
rewrite_args = NULL;
// TODO should put this clearing behavior somewhere else, since there are probably more
// cases in which we want to do it.
self->dependent_icgetattrs.invalidateAll();
}
if (attr == "__base__" && self->getattr("__base__"))
raiseExcHelper(TypeError, "readonly attribute");
......@@ -4017,6 +3995,9 @@ extern "C" void delattrGeneric(Box* obj, const std::string& attr, DelattrRewrite
REWRITE_ABORTED("");
}
}
// Extra "use" of rewrite_args to make the compiler happy:
(void)rewrite_args;
}
extern "C" void delattrInternal(Box* obj, const std::string& attr, DelattrRewriteArgs* rewrite_args) {
......
......@@ -152,12 +152,6 @@ public:
HCAttrs attrs;
// If the user sets __getattribute__ or __getattr__, we will have to invalidate
// all getattr IC entries that relied on the fact that those functions didn't exist.
// Doing this via invalidation means that instance attr lookups don't have
// to guard on anything about the class.
ICInvalidator dependent_icgetattrs;
// TODO: these don't actually get deallocated right now
std::unique_ptr<CallattrIC> hasnext_ic, next_ic, repr_ic;
std::unique_ptr<NonzeroIC> nonzero_ic;
......@@ -268,7 +262,6 @@ static_assert(offsetof(pyston::Box, cls) == offsetof(struct _object, ob_type), "
static_assert(offsetof(pyston::BoxedClass, cls) == offsetof(struct _typeobject, ob_type), "");
static_assert(offsetof(pyston::BoxedClass, tp_name) == offsetof(struct _typeobject, tp_name), "");
static_assert(offsetof(pyston::BoxedClass, attrs) == offsetof(struct _typeobject, _hcls), "");
static_assert(offsetof(pyston::BoxedClass, dependent_icgetattrs) == offsetof(struct _typeobject, _dep_getattrs), "");
static_assert(offsetof(pyston::BoxedClass, gc_visit) == offsetof(struct _typeobject, _gcvisit_func), "");
static_assert(sizeof(pyston::BoxedClass) == sizeof(struct _typeobject), "");
......
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