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
4fff26a3
Commit
4fff26a3
authored
11 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
vm: Factor out exception block setup to a macro.
Will be reused in WITH bytecodes.
parent
c47fd2da
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
py/vm.c
+9
-6
9 additions, 6 deletions
py/vm.c
with
9 additions
and
6 deletions
py/vm.c
+
9
−
6
View file @
4fff26a3
...
...
@@ -44,6 +44,14 @@ typedef enum {
#define TOP() (*sp)
#define SET_TOP(val) *sp = (val)
#define SETUP_BLOCK() \
DECODE_ULABEL;
/* except labels are always forward */
\
++exc_sp; \
exc_sp->opcode = op; \
exc_sp->handler = ip + unum; \
exc_sp->val_sp = MP_TAGPTR_MAKE(sp, currently_in_except_block); \
currently_in_except_block = 0;
/* in a try block now */
mp_vm_return_kind_t
mp_execute_byte_code
(
const
byte
*
code
,
const
mp_obj_t
*
args
,
uint
n_args
,
const
mp_obj_t
*
args2
,
uint
n_args2
,
mp_obj_t
*
ret
)
{
const
byte
*
ip
=
code
;
...
...
@@ -398,12 +406,7 @@ unwind_jump:
// matched against: POP_BLOCK or POP_EXCEPT (anything else?)
case
MP_BC_SETUP_EXCEPT
:
case
MP_BC_SETUP_FINALLY
:
DECODE_ULABEL
;
// except labels are always forward
++
exc_sp
;
exc_sp
->
opcode
=
op
;
exc_sp
->
handler
=
ip
+
unum
;
exc_sp
->
val_sp
=
MP_TAGPTR_MAKE
(
sp
,
currently_in_except_block
);
currently_in_except_block
=
0
;
// in a try block now
SETUP_BLOCK
();
break
;
case
MP_BC_END_FINALLY
:
...
...
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