|
|
@@ -55,12 +55,7 @@ struct ValueStack {
|
|
|
bool empty() const { return _sp == _begin; }
|
|
|
PyObject** begin() { return _begin; }
|
|
|
PyObject** end() { return _sp; }
|
|
|
- void reset(PyObject** sp) {
|
|
|
-#if PK_DEBUG_EXTRA_CHECK
|
|
|
- if(sp < _begin || sp > _begin + MAX_SIZE) PK_FATAL_ERROR();
|
|
|
-#endif
|
|
|
- _sp = sp;
|
|
|
- }
|
|
|
+ void reset(PyObject** sp) { _sp = sp; }
|
|
|
void clear() { _sp = _begin; }
|
|
|
bool is_overflow() const { return _sp >= _max_end; }
|
|
|
|
|
|
@@ -101,9 +96,7 @@ struct Frame {
|
|
|
|
|
|
int next_bytecode() {
|
|
|
_ip = _next_ip++;
|
|
|
-#if PK_DEBUG_EXTRA_CHECK
|
|
|
- if(_ip >= co->codes.size()) PK_FATAL_ERROR();
|
|
|
-#endif
|
|
|
+ PK_DEBUG_ASSERT(_ip >= 0 && _ip < co->codes.size());
|
|
|
return _ip;
|
|
|
}
|
|
|
|
|
|
@@ -152,16 +145,17 @@ struct CallStack{
|
|
|
}
|
|
|
|
|
|
void pop(){
|
|
|
-#if PK_DEBUG_EXTRA_CHECK
|
|
|
- if(empty()) PK_FATAL_ERROR();
|
|
|
-#endif
|
|
|
+ PK_DEBUG_ASSERT(!empty())
|
|
|
LinkedFrame* p = _tail;
|
|
|
_tail = p->f_back;
|
|
|
pool64_dealloc(p);
|
|
|
--_size;
|
|
|
}
|
|
|
|
|
|
- Frame& top() const { return _tail->frame; }
|
|
|
+ Frame& top() const {
|
|
|
+ PK_DEBUG_ASSERT(!empty())
|
|
|
+ return _tail->frame;
|
|
|
+ }
|
|
|
|
|
|
template<typename Func>
|
|
|
void apply(Func&& f){
|