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
d72370de
Commit
d72370de
authored
7 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
py/objfun, vm: Add comments on codestate allocation in stackless mode.
parent
fca1d1aa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
py/objfun.c
+5
-1
5 additions, 1 deletion
py/objfun.c
py/vm.c
+12
-0
12 additions, 0 deletions
py/vm.c
with
17 additions
and
1 deletion
py/objfun.c
+
5
−
1
View file @
d72370de
...
...
@@ -218,8 +218,12 @@ mp_code_state_t *mp_obj_fun_bc_prepare_codestate(mp_obj_t self_in, size_t n_args
size_t
n_state
,
state_size
;
DECODE_CODESTATE_SIZE
(
self
->
bytecode
,
n_state
,
state_size
);
// allocate state for locals and stack
mp_code_state_t
*
code_state
;
// If we use m_new_obj_var(), then on no memory, MemoryError will be
// raised. But this is not correct exception for a function call,
// RuntimeError should be raised instead. So, we use m_new_obj_var_maybe(),
// return NULL, then vm.c takes the needed action (either raise
// RuntimeError or fallback to stack allocation).
code_state
=
m_new_obj_var_maybe
(
mp_code_state_t
,
byte
,
state_size
);
if
(
!
code_state
)
{
return
NULL
;
...
...
This diff is collapsed.
Click to expand it.
py/vm.c
+
12
−
0
View file @
d72370de
...
...
@@ -937,6 +937,9 @@ unwind_jump:;
deep_recursion_error:
mp_exc_recursion_depth
();
}
#else
// If we couldn't allocate codestate on heap, in
// non non-strict case fall thru to stack allocation.
#endif
}
#endif
...
...
@@ -974,6 +977,9 @@ unwind_jump:;
else
{
goto
deep_recursion_error
;
}
#else
// If we couldn't allocate codestate on heap, in
// non non-strict case fall thru to stack allocation.
#endif
}
#endif
...
...
@@ -1008,6 +1014,9 @@ unwind_jump:;
else
{
goto
deep_recursion_error
;
}
#else
// If we couldn't allocate codestate on heap, in
// non non-strict case fall thru to stack allocation.
#endif
}
#endif
...
...
@@ -1045,6 +1054,9 @@ unwind_jump:;
else
{
goto
deep_recursion_error
;
}
#else
// If we couldn't allocate codestate on heap, in
// non non-strict case fall thru to stack allocation.
#endif
}
#endif
...
...
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