Make USE_COMPUTED_GOTO a config option in mpconfig.h.
Disabled by default. Enabled in unix port.
This commit is contained in:
parent
0ae9c7042a
commit
3bb8bd899b
|
@ -154,6 +154,12 @@ typedef double mp_float_t;
|
|||
#define MICROPY_PATH_MAX (512)
|
||||
#endif
|
||||
|
||||
// Whether to use computed gotos in the VM, or a switch
|
||||
// Computed gotos are roughly 10% faster, and increase VM code size by a little
|
||||
#ifndef MICROPY_USE_COMPUTED_GOTO
|
||||
#define MICROPY_USE_COMPUTED_GOTO (0)
|
||||
#endif
|
||||
|
||||
// Additional builtin function definitions - see builtintables.c:builtin_object_table for format.
|
||||
#ifndef MICROPY_EXTRA_BUILTINS
|
||||
#define MICROPY_EXTRA_BUILTINS
|
||||
|
|
|
@ -662,7 +662,7 @@ mp_obj_t str_format(uint n_args, const mp_obj_t *args) {
|
|||
if (arg_i > 0) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "cannot switch from automatic field numbering to manual field specification"));
|
||||
}
|
||||
int index;
|
||||
int index = 0;
|
||||
if (str_to_int(vstr_str(field_name), &index) != vstr_len(field_name) - 1) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_KeyError, "attributes not supported yet"));
|
||||
}
|
||||
|
|
6
py/vm.c
6
py/vm.c
|
@ -167,7 +167,7 @@ mp_vm_return_kind_t mp_execute_byte_code_2(const byte *code_info, const byte **i
|
|||
volatile mp_obj_t inject_exc) {
|
||||
// careful: be sure to declare volatile any variables read in the exception handler (written is ok, I think)
|
||||
|
||||
#ifdef MICROPY_USE_COMPUTED_GOTO
|
||||
#if MICROPY_USE_COMPUTED_GOTO
|
||||
|
||||
# define DISPATCH() do { \
|
||||
save_ip = ip; \
|
||||
|
@ -299,7 +299,7 @@ outer_dispatch_loop:
|
|||
// loop to execute byte code
|
||||
for (;;) {
|
||||
dispatch_loop:
|
||||
#ifdef MICROPY_USE_COMPUTED_GOTO
|
||||
#if MICROPY_USE_COMPUTED_GOTO
|
||||
DISPATCH();
|
||||
#else
|
||||
save_ip = ip;
|
||||
|
@ -1005,7 +1005,7 @@ yield:
|
|||
nlr_pop();
|
||||
fastn[0] = obj1;
|
||||
return MP_VM_RETURN_EXCEPTION;
|
||||
#ifndef MICROPY_USE_COMPUTED_GOTO
|
||||
#if !MICROPY_USE_COMPUTED_GOTO
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ QSTR_DEFS = qstrdefsport.h
|
|||
include ../py/py.mk
|
||||
|
||||
# compiler settings
|
||||
CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) -DMICROPY_USE_COMPUTED_GOTO
|
||||
CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT)
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
|
||||
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
|
||||
#define MICROPY_PATH_MAX (PATH_MAX)
|
||||
#define MICROPY_USE_COMPUTED_GOTO (1)
|
||||
#define MICROPY_MOD_SYS_STDFILES (1)
|
||||
|
||||
// type definitions for the specific machine
|
||||
|
|
Loading…
Reference in New Issue