blueloveTH před 3 roky
rodič
revize
5dfd7b5fc9
7 změnil soubory, kde provedl 33 přidání a 17 odebrání
  1. 16 8
      plugins/flutter/src/pocketpy.h
  2. 1 1
      plugins/godot/godot-cpp
  3. 1 1
      src/__stl__.h
  4. 6 0
      src/codeobject.h
  5. 2 2
      src/safestl.h
  6. 7 5
      src/vm.h
  7. 0 0
      tests/_json2.py

+ 16 - 8
plugins/flutter/src/pocketpy.h

@@ -37,7 +37,7 @@
 #define UNREACHABLE() throw std::runtime_error( __FILE__ + std::string(":") + std::to_string(__LINE__) + " UNREACHABLE()!");
 #define UNREACHABLE() throw std::runtime_error( __FILE__ + std::string(":") + std::to_string(__LINE__) + " UNREACHABLE()!");
 #endif
 #endif
 
 
-#define PK_VERSION "0.5.0"
+#define PK_VERSION "0.5.1"
 
 
 //#define PKPY_NO_TYPE_CHECK
 //#define PKPY_NO_TYPE_CHECK
 //#define PKPY_NO_INDEX_CHECK
 //#define PKPY_NO_INDEX_CHECK
@@ -2235,7 +2235,7 @@ namespace pkpy {
 #endif
 #endif
         }
         }
 
 
