Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
1ee1785b
Commit
1ee1785b
authored
Dec 28, 2014
by
Paul Sokolovsky
Browse files
showbc: Print operation mnemonic in BINARY_OP.
parent
df103462
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/objtype.c
View file @
1ee1785b
...
...
@@ -362,7 +362,7 @@ STATIC mp_obj_t instance_unary_op(mp_uint_t op, mp_obj_t self_in) {
}
}
STATIC
const
qstr
binary_op_method_name
[]
=
{
const
qstr
mp_
binary_op_method_name
[]
=
{
/*
MP_BINARY_OP_OR,
MP_BINARY_OP_XOR,
...
...
@@ -435,7 +435,7 @@ STATIC mp_obj_t instance_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_i
// Note: For ducktyping, CPython does not look in the instance members or use
// __getattr__ or __getattribute__. It only looks in the class dictionary.
mp_obj_instance_t
*
lhs
=
lhs_in
;
qstr
op_name
=
binary_op_method_name
[
op
];
qstr
op_name
=
mp_
binary_op_method_name
[
op
];
/* Still try to lookup native slot
if (op_name == 0) {
return MP_OBJ_NULL;
...
...
py/showbc.c
View file @
1ee1785b
...
...
@@ -34,6 +34,7 @@
#include
"runtime.h"
#include
"bc0.h"
#include
"bc.h"
extern
const
qstr
mp_binary_op_method_name
[];
#if MICROPY_DEBUG_PRINTERS
...
...
@@ -509,7 +510,8 @@ const byte *mp_bytecode_print_str(const byte *ip) {
}
else
if
(
ip
[
-
1
]
<
MP_BC_UNARY_OP_MULTI
+
5
)
{
printf
(
"UNARY_OP "
UINT_FMT
,
(
mp_uint_t
)
ip
[
-
1
]
-
MP_BC_UNARY_OP_MULTI
);
}
else
if
(
ip
[
-
1
]
<
MP_BC_BINARY_OP_MULTI
+
35
)
{
printf
(
"BINARY_OP "
UINT_FMT
,
(
mp_uint_t
)
ip
[
-
1
]
-
MP_BC_BINARY_OP_MULTI
);
mp_uint_t
op
=
ip
[
-
1
]
-
MP_BC_BINARY_OP_MULTI
;
printf
(
"BINARY_OP "
UINT_FMT
" %s"
,
op
,
qstr_str
(
mp_binary_op_method_name
[
op
]));
}
else
{
printf
(
"code %p, byte code 0x%02x not implemented
\n
"
,
ip
,
ip
[
-
1
]);
assert
(
0
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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