Commit e432e29c authored by Marius Wachtler's avatar Marius Wachtler

use DEFAULT_CLASS_SIMPLE in more cases

parent b4ece352
...@@ -37,7 +37,7 @@ public: ...@@ -37,7 +37,7 @@ public:
Py_XINCREF(module); Py_XINCREF(module);
} }
DEFAULT_CLASS(capifunc_cls); DEFAULT_CLASS_SIMPLE(capifunc_cls, true);
PyCFunction getFunction() { return method_def->ml_meth; } PyCFunction getFunction() { return method_def->ml_meth; }
......
...@@ -1318,7 +1318,7 @@ public: ...@@ -1318,7 +1318,7 @@ public:
Py_XINCREF(idx_long); Py_XINCREF(idx_long);
} }
DEFAULT_CLASS(enumerate_cls); DEFAULT_CLASS_SIMPLE(enumerate_cls, true);
static Box* new_(Box* cls, Box* obj, Box* start) { static Box* new_(Box* cls, Box* obj, Box* start) {
RELEASE_ASSERT(cls == enumerate_cls, ""); RELEASE_ASSERT(cls == enumerate_cls, "");
......
...@@ -126,7 +126,7 @@ private: ...@@ -126,7 +126,7 @@ private:
public: public:
BoxedThreadLock() { lock_lock = PyThread_allocate_lock(); } BoxedThreadLock() { lock_lock = PyThread_allocate_lock(); }
DEFAULT_CLASS(thread_lock_cls); DEFAULT_CLASS_SIMPLE(thread_lock_cls, false);
static Box* acquire(Box* _self, Box* _waitflag) { static Box* acquire(Box* _self, Box* _waitflag) {
RELEASE_ASSERT(_self->cls == thread_lock_cls, ""); RELEASE_ASSERT(_self->cls == thread_lock_cls, "");
......
...@@ -163,7 +163,7 @@ public: ...@@ -163,7 +163,7 @@ public:
assert(hasExited()); assert(hasExited());
} }
DEFAULT_CLASS(frame_cls); DEFAULT_CLASS_SIMPLE(frame_cls, true);
static BORROWED(Box*) boxFrame(FrameInfo* fi) { static BORROWED(Box*) boxFrame(FrameInfo* fi) {
if (fi->frame_obj == NULL) if (fi->frame_obj == NULL)
......
...@@ -434,7 +434,8 @@ extern "C" BoxedGenerator* createGenerator(BoxedFunctionBase* function, Box* arg ...@@ -434,7 +434,8 @@ extern "C" BoxedGenerator* createGenerator(BoxedFunctionBase* function, Box* arg
static uint64_t* generator_timer_counter = Stats::getStatCounter("us_timer_generator_toplevel"); static uint64_t* generator_timer_counter = Stats::getStatCounter("us_timer_generator_toplevel");
#endif #endif
extern "C" BoxedGenerator::BoxedGenerator(BoxedFunctionBase* function, Box* arg1, Box* arg2, Box* arg3, Box** args) extern "C" BoxedGenerator::BoxedGenerator(BoxedFunctionBase* function, Box* arg1, Box* arg2, Box* arg3, Box** args)
: function(function), : weakreflist(NULL),
function(function),
arg1(arg1), arg1(arg1),
arg2(arg2), arg2(arg2),
arg3(arg3), arg3(arg3),
...@@ -442,6 +443,7 @@ extern "C" BoxedGenerator::BoxedGenerator(BoxedFunctionBase* function, Box* arg1 ...@@ -442,6 +443,7 @@ extern "C" BoxedGenerator::BoxedGenerator(BoxedFunctionBase* function, Box* arg1
entryExited(false), entryExited(false),
running(false), running(false),
returnValue(nullptr), returnValue(nullptr),
iterated_from__hasnext__(false),
exception(nullptr, nullptr, nullptr), exception(nullptr, nullptr, nullptr),
context(nullptr), context(nullptr),
returnContext(nullptr), returnContext(nullptr),
......
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
friend class BoxedXrangeIterator; friend class BoxedXrangeIterator;
DEFAULT_CLASS(xrange_cls); DEFAULT_CLASS_SIMPLE(xrange_cls, false);
}; };
class BoxedXrangeIterator : public Box { class BoxedXrangeIterator : public Box {
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
cur = start; cur = start;
} }
DEFAULT_CLASS(xrange_iterator_cls); DEFAULT_CLASS_SIMPLE(xrange_iterator_cls, true);
static llvm_compat_bool xrangeIteratorHasnextUnboxed(Box* s) __attribute__((visibility("default"))) { static llvm_compat_bool xrangeIteratorHasnextUnboxed(Box* s) __attribute__((visibility("default"))) {
assert(s->cls == xrange_iterator_cls); assert(s->cls == xrange_iterator_cls);
......
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
BoxedIterWrapper(Box* iter) : iter(iter), next(NULL) { Py_INCREF(iter); } BoxedIterWrapper(Box* iter) : iter(iter), next(NULL) { Py_INCREF(iter); }
DEFAULT_CLASS(iterwrapper_cls); DEFAULT_CLASS_SIMPLE(iterwrapper_cls, true);
static void dealloc(BoxedIterWrapper* o) noexcept { static void dealloc(BoxedIterWrapper* o) noexcept {
PyObject_GC_UnTrack(o); PyObject_GC_UnTrack(o);
......
...@@ -61,7 +61,7 @@ public: ...@@ -61,7 +61,7 @@ public:
BoxedSetIterator(BoxedSet* s) : s(s), it(s->s.begin()), size(s->s.size()) { Py_INCREF(s); } BoxedSetIterator(BoxedSet* s) : s(s), it(s->s.begin()), size(s->s.size()) { Py_INCREF(s); }
DEFAULT_CLASS(set_iterator_cls); DEFAULT_CLASS_SIMPLE(set_iterator_cls, true);
bool hasNext() { return it != s->s.end(); } bool hasNext() { return it != s->s.end(); }
......
...@@ -31,11 +31,11 @@ public: ...@@ -31,11 +31,11 @@ public:
Set s; Set s;
Box** weakreflist; /* List of weak references */ Box** weakreflist; /* List of weak references */
BoxedSet() __attribute__((visibility("default"))) {} BoxedSet() __attribute__((visibility("default"))) : weakreflist(NULL) {}
template <typename T> __attribute__((visibility("default"))) BoxedSet(T&& s) : s(std::forward<T>(s)) {} template <typename T> __attribute__((visibility("default"))) BoxedSet(T&& s) : s(std::forward<T>(s)) {}
DEFAULT_CLASS(set_cls); DEFAULT_CLASS_SIMPLE(set_cls, true);
static void dealloc(Box* b) noexcept; static void dealloc(Box* b) noexcept;
static int traverse(Box* self, visitproc visit, void* arg) noexcept; static int traverse(Box* self, visitproc visit, void* arg) noexcept;
......
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
Py_INCREF(obj_type); Py_INCREF(obj_type);
} }
DEFAULT_CLASS(super_cls); DEFAULT_CLASS_SIMPLE(super_cls, true);
static void dealloc(Box* b) noexcept { static void dealloc(Box* b) noexcept {
BoxedSuper* self = (BoxedSuper*)b; BoxedSuper* self = (BoxedSuper*)b;
......
...@@ -27,7 +27,7 @@ public: ...@@ -27,7 +27,7 @@ public:
int pos; int pos;
BoxedTupleIterator(BoxedTuple* t); BoxedTupleIterator(BoxedTuple* t);
DEFAULT_CLASS(tuple_iterator_cls); DEFAULT_CLASS_SIMPLE(tuple_iterator_cls, true);
static void dealloc(BoxedTupleIterator* o) noexcept { static void dealloc(BoxedTupleIterator* o) noexcept {
PyObject_GC_UnTrack(o); PyObject_GC_UnTrack(o);
......
...@@ -2265,14 +2265,13 @@ private: ...@@ -2265,14 +2265,13 @@ private:
public: public:
AttrWrapperIter(AttrWrapper* aw); AttrWrapperIter(AttrWrapper* aw);
DEFAULT_CLASS(attrwrapperiter_cls); DEFAULT_CLASS_SIMPLE(attrwrapperiter_cls, false);
static Box* hasnext(Box* _self); static Box* hasnext(Box* _self);
static Box* next(Box* _self); static Box* next(Box* _self);
static Box* next_capi(Box* _self) noexcept; static Box* next_capi(Box* _self) noexcept;
static void dealloc(Box* b) noexcept; static void dealloc(Box* b) noexcept;
static int traverse(Box* self, visitproc visit, void* arg) noexcept;
}; };
// A dictionary-like wrapper around the attributes array. // A dictionary-like wrapper around the attributes array.
......
...@@ -1116,7 +1116,7 @@ public: ...@@ -1116,7 +1116,7 @@ public:
BoxedBuiltinFunctionOrMethod(FunctionMetadata* f, const char* name, std::initializer_list<Box*> defaults, BoxedBuiltinFunctionOrMethod(FunctionMetadata* f, const char* name, std::initializer_list<Box*> defaults,
BoxedClosure* closure = NULL, const char* doc = NULL); BoxedClosure* closure = NULL, const char* doc = NULL);
DEFAULT_CLASS(builtin_function_or_method_cls); DEFAULT_CLASS_SIMPLE(builtin_function_or_method_cls, true);
}; };
extern "C" void _PyModule_Clear(PyObject*) noexcept; extern "C" void _PyModule_Clear(PyObject*) noexcept;
...@@ -1268,7 +1268,7 @@ public: ...@@ -1268,7 +1268,7 @@ public:
void* stack_begin; void* stack_begin;
FrameInfo* top_caller_frame_info; // The FrameInfo that called into this generator. FrameInfo* top_caller_frame_info; // The FrameInfo that called into this generator.
// For abandoned-generator collection -- WIP // For abandoned-generator collection
FrameInfo* paused_frame_info; // The FrameInfo the generator was on when it called yield (or NULL if the generator FrameInfo* paused_frame_info; // The FrameInfo the generator was on when it called yield (or NULL if the generator
// hasn't started or has exited). // hasn't started or has exited).
...@@ -1281,7 +1281,7 @@ public: ...@@ -1281,7 +1281,7 @@ public:
BoxedGenerator(BoxedFunctionBase* function, Box* arg1, Box* arg2, Box* arg3, Box** args); BoxedGenerator(BoxedFunctionBase* function, Box* arg1, Box* arg2, Box* arg3, Box** args);
DEFAULT_CLASS(generator_cls); DEFAULT_CLASS_SIMPLE(generator_cls, true);
}; };
Box* objectSetattr(Box* obj, Box* attr, Box* value); Box* objectSetattr(Box* obj, Box* attr, Box* value);
......
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