Commit 038eb9de authored by Kevin Modzelewski's avatar Kevin Modzelewski

Scan ht_name for heap types

We weren't scanning it as part of the gc handler, so eventually it would
get collected and then __name__ would break.  (un)fortunately, in the
cases that would use it, it looks like it would always get replaced by
another string (the only thing being allocated out of that size bin?),
so it would look like the __name__ was just wrong.

Anyway, this should fix interp2.py
parent 346c350e
......@@ -792,6 +792,7 @@ $1: $(TEST_DIR)/tests/$1 ;
$1: ./microbenchmarks/$1 ;
$1: ./minibenchmarks/$1 ;
$1: ./benchmarks/$1 ;
$1: $(HOME)/pyston-perf/benchmarking/benchmark_suite/$1 ;
$(patsubst %, $$1: %/$$1 ;,$(EXTRA_SEARCH_DIRS))
)
endef
......
......@@ -305,7 +305,6 @@ BoxedClass::BoxedClass(BoxedClass* base, gcvisit_func gc_visit, int attrs_offset
memset(&tp_name, 0, (char*)(&tp_version_tag + 1) - (char*)(&tp_name));
tp_basicsize = instance_size;
tp_flags |= Py_TPFLAGS_HEAPTYPE;
tp_flags |= Py_TPFLAGS_CHECKTYPES;
tp_flags |= Py_TPFLAGS_BASETYPE;
tp_flags |= Py_TPFLAGS_HAVE_CLASS;
......@@ -378,6 +377,7 @@ BoxedHeapClass::BoxedHeapClass(BoxedClass* base, gcvisit_func gc_visit, int attr
tp_as_mapping = &as_mapping;
tp_as_sequence = &as_sequence;
tp_as_buffer = &as_buffer;
tp_flags |= Py_TPFLAGS_HEAPTYPE;
memset(&as_number, 0, sizeof(as_number));
memset(&as_mapping, 0, sizeof(as_mapping));
......@@ -394,6 +394,7 @@ BoxedHeapClass::BoxedHeapClass(BoxedClass* base, gcvisit_func gc_visit, int attr
tp_as_sequence = &as_sequence;
tp_as_buffer = &as_buffer;
tp_name = ht_name->s.c_str();
tp_flags |= Py_TPFLAGS_HEAPTYPE;
memset(&as_number, 0, sizeof(as_number));
memset(&as_mapping, 0, sizeof(as_mapping));
......
......@@ -385,6 +385,12 @@ extern "C" void typeGCHandler(GCVisitor* v, Box* b) {
v->visit(cls->tp_base);
if (cls->tp_dict)
v->visit(cls->tp_dict);
if (cls->tp_flags & Py_TPFLAGS_HEAPTYPE) {
BoxedHeapClass* hcls = static_cast<BoxedHeapClass*>(cls);
assert(hcls->ht_name);
v->visit(hcls->ht_name);
}
}
extern "C" void instancemethodGCHandler(GCVisitor* v, Box* b) {
......
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