Numworks Epsilon  1.4.1
Graphing Calculator Operating System
showbc.c
Go to the documentation of this file.
1 /*
2  * This file is part of the MicroPython project, http://micropython.org/
3  *
4  * The MIT License (MIT)
5  *
6  * Copyright (c) 2013, 2014 Damien P. George
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  */
26 
27 #include <stdio.h>
28 #include <assert.h>
29 
30 #include "py/bc0.h"
31 #include "py/bc.h"
32 
33 #if MICROPY_DEBUG_PRINTERS
34 
35 // redirect all printfs in this file to the platform print stream
36 #define printf(...) mp_printf(&mp_plat_print, __VA_ARGS__)
37 
38 #define DECODE_UINT { \
39  unum = 0; \
40  do { \
41  unum = (unum << 7) + (*ip & 0x7f); \
42  } while ((*ip++ & 0x80) != 0); \
43 }
44 #define DECODE_ULABEL do { unum = (ip[0] | (ip[1] << 8)); ip += 2; } while (0)
45 #define DECODE_SLABEL do { unum = (ip[0] | (ip[1] << 8)) - 0x8000; ip += 2; } while (0)
46 
47 #if MICROPY_PERSISTENT_CODE
48 
49 #define DECODE_QSTR \
50  qst = ip[0] | ip[1] << 8; \
51  ip += 2;
52 #define DECODE_PTR \
53  DECODE_UINT; \
54  unum = mp_showbc_const_table[unum]
55 #define DECODE_OBJ \
56  DECODE_UINT; \
57  unum = mp_showbc_const_table[unum]
58 
59 #else
60 
61 #define DECODE_QSTR { \
62  qst = 0; \
63  do { \
64  qst = (qst << 7) + (*ip & 0x7f); \
65  } while ((*ip++ & 0x80) != 0); \
66 }
67 #define DECODE_PTR do { \
68  ip = (byte*)MP_ALIGN(ip, sizeof(void*)); \
69  unum = (uintptr_t)*(void**)ip; \
70  ip += sizeof(void*); \
71 } while (0)
72 #define DECODE_OBJ do { \
73  ip = (byte*)MP_ALIGN(ip, sizeof(mp_obj_t)); \
74  unum = (mp_uint_t)*(mp_obj_t*)ip; \
75  ip += sizeof(mp_obj_t); \
76 } while (0)
77 
78 #endif
79 
80 const byte *mp_showbc_code_start;
81 const mp_uint_t *mp_showbc_const_table;
82 
83 void mp_bytecode_print(const void *descr, const byte *ip, mp_uint_t len, const mp_uint_t *const_table) {
84  mp_showbc_code_start = ip;
85 
86  // get bytecode parameters
87  mp_uint_t n_state = mp_decode_uint(&ip);
88  mp_uint_t n_exc_stack = mp_decode_uint(&ip);
89  /*mp_uint_t scope_flags =*/ ip++;
90  mp_uint_t n_pos_args = *ip++;
91  mp_uint_t n_kwonly_args = *ip++;
92  /*mp_uint_t n_def_pos_args =*/ ip++;
93 
94  const byte *code_info = ip;
95  mp_uint_t code_info_size = mp_decode_uint(&code_info);
96  ip += code_info_size;
97 
98  #if MICROPY_PERSISTENT_CODE
99  qstr block_name = code_info[0] | (code_info[1] << 8);
100  qstr source_file = code_info[2] | (code_info[3] << 8);
101  code_info += 4;
102  #else
103  qstr block_name = mp_decode_uint(&code_info);
104  qstr source_file = mp_decode_uint(&code_info);
105  #endif
106  printf("File %s, code block '%s' (descriptor: %p, bytecode @%p " UINT_FMT " bytes)\n",
107  qstr_str(source_file), qstr_str(block_name), descr, mp_showbc_code_start, len);
108 
109  // raw bytecode dump
110  printf("Raw bytecode (code_info_size=" UINT_FMT ", bytecode_size=" UINT_FMT "):\n", code_info_size, len - code_info_size);
111  for (mp_uint_t i = 0; i < len; i++) {
112  if (i > 0 && i % 16 == 0) {
113  printf("\n");
114  }
115  printf(" %02x", mp_showbc_code_start[i]);
116  }
117  printf("\n");
118 
119  // bytecode prelude: arg names (as qstr objects)
120  printf("arg names:");
121  for (mp_uint_t i = 0; i < n_pos_args + n_kwonly_args; i++) {
122  printf(" %s", qstr_str(MP_OBJ_QSTR_VALUE(const_table[i])));
123  }
124  printf("\n");
125 
126  printf("(N_STATE " UINT_FMT ")\n", n_state);
127  printf("(N_EXC_STACK " UINT_FMT ")\n", n_exc_stack);
128 
129  // for printing line number info
130  const byte *bytecode_start = ip;
131 
132  // bytecode prelude: initialise closed over variables
133  {
134  uint local_num;
135  while ((local_num = *ip++) != 255) {
136  printf("(INIT_CELL %u)\n", local_num);
137  }
138  len -= ip - mp_showbc_code_start;
139  }
140 
141  // print out line number info
142  {
143  mp_int_t bc = bytecode_start - ip;
144  mp_uint_t source_line = 1;
145  printf(" bc=" INT_FMT " line=" UINT_FMT "\n", bc, source_line);
146  for (const byte* ci = code_info; *ci;) {
147  if ((ci[0] & 0x80) == 0) {
148  // 0b0LLBBBBB encoding
149  bc += ci[0] & 0x1f;
150  source_line += ci[0] >> 5;
151  ci += 1;
152  } else {
153  // 0b1LLLBBBB 0bLLLLLLLL encoding (l's LSB in second byte)
154  bc += ci[0] & 0xf;
155  source_line += ((ci[0] << 4) & 0x700) | ci[1];
156  ci += 2;
157  }
158  printf(" bc=" INT_FMT " line=" UINT_FMT "\n", bc, source_line);
159  }
160  }
161  mp_bytecode_print2(ip, len - 0, const_table);
162 }
163 
164 const byte *mp_bytecode_print_str(const byte *ip) {
165  mp_uint_t unum;
166  qstr qst;
167 
168  switch (*ip++) {
170  printf("LOAD_CONST_FALSE");
171  break;
172 
174  printf("LOAD_CONST_NONE");
175  break;
176 
178  printf("LOAD_CONST_TRUE");
179  break;
180 
182  mp_int_t num = 0;
183  if ((ip[0] & 0x40) != 0) {
184  // Number is negative
185  num--;
186  }
187  do {
188  num = (num << 7) | (*ip & 0x7f);
189  } while ((*ip++ & 0x80) != 0);
190  printf("LOAD_CONST_SMALL_INT " INT_FMT, num);
191  break;
192  }
193 
195  DECODE_QSTR;
196  printf("LOAD_CONST_STRING '%s'", qstr_str(qst));
197  break;
198 
200  DECODE_OBJ;
201  printf("LOAD_CONST_OBJ %p=", MP_OBJ_TO_PTR(unum));
203  break;
204 
205  case MP_BC_LOAD_NULL:
206  printf("LOAD_NULL");
207  break;
208 
209  case MP_BC_LOAD_FAST_N:
210  DECODE_UINT;
211  printf("LOAD_FAST_N " UINT_FMT, unum);
212  break;
213 
214  case MP_BC_LOAD_DEREF:
215  DECODE_UINT;
216  printf("LOAD_DEREF " UINT_FMT, unum);
217  break;
218 
219  case MP_BC_LOAD_NAME:
220  DECODE_QSTR;
221  printf("LOAD_NAME %s", qstr_str(qst));
223  printf(" (cache=%u)", *ip++);
224  }
225  break;
226 
227  case MP_BC_LOAD_GLOBAL:
228  DECODE_QSTR;
229  printf("LOAD_GLOBAL %s", qstr_str(qst));
231  printf(" (cache=%u)", *ip++);
232  }
233  break;
234 
235  case MP_BC_LOAD_ATTR:
236  DECODE_QSTR;
237  printf("LOAD_ATTR %s", qstr_str(qst));
239  printf(" (cache=%u)", *ip++);
240  }
241  break;
242 
243  case MP_BC_LOAD_METHOD:
244  DECODE_QSTR;
245  printf("LOAD_METHOD %s", qstr_str(qst));
246  break;
247 
249  DECODE_QSTR;
250  printf("LOAD_SUPER_METHOD %s", qstr_str(qst));
251  break;
252 
254  printf("LOAD_BUILD_CLASS");
255  break;
256 
257  case MP_BC_LOAD_SUBSCR:
258  printf("LOAD_SUBSCR");
259  break;
260 
261  case MP_BC_STORE_FAST_N:
262  DECODE_UINT;
263  printf("STORE_FAST_N " UINT_FMT, unum);
264  break;
265 
266  case MP_BC_STORE_DEREF:
267  DECODE_UINT;
268  printf("STORE_DEREF " UINT_FMT, unum);
269  break;
270 
271  case MP_BC_STORE_NAME:
272  DECODE_QSTR;
273  printf("STORE_NAME %s", qstr_str(qst));
274  break;
275 
276  case MP_BC_STORE_GLOBAL:
277  DECODE_QSTR;
278  printf("STORE_GLOBAL %s", qstr_str(qst));
279  break;
280 
281  case MP_BC_STORE_ATTR:
282  DECODE_QSTR;
283  printf("STORE_ATTR %s", qstr_str(qst));
285  printf(" (cache=%u)", *ip++);
286  }
287  break;
288 
289  case MP_BC_STORE_SUBSCR:
290  printf("STORE_SUBSCR");
291  break;
292 
293  case MP_BC_DELETE_FAST:
294  DECODE_UINT;
295  printf("DELETE_FAST " UINT_FMT, unum);
296  break;
297 
298  case MP_BC_DELETE_DEREF:
299  DECODE_UINT;
300  printf("DELETE_DEREF " UINT_FMT, unum);
301  break;
302 
303  case MP_BC_DELETE_NAME:
304  DECODE_QSTR;
305  printf("DELETE_NAME %s", qstr_str(qst));
306  break;
307 
308  case MP_BC_DELETE_GLOBAL:
309  DECODE_QSTR;
310  printf("DELETE_GLOBAL %s", qstr_str(qst));
311  break;
312 
313  case MP_BC_DUP_TOP:
314  printf("DUP_TOP");
315  break;
316 
317  case MP_BC_DUP_TOP_TWO:
318  printf("DUP_TOP_TWO");
319  break;
320 
321  case MP_BC_POP_TOP:
322  printf("POP_TOP");
323  break;
324 
325  case MP_BC_ROT_TWO:
326  printf("ROT_TWO");
327  break;
328 
329  case MP_BC_ROT_THREE:
330  printf("ROT_THREE");
331  break;
332 
333  case MP_BC_JUMP:
335  printf("JUMP " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));
336  break;
337 
340  printf("POP_JUMP_IF_TRUE " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));
341  break;
342 
345  printf("POP_JUMP_IF_FALSE " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));
346  break;
347 
350  printf("JUMP_IF_TRUE_OR_POP " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));
351  break;
352 
355  printf("JUMP_IF_FALSE_OR_POP " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));
356  break;
357 
358  case MP_BC_SETUP_WITH:
359  DECODE_ULABEL; // loop-like labels are always forward
360  printf("SETUP_WITH " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));
361  break;
362 
363  case MP_BC_WITH_CLEANUP:
364  printf("WITH_CLEANUP");
365  break;
366 
367  case MP_BC_UNWIND_JUMP:
369  printf("UNWIND_JUMP " UINT_FMT " %d", (mp_uint_t)(ip + unum - mp_showbc_code_start), *ip);
370  ip += 1;
371  break;
372 
373  case MP_BC_SETUP_EXCEPT:
374  DECODE_ULABEL; // except labels are always forward
375  printf("SETUP_EXCEPT " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));
376  break;
377 
378  case MP_BC_SETUP_FINALLY:
379  DECODE_ULABEL; // except labels are always forward
380  printf("SETUP_FINALLY " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));
381  break;
382 
383  case MP_BC_END_FINALLY:
384  // if TOS is an exception, reraises the exception (3 values on TOS)
385  // if TOS is an integer, does something else
386  // if TOS is None, just pops it and continues
387  // else error
388  printf("END_FINALLY");
389  break;
390 
391  case MP_BC_GET_ITER:
392  printf("GET_ITER");
393  break;
394 
396  printf("GET_ITER_STACK");
397  break;
398 
399  case MP_BC_FOR_ITER:
400  DECODE_ULABEL; // the jump offset if iteration finishes; for labels are always forward
401  printf("FOR_ITER " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));
402  break;
403 
404  case MP_BC_POP_BLOCK:
405  // pops block and restores the stack
406  printf("POP_BLOCK");
407  break;
408 
409  case MP_BC_POP_EXCEPT:
410  // pops block, checks it's an exception block, and restores the stack, saving the 3 exception values to local threadstate
411  printf("POP_EXCEPT");
412  break;
413 
414  case MP_BC_BUILD_TUPLE:
415  DECODE_UINT;
416  printf("BUILD_TUPLE " UINT_FMT, unum);
417  break;
418 
419  case MP_BC_BUILD_LIST:
420  DECODE_UINT;
421  printf("BUILD_LIST " UINT_FMT, unum);
422  break;
423 
424  case MP_BC_BUILD_MAP:
425  DECODE_UINT;
426  printf("BUILD_MAP " UINT_FMT, unum);
427  break;
428 
429  case MP_BC_STORE_MAP:
430  printf("STORE_MAP");
431  break;
432 
433  case MP_BC_BUILD_SET:
434  DECODE_UINT;
435  printf("BUILD_SET " UINT_FMT, unum);
436  break;
437 
438 #if MICROPY_PY_BUILTINS_SLICE
439  case MP_BC_BUILD_SLICE:
440  DECODE_UINT;
441  printf("BUILD_SLICE " UINT_FMT, unum);
442  break;
443 #endif
444 
445  case MP_BC_STORE_COMP:
446  DECODE_UINT;
447  printf("STORE_COMP " UINT_FMT, unum);
448  break;
449 
451  DECODE_UINT;
452  printf("UNPACK_SEQUENCE " UINT_FMT, unum);
453  break;
454 
455  case MP_BC_UNPACK_EX:
456  DECODE_UINT;
457  printf("UNPACK_EX " UINT_FMT, unum);
458  break;
459 
460  case MP_BC_MAKE_FUNCTION:
461  DECODE_PTR;
462  printf("MAKE_FUNCTION %p", (void*)(uintptr_t)unum);
463  break;
464 
466  DECODE_PTR;
467  printf("MAKE_FUNCTION_DEFARGS %p", (void*)(uintptr_t)unum);
468  break;
469 
470  case MP_BC_MAKE_CLOSURE: {
471  DECODE_PTR;
472  mp_uint_t n_closed_over = *ip++;
473  printf("MAKE_CLOSURE %p " UINT_FMT, (void*)(uintptr_t)unum, n_closed_over);
474  break;
475  }
476 
478  DECODE_PTR;
479  mp_uint_t n_closed_over = *ip++;
480  printf("MAKE_CLOSURE_DEFARGS %p " UINT_FMT, (void*)(uintptr_t)unum, n_closed_over);
481  break;
482  }
483 
484  case MP_BC_CALL_FUNCTION:
485  DECODE_UINT;
486  printf("CALL_FUNCTION n=" UINT_FMT " nkw=" UINT_FMT, unum & 0xff, (unum >> 8) & 0xff);
487  break;
488 
490  DECODE_UINT;
491  printf("CALL_FUNCTION_VAR_KW n=" UINT_FMT " nkw=" UINT_FMT, unum & 0xff, (unum >> 8) & 0xff);
492  break;
493 
494  case MP_BC_CALL_METHOD:
495  DECODE_UINT;
496  printf("CALL_METHOD n=" UINT_FMT " nkw=" UINT_FMT, unum & 0xff, (unum >> 8) & 0xff);
497  break;
498 
500  DECODE_UINT;
501  printf("CALL_METHOD_VAR_KW n=" UINT_FMT " nkw=" UINT_FMT, unum & 0xff, (unum >> 8) & 0xff);
502  break;
503 
504  case MP_BC_RETURN_VALUE:
505  printf("RETURN_VALUE");
506  break;
507 
508  case MP_BC_RAISE_VARARGS:
509  unum = *ip++;
510  printf("RAISE_VARARGS " UINT_FMT, unum);
511  break;
512 
513  case MP_BC_YIELD_VALUE:
514  printf("YIELD_VALUE");
515  break;
516 
517  case MP_BC_YIELD_FROM:
518  printf("YIELD_FROM");
519  break;
520 
521  case MP_BC_IMPORT_NAME:
522  DECODE_QSTR;
523  printf("IMPORT_NAME '%s'", qstr_str(qst));
524  break;
525 
526  case MP_BC_IMPORT_FROM:
527  DECODE_QSTR;
528  printf("IMPORT_FROM '%s'", qstr_str(qst));
529  break;
530 
531  case MP_BC_IMPORT_STAR:
532  printf("IMPORT_STAR");
533  break;
534 
535  default:
536  if (ip[-1] < MP_BC_LOAD_CONST_SMALL_INT_MULTI + 64) {
537  printf("LOAD_CONST_SMALL_INT " INT_FMT, (mp_int_t)ip[-1] - MP_BC_LOAD_CONST_SMALL_INT_MULTI - 16);
538  } else if (ip[-1] < MP_BC_LOAD_FAST_MULTI + 16) {
539  printf("LOAD_FAST " UINT_FMT, (mp_uint_t)ip[-1] - MP_BC_LOAD_FAST_MULTI);
540  } else if (ip[-1] < MP_BC_STORE_FAST_MULTI + 16) {
541  printf("STORE_FAST " UINT_FMT, (mp_uint_t)ip[-1] - MP_BC_STORE_FAST_MULTI);
542  } else if (ip[-1] < MP_BC_UNARY_OP_MULTI + MP_UNARY_OP_NUM_BYTECODE) {
543  printf("UNARY_OP " UINT_FMT, (mp_uint_t)ip[-1] - MP_BC_UNARY_OP_MULTI);
544  } else if (ip[-1] < MP_BC_BINARY_OP_MULTI + MP_BINARY_OP_NUM_BYTECODE) {
545  mp_uint_t op = ip[-1] - MP_BC_BINARY_OP_MULTI;
546  printf("BINARY_OP " UINT_FMT " %s", op, qstr_str(mp_binary_op_method_name[op]));
547  } else {
548  printf("code %p, byte code 0x%02x not implemented\n", ip, ip[-1]);
549  assert(0);
550  return ip;
551  }
552  break;
553  }
554 
555  return ip;
556 }
557 
558 void mp_bytecode_print2(const byte *ip, size_t len, const mp_uint_t *const_table) {
559  mp_showbc_code_start = ip;
560  mp_showbc_const_table = const_table;
561  while (ip < len + mp_showbc_code_start) {
562  printf("%02u ", (uint)(ip - mp_showbc_code_start));
563  ip = mp_bytecode_print_str(ip);
564  printf("\n");
565  }
566 }
567 
568 #endif // MICROPY_DEBUG_PRINTERS
const mp_print_t mp_plat_print
Definition: mpprint.c:51
#define MP_BC_CALL_FUNCTION_VAR_KW
Definition: bc0.h:105
#define MP_BC_LOAD_CONST_FALSE
Definition: bc0.h:32
#define MP_BC_BUILD_SET
Definition: bc0.h:89
#define MP_BC_BUILD_MAP
Definition: bc0.h:87
#define MP_BC_BUILD_TUPLE
Definition: bc0.h:85
#define MP_BC_LOAD_NAME
Definition: bc0.h:42
#define MP_BC_STORE_NAME
Definition: bc0.h:52
intptr_t mp_int_t
Definition: mpconfigport.h:73
uintptr_t mp_uint_t
Definition: mpconfigport.h:74
#define MP_BC_STORE_COMP
Definition: bc0.h:91
#define INT_FMT
Definition: mpconfigport.h:72
#define MP_BC_LOAD_DEREF
Definition: bc0.h:41
const char * qstr_str(qstr q)
Definition: qstr.c:278
#define MP_BC_RAISE_VARARGS
Definition: bc0.h:96
#define MP_BC_GET_ITER_STACK
Definition: bc0.h:83
#define DECODE_QSTR
Definition: vm.c:81
#define MP_BC_LOAD_NULL
Definition: bc0.h:38
#define assert(e)
Definition: assert.h:9
#define MP_BC_UNARY_OP_MULTI
Definition: bc0.h:116
const byte * mp_bytecode_print_str(const byte *ip)
#define MP_BC_IMPORT_FROM
Definition: bc0.h:110
#define MP_BC_LOAD_SUPER_METHOD
Definition: bc0.h:46
#define MP_BC_STORE_ATTR
Definition: bc0.h:54
#define DECODE_UINT
Definition: vm.c:59
#define DECODE_OBJ
Definition: vm.c:89
#define MP_BC_BINARY_OP_MULTI
Definition: bc0.h:117
#define MP_BC_LOAD_CONST_SMALL_INT_MULTI
Definition: bc0.h:113
void mp_bytecode_print2(const byte *code, size_t len, const mp_uint_t *const_table)
#define MP_OBJ_QSTR_VALUE(o)
Definition: obj.h:91
#define MP_BC_DUP_TOP_TWO
Definition: bc0.h:63
#define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE
Definition: mpconfig.h:396
#define MP_BC_LOAD_CONST_NONE
Definition: bc0.h:33
unsigned int uintptr_t
Definition: stdint.h:14
#define MP_BC_LOAD_BUILD_CLASS
Definition: bc0.h:47
#define MP_BC_IMPORT_NAME
Definition: bc0.h:109
#define MP_BC_MAKE_FUNCTION_DEFARGS
Definition: bc0.h:101
#define MP_BC_POP_EXCEPT
Definition: bc0.h:81
#define MP_BC_STORE_MAP
Definition: bc0.h:88
#define MP_BC_MAKE_CLOSURE_DEFARGS
Definition: bc0.h:103
#define MP_BC_LOAD_CONST_TRUE
Definition: bc0.h:34
#define MP_BC_DELETE_DEREF
Definition: bc0.h:58
#define MP_BC_CALL_METHOD_VAR_KW
Definition: bc0.h:107
#define MP_BC_CALL_FUNCTION
Definition: bc0.h:104
#define MP_BC_POP_TOP
Definition: bc0.h:64
#define MP_BC_POP_JUMP_IF_FALSE
Definition: bc0.h:70
#define MP_BC_BUILD_SLICE
Definition: bc0.h:90
#define MP_BC_DELETE_NAME
Definition: bc0.h:59
#define MP_BC_JUMP_IF_TRUE_OR_POP
Definition: bc0.h:71
#define MP_BC_LOAD_GLOBAL
Definition: bc0.h:43
#define MP_BC_MAKE_CLOSURE
Definition: bc0.h:102
#define MP_BC_DELETE_GLOBAL
Definition: bc0.h:60
#define MP_BC_UNPACK_SEQUENCE
Definition: bc0.h:92
#define MP_BC_STORE_GLOBAL
Definition: bc0.h:53
#define MP_BC_DELETE_FAST
Definition: bc0.h:57
#define MP_BC_ROT_TWO
Definition: bc0.h:65
const byte mp_binary_op_method_name[MP_BINARY_OP_NUM_RUNTIME]
Definition: objtype.c:416
#define MP_BC_LOAD_ATTR
Definition: bc0.h:44
#define MP_BC_LOAD_SUBSCR
Definition: bc0.h:48
#define DECODE_ULABEL
Definition: vm.c:64
void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind)
Definition: obj.c:59
size_t qstr
Definition: qstr.h:48
#define UINT_FMT
Definition: mpconfigport.h:71
#define MP_BC_UNWIND_JUMP
Definition: bc0.h:82
#define MP_BC_LOAD_CONST_OBJ
Definition: bc0.h:37
#define MP_BC_CALL_METHOD
Definition: bc0.h:106
#define MP_BC_JUMP
Definition: bc0.h:68
#define MP_BC_JUMP_IF_FALSE_OR_POP
Definition: bc0.h:72
#define MP_BC_FOR_ITER
Definition: bc0.h:79
#define MP_BC_POP_BLOCK
Definition: bc0.h:80
#define MP_BC_GET_ITER
Definition: bc0.h:78
#define MP_BC_WITH_CLEANUP
Definition: bc0.h:74
#define MP_BC_SETUP_WITH
Definition: bc0.h:73
void mp_bytecode_print(const void *descr, const byte *code, mp_uint_t len, const mp_uint_t *const_table)
unsigned char byte
Definition: misc.h:37
#define DECODE_PTR
Definition: vm.c:85
#define MP_BC_ROT_THREE
Definition: bc0.h:66
mp_uint_t mp_decode_uint(const byte **ptr)
Definition: bc.c:43
#define DECODE_SLABEL
Definition: vm.c:65
#define MP_BC_UNPACK_EX
Definition: bc0.h:93
#define MP_BC_SETUP_EXCEPT
Definition: bc0.h:75
#define MP_BC_LOAD_METHOD
Definition: bc0.h:45
#define MP_BC_LOAD_CONST_SMALL_INT
Definition: bc0.h:35
#define MP_BC_LOAD_FAST_MULTI
Definition: bc0.h:114
#define MP_BC_STORE_FAST_MULTI
Definition: bc0.h:115
#define MP_BC_DUP_TOP
Definition: bc0.h:62
#define MP_OBJ_TO_PTR(o)
Definition: obj.h:228
#define MP_BC_MAKE_FUNCTION
Definition: bc0.h:100
#define MP_BC_END_FINALLY
Definition: bc0.h:77
#define MP_BC_STORE_FAST_N
Definition: bc0.h:50
#define MP_BC_STORE_SUBSCR
Definition: bc0.h:55
#define MP_BC_SETUP_FINALLY
Definition: bc0.h:76
uint64_t mp_obj_t
Definition: obj.h:39
#define MP_BC_LOAD_CONST_STRING
Definition: bc0.h:36
#define MP_BC_RETURN_VALUE
Definition: bc0.h:95
#define MP_BC_BUILD_LIST
Definition: bc0.h:86
#define MP_BC_POP_JUMP_IF_TRUE
Definition: bc0.h:69
#define MP_BC_STORE_DEREF
Definition: bc0.h:51
#define MP_BC_IMPORT_STAR
Definition: bc0.h:111
#define MP_BC_YIELD_VALUE
Definition: bc0.h:97
uint16_t source_file
Definition: scope.h:74
#define MP_BC_YIELD_FROM
Definition: bc0.h:98
#define MP_BC_LOAD_FAST_N
Definition: bc0.h:40
unsigned int uint
Definition: misc.h:38