Skip to content

Commit 8519342

Browse files
committed
Update VM stacks comments.
1 parent c7a0b14 commit 8519342

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

py/vm.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
#include "bc0.h"
1414
#include "bc.h"
1515

16+
// Value stack grows up (this makes it incompatible with native C stack, but
17+
// makes sure that arguments to functions are in natural order arg1..argN
18+
// (Python semantics mandates left-to-right evaluation order, including for
19+
// function arguments). Stack pointer is pre-incremented and points at the
20+
// top element.
21+
// Exception stack also grows up, top element is also pointed at.
22+
1623
// Exception stack entry
1724
typedef struct _mp_exc_stack {
1825
const byte *handler;
@@ -23,9 +30,6 @@ typedef struct _mp_exc_stack {
2330
byte opcode;
2431
} mp_exc_stack;
2532

26-
// (value) stack grows down (to be compatible with native code when passing pointers to the stack), top element is pointed to
27-
// exception stack grows up, top element is pointed to
28-
2933
#define DECODE_UINT do { unum = *ip++; if (unum > 127) { unum = ((unum & 0x3f) << 8) | (*ip++); } } while (0)
3034
#define DECODE_ULABEL do { unum = (ip[0] | (ip[1] << 8)); ip += 2; } while (0)
3135
#define DECODE_SLABEL do { unum = (ip[0] | (ip[1] << 8)) - 0x8000; ip += 2; } while (0)

0 commit comments

Comments
 (0)