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
9f6976b7
Commit
9f6976b7
authored
9 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Make mp_setup_code_state take concrete pointer for func arg.
parent
278f3592
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/bc.c
+1
-2
1 addition, 2 deletions
py/bc.c
py/bc.h
+2
-1
2 additions, 1 deletion
py/bc.h
py/objfun.c
+1
-1
1 addition, 1 deletion
py/objfun.c
with
4 additions
and
4 deletions
py/bc.c
+
1
−
2
View file @
9f6976b7
...
...
@@ -89,10 +89,9 @@ STATIC void dump_args(const mp_obj_t *a, mp_uint_t sz) {
// - code_state->ip should contain the offset in bytes from the start of
// the bytecode chunk to just after n_state and n_exc_stack
// - code_state->n_state should be set to the state size (locals plus stack)
void
mp_setup_code_state
(
mp_code_state
*
code_state
,
mp_obj_t
self
_in
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
)
{
void
mp_setup_code_state
(
mp_code_state
*
code_state
,
mp_obj_
fun_bc_
t
*
self
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
)
{
// This function is pretty complicated. It's main aim is to be efficient in speed and RAM
// usage for the common case of positional only args.
mp_obj_fun_bc_t
*
self
=
self_in
;
mp_uint_t
n_state
=
code_state
->
n_state
;
// ip comes in as an offset into bytecode, so turn it into a true pointer
...
...
This diff is collapsed.
Click to expand it.
py/bc.h
+
2
−
1
View file @
9f6976b7
...
...
@@ -91,7 +91,8 @@ mp_uint_t mp_decode_uint(const byte **ptr);
mp_vm_return_kind_t
mp_execute_bytecode
(
mp_code_state
*
code_state
,
volatile
mp_obj_t
inject_exc
);
mp_code_state
*
mp_obj_fun_bc_prepare_codestate
(
mp_obj_t
func
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
);
void
mp_setup_code_state
(
mp_code_state
*
code_state
,
mp_obj_t
self_in
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
);
struct
_mp_obj_fun_bc_t
;
void
mp_setup_code_state
(
mp_code_state
*
code_state
,
struct
_mp_obj_fun_bc_t
*
self
,
mp_uint_t
n_args
,
mp_uint_t
n_kw
,
const
mp_obj_t
*
args
);
void
mp_bytecode_print
(
const
void
*
descr
,
const
byte
*
code
,
mp_uint_t
len
,
const
mp_uint_t
*
const_table
);
void
mp_bytecode_print2
(
const
byte
*
code
,
mp_uint_t
len
);
const
byte
*
mp_bytecode_print_str
(
const
byte
*
ip
);
...
...
This diff is collapsed.
Click to expand it.
py/objfun.c
+
1
−
1
View file @
9f6976b7
...
...
@@ -231,7 +231,7 @@ STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw,
code_state
->
ip
=
(
byte
*
)(
ip
-
self
->
bytecode
);
// offset to after n_state/n_exc_stack
code_state
->
n_state
=
n_state
;
mp_setup_code_state
(
code_state
,
self
_in
,
n_args
,
n_kw
,
args
);
mp_setup_code_state
(
code_state
,
self
,
n_args
,
n_kw
,
args
);
// execute the byte code with the correct globals context
code_state
->
old_globals
=
mp_globals_get
();
...
...
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