summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--py/vm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/py/vm.c b/py/vm.c
index cf6f6e427b..f61fe48c52 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -13,6 +13,13 @@
#include "bc0.h"
#include "bc.h"
+// Value stack grows up (this makes it incompatible with native C stack, but
+// makes sure that arguments to functions are in natural order arg1..argN
+// (Python semantics mandates left-to-right evaluation order, including for
+// function arguments). Stack pointer is pre-incremented and points at the
+// top element.
+// Exception stack also grows up, top element is also pointed at.
+
// Exception stack entry
typedef struct _mp_exc_stack {
const byte *handler;
@@ -23,9 +30,6 @@ typedef struct _mp_exc_stack {
byte opcode;
} mp_exc_stack;
-// (value) stack grows down (to be compatible with native code when passing pointers to the stack), top element is pointed to
-// exception stack grows up, top element is pointed to
-
#define DECODE_UINT do { unum = *ip++; if (unum > 127) { unum = ((unum & 0x3f) << 8) | (*ip++); } } while (0)
#define DECODE_ULABEL do { unum = (ip[0] | (ip[1] << 8)); ip += 2; } while (0)
#define DECODE_SLABEL do { unum = (ip[0] | (ip[1] << 8)) - 0x8000; ip += 2; } while (0)