diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-01-31 19:45:15 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-01-31 19:48:53 +0200 |
commit | 8519342c1a542c44ae98c49bb1eb02d50178bcaa (patch) | |
tree | 304a338a7db98cd4299ffe146ae809ad77409ad7 | |
parent | c7a0b14df9278754e033368e486b548eaca86e8e (diff) | |
download | micropython-8519342c1a542c44ae98c49bb1eb02d50178bcaa.tar.gz micropython-8519342c1a542c44ae98c49bb1eb02d50178bcaa.zip |
Update VM stacks comments.
-rw-r--r-- | py/vm.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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) |