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
0abb5609
Commit
0abb5609
authored
Jan 16, 2015
by
Damien George
Browse files
py: Remove unnecessary id_flags argument from emitter's load_fast.
Saves 24 bytes in bare-arm.
parent
2276eb80
Changes
6
Hide whitespace changes
Inline
Side-by-side
py/compile.c
View file @
0abb5609
...
...
@@ -981,7 +981,7 @@ STATIC void close_over_variables_etc(compiler_t *comp, scope_t *this_scope, int
EMIT_ARG
(
load_closure
,
id
->
qst
,
id
->
local_num
);
#else
// in Micro Python we load closures using LOAD_FAST
EMIT_ARG
(
load_fast
,
id
->
qst
,
id
->
flags
,
id
->
local_num
);
EMIT_ARG
(
load_fast
,
id
->
qst
,
id
->
local_num
);
#endif
nfree
+=
1
;
}
...
...
@@ -2487,7 +2487,7 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar
for
(
int
i
=
0
;
i
<
comp
->
scope_cur
->
id_info_len
;
i
++
)
{
if
(
comp
->
scope_cur
->
id_info
[
i
].
flags
&
ID_FLAG_IS_PARAM
)
{
// first argument found; load it and call super
EMIT_ARG
(
load_fast
,
MP_QSTR_
,
comp
->
scope_cur
->
id_info
[
i
].
flags
,
comp
->
scope_cur
->
id_info
[
i
].
local_num
);
EMIT_ARG
(
load_fast
,
MP_QSTR_
,
comp
->
scope_cur
->
id_info
[
i
].
local_num
);
EMIT_ARG
(
call_function
,
2
,
0
,
0
);
return
;
}
...
...
@@ -3384,7 +3384,7 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
#if MICROPY_EMIT_CPYTHON
EMIT_ARG
(
load_closure
,
MP_QSTR___class__
,
0
);
// XXX check this is the correct local num
#else
EMIT_ARG
(
load_fast
,
MP_QSTR___class__
,
id
->
flags
,
id
->
local_num
);
EMIT_ARG
(
load_fast
,
MP_QSTR___class__
,
id
->
local_num
);
#endif
}
EMIT
(
return_value
);
...
...
py/emit.h
View file @
0abb5609
...
...
@@ -82,7 +82,7 @@ typedef struct _emit_method_table_t {
void
(
*
load_const_str
)(
emit_t
*
emit
,
qstr
qst
,
bool
bytes
);
void
(
*
load_const_obj
)(
emit_t
*
emit
,
void
*
obj
);
void
(
*
load_null
)(
emit_t
*
emit
);
void
(
*
load_fast
)(
emit_t
*
emit
,
qstr
qst
,
mp_uint_t
id_flags
,
mp_uint_t
local_num
);
void
(
*
load_fast
)(
emit_t
*
emit
,
qstr
qst
,
mp_uint_t
local_num
);
void
(
*
load_deref
)(
emit_t
*
emit
,
qstr
qst
,
mp_uint_t
local_num
);
void
(
*
load_name
)(
emit_t
*
emit
,
qstr
qst
);
void
(
*
load_global
)(
emit_t
*
emit
,
qstr
qst
);
...
...
py/emitbc.c
View file @
0abb5609
...
...
@@ -498,7 +498,7 @@ STATIC void emit_bc_load_null(emit_t *emit) {
emit_write_bytecode_byte
(
emit
,
MP_BC_LOAD_NULL
);
};
STATIC
void
emit_bc_load_fast
(
emit_t
*
emit
,
qstr
qst
,
mp_uint_t
id_flags
,
mp_uint_t
local_num
)
{
STATIC
void
emit_bc_load_fast
(
emit_t
*
emit
,
qstr
qst
,
mp_uint_t
local_num
)
{
assert
(
local_num
>=
0
);
emit_bc_pre
(
emit
,
1
);
if
(
local_num
<=
15
)
{
...
...
py/emitcommon.c
View file @
0abb5609
...
...
@@ -44,7 +44,7 @@ void emit_common_load_id(emit_t *emit, const emit_method_table_t *emit_method_ta
}
else
if
(
id
->
kind
==
ID_INFO_KIND_GLOBAL_EXPLICIT
)
{
EMIT
(
load_global
,
qst
);
}
else
if
(
id
->
kind
==
ID_INFO_KIND_LOCAL
)
{
EMIT
(
load_fast
,
qst
,
id
->
flags
,
id
->
local_num
);
EMIT
(
load_fast
,
qst
,
id
->
local_num
);
}
else
if
(
id
->
kind
==
ID_INFO_KIND_CELL
||
id
->
kind
==
ID_INFO_KIND_FREE
)
{
EMIT
(
load_deref
,
qst
,
id
->
local_num
);
}
else
{
...
...
py/emitcpy.c
View file @
0abb5609
...
...
@@ -245,7 +245,7 @@ STATIC void emit_cpy_load_null(emit_t *emit) {
assert
(
0
);
}
STATIC
void
emit_cpy_load_fast
(
emit_t
*
emit
,
qstr
qst
,
mp_uint_t
id_flags
,
mp_uint_t
local_num
)
{
STATIC
void
emit_cpy_load_fast
(
emit_t
*
emit
,
qstr
qst
,
mp_uint_t
local_num
)
{
emit_pre
(
emit
,
1
,
3
);
if
(
emit
->
pass
==
MP_PASS_EMIT
)
{
printf
(
"LOAD_FAST "
UINT_FMT
" %s
\n
"
,
local_num
,
qstr_str
(
qst
));
...
...
py/emitnative.c
View file @
0abb5609
...
...
@@ -1184,8 +1184,8 @@ STATIC void emit_native_load_null(emit_t *emit) {
emit_post_push_imm
(
emit
,
VTYPE_PYOBJ
,
0
);
}
STATIC
void
emit_native_load_fast
(
emit_t
*
emit
,
qstr
qst
,
mp_uint_t
id_flags
,
mp_uint_t
local_num
)
{
DEBUG_printf
(
"load_fast(%s, "
UINT_FMT
", "
UINT_FMT
")
\n
"
,
qstr_str
(
qst
),
id_flags
,
local_num
);
STATIC
void
emit_native_load_fast
(
emit_t
*
emit
,
qstr
qst
,
mp_uint_t
local_num
)
{
DEBUG_printf
(
"load_fast(%s, "
UINT_FMT
")
\n
"
,
qstr_str
(
qst
),
local_num
);
vtype_kind_t
vtype
=
emit
->
local_vtype
[
local_num
];
if
(
vtype
==
VTYPE_UNBOUND
)
{
printf
(
"ViperTypeError: local %s used before type known
\n
"
,
qstr_str
(
qst
));
...
...
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