-        void __tryAlloc(uint8_t n){
+        void __tryAlloc(size_t n){
             if(n > 255) UNREACHABLE();
             if(n > 255) UNREACHABLE();
             if(n >= MAX_POOLING_N || _poolArgList[n].empty()){
             if(n >= MAX_POOLING_N || _poolArgList[n].empty()){
                 this->_size = n;
                 this->_size = n;
@@ -2258,7 +2258,7 @@ namespace pkpy {
         }
         }
 
 
     public:
     public:
-        ArgList(uint8_t n){
+        ArgList(size_t n){
             if(n != 0) __tryAlloc(n);
             if(n != 0) __tryAlloc(n);
         }
         }
 
 
@@ -3887,6 +3887,12 @@ public:
         return v;
         return v;
     }
     }
 
 
+    PyVarList popNValuesReversedUnlimited(VM* vm, int n){
+        PyVarList v(n);
+        for(int i=n-1; i>=0; i--) v[i] = popValue(vm);
+        return v;
+    }
+
     pkpy::ArgList __popNReversed(int n){
     pkpy::ArgList __popNReversed(int n){
         pkpy::ArgList v(n);
         pkpy::ArgList v(n);
         for(int i=n-1; i>=0; i--) v._index(i) = __pop();
         for(int i=n-1; i>=0; i--) v._index(i) = __pop();
@@ -4128,12 +4134,13 @@ protected:
                 } break;
                 } break;
             case OP_BUILD_LIST:
             case OP_BUILD_LIST:
                 {
                 {
-                    pkpy::ArgList items = frame->popNValuesReversed(this, byte.arg);
-                    frame->push(PyList(items.toList()));
+                    frame->push(PyList(
+                        frame->popNValuesReversedUnlimited(this, byte.arg)
+                    ));
                 } break;
                 } break;
             case OP_BUILD_MAP:
             case OP_BUILD_MAP:
                 {
                 {
-                    pkpy::ArgList items = frame->popNValuesReversed(this, byte.arg*2);
+                    PyVarList items = frame->popNValuesReversedUnlimited(this, byte.arg*2);
                     PyVar obj = call(builtins->attribs["dict"]);
                     PyVar obj = call(builtins->attribs["dict"]);
                     for(int i=0; i<items.size(); i+=2){
                     for(int i=0; i<items.size(); i+=2){
                         call(obj, __setitem__, pkpy::twoArgs(items[i], items[i+1]));
                         call(obj, __setitem__, pkpy::twoArgs(items[i], items[i+1]));
@@ -4142,8 +4149,9 @@ protected:
                 } break;
                 } break;
             case OP_BUILD_SET:
             case OP_BUILD_SET:
                 {
                 {
-                    pkpy::ArgList items = frame->popNValuesReversed(this, byte.arg);
-                    PyVar list = PyList(items.toList());
+                    PyVar list = PyList(
+                        frame->popNValuesReversedUnlimited(this, byte.arg)
+                    );
                     PyVar obj = call(builtins->attribs["set"], pkpy::oneArg(list));
                     PyVar obj = call(builtins->attribs["set"], pkpy::oneArg(list));
                     frame->push(obj);
                     frame->push(obj);
                 } break;
                 } break;

+ 1 - 1
plugins/godot/godot-cpp

@@ -1 +1 @@
-Subproject commit 28b2550f587a924f352937579873bfb4909596ca
+Subproject commit 8d72bddf3e80119e0f095aea14cf669024a8bee0

+ 1 - 1
src/__stl__.h

@@ -30,7 +30,7 @@
 #define UNREACHABLE() throw std::runtime_error( __FILE__ + std::string(":") + std::to_string(__LINE__) + " UNREACHABLE()!");
 #define UNREACHABLE() throw std::runtime_error( __FILE__ + std::string(":") + std::to_string(__LINE__) + " UNREACHABLE()!");
 #endif
 #endif
 
 
-#define PK_VERSION "0.5.0"
+#define PK_VERSION "0.5.1"
 
 
 //#define PKPY_NO_TYPE_CHECK
 //#define PKPY_NO_TYPE_CHECK
 //#define PKPY_NO_INDEX_CHECK
 //#define PKPY_NO_INDEX_CHECK

+ 6 - 0
src/codeobject.h

@@ -232,6 +232,12 @@ public:
         return v;
         return v;
     }
     }
 
 
+    PyVarList popNValuesReversedUnlimited(VM* vm, int n){
+        PyVarList v(n);
+        for(int i=n-1; i>=0; i--) v[i] = popValue(vm);
+        return v;
+    }
+
     pkpy::ArgList __popNReversed(int n){
     pkpy::ArgList __popNReversed(int n){
         pkpy::ArgList v(n);
         pkpy::ArgList v(n);
         for(int i=n-1; i>=0; i--) v._index(i) = __pop();
         for(int i=n-1; i>=0; i--) v._index(i) = __pop();

+ 2 - 2
src/safestl.h

@@ -79,7 +79,7 @@ namespace pkpy {
 #endif
 #endif
         }
         }
 
 
-        void __tryAlloc(uint8_t n){
+        void __tryAlloc(size_t n){
             if(n > 255) UNREACHABLE();
             if(n > 255) UNREACHABLE();
             if(n >= MAX_POOLING_N || _poolArgList[n].empty()){
             if(n >= MAX_POOLING_N || _poolArgList[n].empty()){
                 this->_size = n;
                 this->_size = n;
@@ -102,7 +102,7 @@ namespace pkpy {
         }
         }
 
 
     public:
     public:
-        ArgList(uint8_t n){
+        ArgList(size_t n){
             if(n != 0) __tryAlloc(n);
             if(n != 0) __tryAlloc(n);
         }
         }
 
 

+ 7 - 5
src/vm.h

@@ -237,12 +237,13 @@ protected:
                 } break;
                 } break;
             case OP_BUILD_LIST:
             case OP_BUILD_LIST:
                 {
                 {
-                    pkpy::ArgList items = frame->popNValuesReversed(this, byte.arg);
-                    frame->push(PyList(items.toList()));
+                    frame->push(PyList(
+                        frame->popNValuesReversedUnlimited(this, byte.arg)
+                    ));
                 } break;
                 } break;
             case OP_BUILD_MAP:
             case OP_BUILD_MAP:
                 {
                 {
-                    pkpy::ArgList items = frame->popNValuesReversed(this, byte.arg*2);
+                    PyVarList items = frame->popNValuesReversedUnlimited(this, byte.arg*2);
                     PyVar obj = call(builtins->attribs["dict"]);
                     PyVar obj = call(builtins->attribs["dict"]);
                     for(int i=0; i<items.size(); i+=2){
                     for(int i=0; i<items.size(); i+=2){
                         call(obj, __setitem__, pkpy::twoArgs(items[i], items[i+1]));
                         call(obj, __setitem__, pkpy::twoArgs(items[i], items[i+1]));
@@ -251,8 +252,9 @@ protected:
                 } break;
                 } break;
             case OP_BUILD_SET:
             case OP_BUILD_SET:
                 {
                 {
-                    pkpy::ArgList items = frame->popNValuesReversed(this, byte.arg);
-                    PyVar list = PyList(items.toList());
+                    PyVar list = PyList(
+                        frame->popNValuesReversedUnlimited(this, byte.arg)
+                    );
                     PyVar obj = call(builtins->attribs["set"], pkpy::oneArg(list));
                     PyVar obj = call(builtins->attribs["set"], pkpy::oneArg(list));
                     frame->push(obj);
                     frame->push(obj);
                 } break;
                 } break;

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
tests/_json2.py


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů