Commit 28f29554 authored by Kevin Modzelewski's avatar Kevin Modzelewski

small fixes

parent adb7c160
...@@ -88,11 +88,10 @@ extern "C" void init_ssl(); ...@@ -88,11 +88,10 @@ extern "C" void init_ssl();
extern "C" void init_sqlite3(); extern "C" void init_sqlite3();
extern "C" void PyMarshal_Init(); extern "C" void PyMarshal_Init();
extern "C" void initstrop(); extern "C" void initstrop();
extern "C" void initgc();
namespace pyston { namespace pyston {
void setupGC();
std::vector<BoxedClass*> exception_types; std::vector<BoxedClass*> exception_types;
extern "C" PyObject* PyType_GenericAlloc(PyTypeObject* type, Py_ssize_t nitems) noexcept { extern "C" PyObject* PyType_GenericAlloc(PyTypeObject* type, Py_ssize_t nitems) noexcept {
...@@ -3425,11 +3424,10 @@ void setupRuntime() { ...@@ -3425,11 +3424,10 @@ void setupRuntime() {
// We have to do a little dance to get object_cls and type_cls set up, since the normal // We have to do a little dance to get object_cls and type_cls set up, since the normal
// object-creation routines look at the class to see the allocation size. // object-creation routines look at the class to see the allocation size.
object_cls = static_cast<BoxedClass*>(PyObject_MALLOC(sizeof(BoxedClass))); object_cls = static_cast<BoxedClass*>(PyObject_MALLOC(sizeof(BoxedClass)));
PyObject_INIT(object_cls, NULL);
::new (object_cls) BoxedClass(NULL, 0, 0, sizeof(Box), false, "object");
type_cls = static_cast<BoxedClass*>(PyObject_MALLOC(sizeof(BoxedClass))); type_cls = static_cast<BoxedClass*>(PyObject_MALLOC(sizeof(BoxedClass)));
PyObject_INIT(object_cls, type_cls);
PyObject_INIT(type_cls, type_cls); PyObject_INIT(type_cls, type_cls);
::new (object_cls) BoxedClass(NULL, 0, 0, sizeof(Box), false, "object");
::new (type_cls) BoxedClass(object_cls, offsetof(BoxedClass, attrs), ::new (type_cls) BoxedClass(object_cls, offsetof(BoxedClass, attrs),
offsetof(BoxedClass, tp_weaklist), sizeof(BoxedHeapClass), false, "type"); offsetof(BoxedClass, tp_weaklist), sizeof(BoxedHeapClass), false, "type");
...@@ -3437,8 +3435,7 @@ void setupRuntime() { ...@@ -3437,8 +3435,7 @@ void setupRuntime() {
type_cls->tp_flags |= Py_TPFLAGS_TYPE_SUBCLASS; type_cls->tp_flags |= Py_TPFLAGS_TYPE_SUBCLASS;
type_cls->tp_itemsize = sizeof(BoxedHeapClass::SlotOffset); type_cls->tp_itemsize = sizeof(BoxedHeapClass::SlotOffset);
type_cls->tp_dealloc = BoxedClass::dealloc; type_cls->tp_dealloc = BoxedClass::dealloc;
PyObject_Init(object_cls, type_cls);
PyObject_Init(type_cls, type_cls);
// XXX silly that we have to set this again // XXX silly that we have to set this again
new (&object_cls->attrs) HCAttrs(HiddenClass::makeSingleton()); new (&object_cls->attrs) HCAttrs(HiddenClass::makeSingleton());
new (&type_cls->attrs) HCAttrs(HiddenClass::makeSingleton()); new (&type_cls->attrs) HCAttrs(HiddenClass::makeSingleton());
...@@ -3923,7 +3920,7 @@ void setupRuntime() { ...@@ -3923,7 +3920,7 @@ void setupRuntime() {
setupBuiltins(); setupBuiltins();
_PyExc_Init(); _PyExc_Init();
setupThread(); setupThread();
setupGC(); initgc();
setupImport(); setupImport();
setupPyston(); setupPyston();
setupAST(); setupAST();
......
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