Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
7fe2191c
Commit
7fe2191c
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Code clean-up in native emitter; improve thumb native calls.
parent
86de21b8
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
py/asmthumb.c
+5
-8
5 additions, 8 deletions
py/asmthumb.c
py/emitnative.c
+61
-61
61 additions, 61 deletions
py/emitnative.c
py/runtime.c
+4
-1
4 additions, 1 deletion
py/runtime.c
py/runtime0.h
+4
-1
4 additions, 1 deletion
py/runtime0.h
with
74 additions
and
71 deletions
py/asmthumb.c
+
5
−
8
View file @
7fe2191c
...
@@ -496,17 +496,14 @@ void asm_thumb_bl_ind(asm_thumb_t *as, void *fun_ptr, uint fun_id, uint reg_temp
...
@@ -496,17 +496,14 @@ void asm_thumb_bl_ind(asm_thumb_t *as, void *fun_ptr, uint fun_id, uint reg_temp
asm_thumb_op16(as, 0x4780 | (REG_R9 << 3)); // blx reg
asm_thumb_op16(as, 0x4780 | (REG_R9 << 3)); // blx reg
*/
*/
if
(
0
)
{
if
(
fun_id
<
32
)
{
// load ptr to function into register using immediate, then branch
// load ptr to function from table, indexed by fun_id (must be in range 0-31); 4 bytes
// not relocatable
asm_thumb_mov_reg_i32
(
as
,
reg_temp
,
(
mp_uint_t
)
fun_ptr
);
asm_thumb_op16
(
as
,
OP_BLX
(
reg_temp
));
}
else
if
(
1
)
{
asm_thumb_op16
(
as
,
OP_FORMAT_9_10
(
ASM_THUMB_FORMAT_9_LDR
|
ASM_THUMB_FORMAT_9_WORD_TRANSFER
,
reg_temp
,
REG_R7
,
fun_id
));
asm_thumb_op16
(
as
,
OP_FORMAT_9_10
(
ASM_THUMB_FORMAT_9_LDR
|
ASM_THUMB_FORMAT_9_WORD_TRANSFER
,
reg_temp
,
REG_R7
,
fun_id
));
asm_thumb_op16
(
as
,
OP_BLX
(
reg_temp
));
asm_thumb_op16
(
as
,
OP_BLX
(
reg_temp
));
}
else
{
}
else
{
// use SVC
// load ptr to function into register using immediate; 6 bytes
asm_thumb_op16
(
as
,
OP_SVC
(
fun_id
));
asm_thumb_mov_reg_i32
(
as
,
reg_temp
,
(
mp_uint_t
)
fun_ptr
);
asm_thumb_op16
(
as
,
OP_BLX
(
reg_temp
));
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
py/emitnative.c
+
61
−
61
View file @
7fe2191c
This diff is collapsed.
Click to expand it.
py/runtime.c
+
4
−
1
View file @
7fe2191c
...
@@ -1192,13 +1192,14 @@ NORETURN void mp_native_raise(mp_obj_t o) {
...
@@ -1192,13 +1192,14 @@ NORETURN void mp_native_raise(mp_obj_t o) {
nlr_raise
(
mp_make_raise_obj
(
o
));
nlr_raise
(
mp_make_raise_obj
(
o
));
}
}
// these must correspond to the respective enum
// these must correspond to the respective enum
in runtime0.h
void
*
const
mp_fun_table
[
MP_F_NUMBER_OF
]
=
{
void
*
const
mp_fun_table
[
MP_F_NUMBER_OF
]
=
{
mp_convert_obj_to_native
,
mp_convert_obj_to_native
,
mp_convert_native_to_obj
,
mp_convert_native_to_obj
,
mp_load_const_int
,
mp_load_const_int
,
mp_load_const_dec
,
mp_load_const_dec
,
mp_load_const_str
,
mp_load_const_str
,
mp_load_const_bytes
,
mp_load_name
,
mp_load_name
,
mp_load_global
,
mp_load_global
,
mp_load_build_class
,
mp_load_build_class
,
...
@@ -1225,6 +1226,8 @@ void *const mp_fun_table[MP_F_NUMBER_OF] = {
...
@@ -1225,6 +1226,8 @@ void *const mp_fun_table[MP_F_NUMBER_OF] = {
mp_call_method_n_kw
,
mp_call_method_n_kw
,
mp_getiter
,
mp_getiter
,
mp_iternext
,
mp_iternext
,
nlr_push
,
nlr_pop
,
mp_native_raise
,
mp_native_raise
,
mp_import_name
,
mp_import_name
,
mp_import_from
,
mp_import_from
,
...
...
This diff is collapsed.
Click to expand it.
py/runtime0.h
+
4
−
1
View file @
7fe2191c
...
@@ -107,6 +107,7 @@ typedef enum {
...
@@ -107,6 +107,7 @@ typedef enum {
MP_F_LOAD_CONST_INT
,
MP_F_LOAD_CONST_INT
,
MP_F_LOAD_CONST_DEC
,
MP_F_LOAD_CONST_DEC
,
MP_F_LOAD_CONST_STR
,
MP_F_LOAD_CONST_STR
,
MP_F_LOAD_CONST_BYTES
,
MP_F_LOAD_NAME
,
MP_F_LOAD_NAME
,
MP_F_LOAD_GLOBAL
,
MP_F_LOAD_GLOBAL
,
MP_F_LOAD_BUILD_CLASS
,
MP_F_LOAD_BUILD_CLASS
,
...
@@ -133,9 +134,11 @@ typedef enum {
...
@@ -133,9 +134,11 @@ typedef enum {
MP_F_CALL_METHOD_N_KW
,
MP_F_CALL_METHOD_N_KW
,
MP_F_GETITER
,
MP_F_GETITER
,
MP_F_ITERNEXT
,
MP_F_ITERNEXT
,
MP_F_NLR_PUSH
,
MP_F_NLR_POP
,
MP_F_NATIVE_RAISE
,
MP_F_NATIVE_RAISE
,
MP_F_IMPORT_NAME
,
MP_F_IMPORT_NAME
,
MP_F_IMPORT_FROM
,
// = 31 XXX this is the limit for thumb code...
MP_F_IMPORT_FROM
,
MP_F_IMPORT_ALL
,
MP_F_IMPORT_ALL
,
#if MICROPY_PY_BUILTINS_SLICE
#if MICROPY_PY_BUILTINS_SLICE
MP_F_NEW_SLICE
,
MP_F_NEW_SLICE
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment