summaryrefslogtreecommitdiff
path: root/py/vm.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-24 11:06:10 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-24 11:06:10 +0100
commit1cbb99d1db2d2d712b6f37a67ed15a20b7d3baae (patch)
tree32b9e3ab5cda409523f0b9ffdbfd0b8ddb7dc760 /py/vm.c
parent1c1d902cd395f1b521e4fe1e11f8f26f50eafc3f (diff)
parentc5e32c69952222b12e65655474c5f4c4481ea9f7 (diff)
Merge pull request #518 from pfalcon/vm-trace
vm: Add rudimentary bytecode execution tracing capability.
Diffstat (limited to 'py/vm.c')
-rw-r--r--py/vm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/py/vm.c b/py/vm.c
index b1c1719b7..8a0bc7dbe 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -14,6 +14,11 @@
#include "objgenerator.h"
#define DETECT_VM_STACK_OVERFLOW (0)
+#if 0
+#define TRACE(ip) mp_byte_code_print2(ip, 1);
+#else
+#define TRACE(ip)
+#endif
// 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
@@ -168,6 +173,7 @@ mp_vm_return_kind_t mp_execute_byte_code_2(const byte *code_info, const byte **i
#if MICROPY_USE_COMPUTED_GOTO
#include "vmentrytable.h"
#define DISPATCH() do { \
+ TRACE(ip); \
save_ip = ip; \
op = *ip++; \
goto *entry_table[op]; \
@@ -223,6 +229,7 @@ dispatch_loop:
#if MICROPY_USE_COMPUTED_GOTO
DISPATCH();
#else
+ TRACE(ip);
save_ip = ip;
op = *ip++;