blueloveTH 2 ani în urmă
părinte
comite
37db7bc29b
6 a modificat fișierele cu 9 adăugiri și 6 ștergeri
  1. 5 2
      src/ceval.h
  2. 1 0
      src/common.h
  3. 1 2
      src/expr.h
  4. 1 1
      src/frame.h
  5. 1 1
      src/vm.h
  6. 0 0
      tests/80_json_alt.py

+ 5 - 2
src/ceval.h

@@ -63,6 +63,9 @@ goto *OP_LABELS[byte.op];
 __NEXT_STEP:;
 #if DEBUG_CEVAL_STEP
     std::cout << frame->stack_info() << " " << OP_NAMES[byte.op] << std::endl;
+#endif
+#if DEBUG_CEVAL_STEP_MIN
+    std::cout << OP_NAMES[byte.op] << std::endl;
 #endif
     switch (byte.op)
     {
@@ -213,14 +216,14 @@ __NEXT_STEP:;
     } DISPATCH();
     TARGET(BUILD_DICT) {
         PyObject* t = VAR(STACK_VIEW(byte.arg).to_tuple());
-        STACK_SHRINK(byte.arg);
         PyObject* obj = call(builtins->attr(m_dict), Args{t});
+        STACK_SHRINK(byte.arg);
         PUSH(obj);
     } DISPATCH();
     TARGET(BUILD_SET) {
         PyObject* t = VAR(STACK_VIEW(byte.arg).to_tuple());
-        STACK_SHRINK(byte.arg);
         PyObject* obj = call(builtins->attr(m_set), Args{t});
+        STACK_SHRINK(byte.arg);
         PUSH(obj);
     } DISPATCH();
     TARGET(BUILD_SLICE) {

+ 1 - 0
src/common.h

@@ -36,6 +36,7 @@
 #define DEBUG_EXTRA_CHECK			0
 #define DEBUG_DIS_EXEC				0
 #define DEBUG_CEVAL_STEP			0
+#define DEBUG_CEVAL_STEP_MIN		0
 #define DEBUG_FULL_EXCEPTION		0
 #define DEBUG_MEMORY_POOL			0
 #define DEBUG_NO_MEMORY_POOL		0

+ 1 - 2
src/expr.h

@@ -619,8 +619,7 @@ struct CallExpr: Expr{
 
     void emit(CodeEmitContext* ctx) override {
         VM* vm = ctx->vm;
-        // TODO: if callable is a AttrExpr, we should try to use `fast_call`
-        // instead of use `boundmethod` proxy
+        // if callable is a AttrExpr, we should try to use `fast_call` instead of use `boundmethod` proxy
         if(callable->is_attrib()){
             auto p = static_cast<AttribExpr*>(callable.get());
             p->emit_method(ctx);

+ 1 - 1
src/frame.h

@@ -254,7 +254,7 @@ struct Frame {
 
     void _gc_mark() const {
         // do return if this frame has been moved
-        if(!_locals.is_valid()) return;
+        if(_s.data() == nullptr) return;
         for(PyObject* obj: _s) OBJ_MARK(obj);
         OBJ_MARK(_module);
         _locals._gc_mark();

+ 1 - 1
src/vm.h

@@ -752,7 +752,7 @@ inline PyObject* VM::call(PyObject* callable, Args args, const Args& kwargs, boo
     }
 
     if(is_type(callable, tp_type)){
-        // TODO: use get_unbound_method here
+        // TODO: derived __new__ ?
         PyObject* new_f = callable->attr().try_get(__new__);
         PyObject* obj;
         if(new_f != nullptr){

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
tests/80_json_alt.py


Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff