8000 MP_STATE_VM(repl_line) does not exist · Issue #3596 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content
MP_STATE_VM(repl_line) does not exist #3596
Closed
@adritium

Description

@adritium
MP_STATE_VM(repl_line) = vstr_new(32);
#define MP_STATE_VM(x) (mp_state_ctx.vm.x)
mp_state_vm_t vm;

micropython/py/mpstate.h

Lines 108 to 210 in cc92c05

typedef struct _mp_state_vm_t {
////////////////////////////////////////////////////////////
// START ROOT POINTER SECTION
// everything that needs GC scanning must go here
// this must start at the start of this structure
//
qstr_pool_t *last_pool;
// non-heap memory for creating an exception if we can't allocate RAM
mp_obj_exception_t mp_emergency_exception_obj;
// memory for exception arguments if we can't allocate RAM
#if MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF
#if MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE > 0
// statically allocated buf (needs to be aligned to mp_obj_t)
mp_obj_t mp_emergency_exception_buf[MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE / sizeof(mp_obj_t)];
#else
// dynamically allocated buf
byte *mp_emergency_exception_buf;
#endif
#endif
#if MICROPY_KBD_EXCEPTION
// exception object of type KeyboardInterrupt
mp_obj_exception_t mp_kbd_exception;
#endif
// dictionary with loaded modules (may be exposed as sys.modules)
mp_obj_dict_t mp_loaded_modules_dict;
// pending exception object (MP_OBJ_NULL if not pending)
volatile mp_obj_t mp_pending_exception;
#if MICROPY_ENABLE_SCHEDULER
volatile int16_t sched_state;
uint16_t sched_sp;
mp_sched_item_t sched_stack[MICROPY_SCHEDULER_DEPTH];
#endif
// current exception being handled, for sys.exc_info()
#if MICROPY_PY_SYS_EXC_INFO
mp_obj_base_t *cur_exception;
#endif
// dictionary for the __main__ module
mp_obj_dict_t dict_main;
// these two lists must be initialised per port, after the call to mp_init
mp_obj_list_t mp_sys_path_obj;
mp_obj_list_t mp_sys_argv_obj;
// dictionary for overridden builtins
#if MICROPY_CAN_OVERRIDE_BUILTINS
mp_obj_dict_t *mp_module_builtins_override_dict;
#endif
// include any root pointers defined by a port
MICROPY_PORT_ROOT_POINTERS
// root pointers for extmod
#if MICROPY_PY_OS_DUPTERM
mp_obj_t dupterm_objs[MICROPY_PY_OS_DUPTERM];
mp_obj_t dupterm_arr_obj;
#endif
#if MICROPY_PY_LWIP_SLIP
mp_obj_t lwip_slip_stream;
#endif
#if MICROPY_VFS
struct _mp_vfs_mount_t *vfs_cur;
struct _mp_vfs_mount_t *vfs_mount_table;
#endif
//
// END ROOT POINTER SECTION
////////////////////////////////////////////////////////////
// pointer and sizes to store interned string data
// (qstr_last_chunk can be root pointer but is also stored in qstr pool)
byte *qstr_last_chunk;
size_t qstr_last_alloc;
size_t qstr_last_used;
#if MICROPY_PY_THREAD
// This is a global mutex used to make qstr interning thread-safe.
mp_thread_mutex_t qstr_mutex;
#endif
mp_uint_t mp_optimise_value;
// size of the emergency exception buf, if it's dynamically allocated
#if MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF && MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE == 0
mp_int_t mp_emergency_exception_buf_size;
#endif
#if MICROPY_PY_THREAD_GIL
// This is a global mutex used to make the VM/runtime thread-safe.
mp_thread_mutex_t gil_mutex;
#endif
} mp_state_vm_t;

Where in mp_state_vm_t do I add vstr_t* repl_line?

typedef struct _repl_t {
// This structure originally also held current REPL line,
// but it was moved to MP_STATE_VM(repl_line) as containing
// root pointer. Still keep structure in case more state
// will be added later.
//vstr_t line;
bool cont_line;
} repl_t;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0