Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions mpy-cross/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ static asm_rv32_backend_options_t rv32_options = { 0 };

// Command line options, with their defaults
static uint emit_opt = MP_EMIT_OPT_NONE;
mp_uint_t mp_verbose_flag = 0;

#if MICROPY_ENABLE_SOURCE_LINE
static bool include_source_lines = true;
Expand Down Expand Up @@ -340,7 +339,7 @@ MP_NOINLINE int main_(int argc, char **argv) {
"; mpy-cross emitting mpy v" MP_STRINGIFY(MPY_VERSION) "." MP_STRINGIFY(MPY_SUB_VERSION) "\n");
return 0;
} else if (strcmp(argv[a], "-v") == 0) {
mp_verbose_flag++;
// This verbose option doesn't currently do anything.
} else if (strncmp(argv[a], "-O", 2) == 0) {
if (unichar_isdigit(argv[a][2])) {
MP_STATE_VM(mp_optimise_value) = argv[a][2] & 0xf;
Expand Down Expand Up @@ -482,12 +481,6 @@ MP_NOINLINE int main_(int argc, char **argv) {

int ret = compile_and_save(input_file, output_file, source_file);

#if MICROPY_PY_MICROPYTHON_MEM_INFO
if (mp_verbose_flag) {
mp_micropython_mem_info(0, NULL);
}
#endif

mp_deinit();

return ret & 0xff;
Expand Down
6 changes: 3 additions & 3 deletions ports/unix/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static int execute_from_lexer(int source_kind, const void *source, mp_parse_inpu

#if defined(MICROPY_UNIX_COVERAGE)
// allow to print the parse tree in the coverage build
if (mp_verbose_flag >= 3) {
if (MP_STATE_VM(mp_verbose_flag) >= 3) {
printf("----------------\n");
mp_parse_node_print(&mp_plat_print, parse_tree.root, 0);
printf("----------------\n");
Expand Down Expand Up @@ -661,7 +661,7 @@ MP_NOINLINE int main_(int argc, char **argv) {
a += 1;
#if MICROPY_DEBUG_PRINTERS
} else if (strcmp(argv[a], "-v") == 0) {
mp_verbose_flag++;
MP_STATE_VM(mp_verbose_flag)++;
#endif
} else if (strncmp(argv[a], "-O", 2) == 0) {
if (unichar_isdigit(argv[a][2])) {
Expand Down Expand Up @@ -720,7 +720,7 @@ MP_NOINLINE int main_(int argc, char **argv) {
#endif

#if MICROPY_PY_MICROPYTHON_MEM_INFO
if (mp_verbose_flag) {
if (MP_STATE_VM(mp_verbose_flag)) {
mp_micropython_mem_info(0, NULL);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion py/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3654,7 +3654,7 @@ void mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_file, bool

#if MICROPY_DEBUG_PRINTERS
// now that the module context is valid, the raw codes can be printed
if (mp_verbose_flag >= 2) {
if (MP_STATE_VM(mp_verbose_flag) >= 2) {
for (scope_t *s = comp->scope_head; s != NULL; s = s->next) {
mp_raw_code_t *rc = s->raw_code;
if (rc->kind == MP_CODE_BYTECODE) {
Expand Down
4 changes: 0 additions & 4 deletions py/emitglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
#define DEBUG_OP_printf(...) (void)0
#endif

#if MICROPY_DEBUG_PRINTERS
mp_uint_t mp_verbose_flag = 0;
#endif

mp_raw_code_t *mp_emit_glue_new_raw_code(void) {
mp_raw_code_t *rc = m_new0(mp_raw_code_t, 1);
rc->kind = MP_CODE_RESERVED;
Expand Down
2 changes: 0 additions & 2 deletions py/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ void vstr_vprintf(vstr_t *vstr, const char *fmt, va_list ap);

int DEBUG_printf(const char *fmt, ...);

extern mp_uint_t mp_verbose_flag;

/** float internals *************/

#if MICROPY_PY_BUILTINS_FLOAT
Expand Down
3 changes: 3 additions & 0 deletions py/mpstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ typedef struct _mp_state_vm_t {
#if MICROPY_EMIT_NATIVE
uint8_t default_emit_opt; // one of MP_EMIT_OPT_xxx
#endif
#if MICROPY_DEBUG_PRINTERS
mp_uint_t mp_verbose_flag;
#endif
#endif

// size of the emergency exception buf, if it's dynamically allocated
Expand Down
3 changes: 3 additions & 0 deletions py/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ void mp_init(void) {
#if MICROPY_EMIT_NATIVE
MP_STATE_VM(default_emit_opt) = MP_EMIT_OPT_NONE;
#endif
#if MICROPY_DEBUG_PRINTERS
MP_STATE_VM(mp_verbose_flag) = 0;
#endif
#endif

// init global module dict
Expand Down
2 changes: 1 addition & 1 deletion shared/runtime/pyexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static int parse_compile_execute(const void *source, mp_parse_input_kind_t input
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
#if defined(MICROPY_UNIX_COVERAGE)
// allow to print the parse tree in the coverage build
if (mp_verbose_flag >= 3) {
if (MP_STATE_VM(mp_verbose_flag) >= 3) {
printf("----------------\n");
mp_parse_node_print(&mp_plat_print, parse_tree.root, 0);
printf("----------------\n");
Expand Down
Loading