Add SET_ADD opcode to VM.
This commit is contained in:
parent
5fd09668b7
commit
c12aa468a1
@ -1305,6 +1305,11 @@ py_obj_t rt_build_set(int n_args, py_obj_t *items) {
|
||||
return o;
|
||||
}
|
||||
|
||||
py_obj_t rt_store_set(py_obj_t set, py_obj_t item) {
|
||||
py_set_lookup(set, item, true);
|
||||
return set;
|
||||
}
|
||||
|
||||
py_obj_t rt_build_map(int n_args) {
|
||||
py_obj_base_t *o = m_new(py_obj_base_t, 1);
|
||||
o->kind = O_MAP;
|
||||
|
@ -119,9 +119,10 @@ py_obj_t rt_call_method_n(int n_args, const py_obj_t *args);
|
||||
py_obj_t rt_build_tuple(int n_args, py_obj_t *items);
|
||||
py_obj_t rt_build_list(int n_args, py_obj_t *items);
|
||||
py_obj_t rt_list_append(py_obj_t list, py_obj_t arg);
|
||||
py_obj_t rt_build_set(int n_args, py_obj_t *items);
|
||||
py_obj_t rt_store_set(py_obj_t set, py_obj_t item);
|
||||
py_obj_t rt_build_map(int n_args);
|
||||
py_obj_t rt_store_map(py_obj_t map, py_obj_t key, py_obj_t value);
|
||||
py_obj_t rt_build_set(int n_args, py_obj_t *items);
|
||||
py_obj_t rt_load_attr(py_obj_t base, qstr attr);
|
||||
void rt_load_method(py_obj_t base, qstr attr, py_obj_t *dest);
|
||||
void rt_store_attr(py_obj_t base, qstr attr, py_obj_t val);
|
||||
|
7
py/vm.c
7
py/vm.c
@ -319,6 +319,13 @@ bool py_execute_byte_code_2(const byte *code, const byte **ip_in_out, py_obj_t *
|
||||
*sp = obj1;
|
||||
break;
|
||||
|
||||
case PYBC_SET_ADD:
|
||||
DECODE_UINT;
|
||||
// I think it's guaranteed by the compiler that sp[unum] is a set
|
||||
rt_store_set(sp[unum], sp[0]);
|
||||
sp++;
|
||||
break;
|
||||
|
||||
case PYBC_MAKE_FUNCTION:
|
||||
DECODE_UINT;
|
||||
PUSH(rt_make_function_from_id(unum));
|
||||
|
Loading…
x
Reference in New Issue
Block a user