Commit 3580fc81 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #46 from undingen/small_improvements

Rearrange BoxedClass members to reduce size slightly (8 Bytes)
parents 31f9357e b00af904
......@@ -335,25 +335,25 @@ class BoxedClass : public HCBox {
//typedef void (*Dtor)(Box*);
typedef void* Dtor;
// whether or not instances of this class are subclasses of HCBox,
// ie they have python-level instance attributes:
const bool hasattrs;
// compiler-level (cf python-level) destructor, that does things like decrementing
// refcounts of any attributes
const Dtor dtor;
// Whether this class object is constant or not.
// Does not necessarily imply that the instances of this class are constant,
// though for now (is_constant && !hasattrs) does imply that the instances are constant.
bool is_constant;
// 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;
// whether or not instances of this class are subclasses of HCBox,
// ie they have python-level instance attributes:
const bool hasattrs;
// Whether this class object is constant or not.
// Does not necessarily imply that the instances of this class are constant,
// though for now (is_constant && !hasattrs) does imply that the instances are constant.
bool is_constant;
BoxedClass(bool hasattrs, Dtor dtor);
void freeze() {
assert(!is_constant);
......
......@@ -278,7 +278,7 @@ extern "C" void checkUnpackingLength(i64 expected, i64 given) {
raiseExc();
}
BoxedClass::BoxedClass(bool hasattrs, BoxedClass::Dtor dtor): HCBox(&type_flavor, type_cls), hasattrs(hasattrs), dtor(dtor), is_constant(false) {
BoxedClass::BoxedClass(bool hasattrs, BoxedClass::Dtor dtor): HCBox(&type_flavor, type_cls), dtor(dtor), hasattrs(hasattrs), is_constant(false) {
}
extern "C" const std::string* getNameOfClass(BoxedClass* 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