Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
c12aa468
Commit
c12aa468
authored
Oct 16, 2013
by
Damien
Browse files
Add SET_ADD opcode to VM.
parent
5fd09668
Changes
3
Hide whitespace changes
Inline
Side-by-side
py/runtime.c
View file @
c12aa468
...
...
@@ -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
;
...
...
py/runtime.h
View file @
c12aa468
...
...
@@ -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
);
...
...
py/vm.c
View file @
c12aa468
...
...
@@ -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
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment