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
94238d4a
Commit
94238d4a
authored
9 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py/nlrsetjmp: Update to take into account new location of nlr_top.
It's now accessed via the MP_STATE_THREAD macro.
parent
1df4168c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
py/nlr.h
+5
-5
5 additions, 5 deletions
py/nlr.h
py/nlrsetjmp.c
+2
-2
2 additions, 2 deletions
py/nlrsetjmp.c
with
7 additions
and
7 deletions
py/nlr.h
+
5
−
5
View file @
94238d4a
...
@@ -70,8 +70,8 @@ struct _nlr_buf_t {
...
@@ -70,8 +70,8 @@ struct _nlr_buf_t {
NORETURN
void
nlr_setjmp_jump
(
void
*
val
);
NORETURN
void
nlr_setjmp_jump
(
void
*
val
);
// nlr_push() must be defined as a macro, because "The stack context will be
// nlr_push() must be defined as a macro, because "The stack context will be
// invalidated if the function which called setjmp() returns."
// invalidated if the function which called setjmp() returns."
#define nlr_push(buf) ((buf)->prev = MP_STATE_
VM
(nlr_top), MP_STATE_
VM
(nlr_top) = (buf), setjmp((buf)->jmpbuf))
#define nlr_push(buf) ((buf)->prev = MP_STATE_
THREAD
(nlr_top), MP_STATE_
THREAD
(nlr_top) = (buf), setjmp((buf)->jmpbuf))
#define nlr_pop() { MP_STATE_
VM
(nlr_top) = MP_STATE_
VM
(nlr_top)->prev; }
#define nlr_pop() { MP_STATE_
THREAD
(nlr_top) = MP_STATE_
THREAD
(nlr_top)->prev; }
#define nlr_jump(val) nlr_setjmp_jump(val)
#define nlr_jump(val) nlr_setjmp_jump(val)
#else
#else
unsigned
int
nlr_push
(
nlr_buf_t
*
);
unsigned
int
nlr_push
(
nlr_buf_t
*
);
...
@@ -91,7 +91,7 @@ void nlr_jump_fail(void *val);
...
@@ -91,7 +91,7 @@ void nlr_jump_fail(void *val);
#include
"mpstate.h"
#include
"mpstate.h"
#define nlr_raise(val) \
#define nlr_raise(val) \
do { \
do { \
/*printf("nlr_raise: nlr_top=%p\n", MP_STATE_
VM
(nlr_top)); \
/*printf("nlr_raise: nlr_top=%p\n", MP_STATE_
THREAD
(nlr_top)); \
fflush(stdout);*/
\
fflush(stdout);*/
\
void *_val = MP_OBJ_TO_PTR(val); \
void *_val = MP_OBJ_TO_PTR(val); \
assert(_val != NULL); \
assert(_val != NULL); \
...
@@ -101,11 +101,11 @@ void nlr_jump_fail(void *val);
...
@@ -101,11 +101,11 @@ void nlr_jump_fail(void *val);
#if !MICROPY_NLR_SETJMP
#if !MICROPY_NLR_SETJMP
#define nlr_push(val) \
#define nlr_push(val) \
assert(MP_STATE_
VM
(nlr_top) != val),nlr_push(val)
assert(MP_STATE_
THREAD
(nlr_top) != val),nlr_push(val)
/*
/*
#define nlr_push(val) \
#define nlr_push(val) \
printf("nlr_push: before: nlr_top=%p, val=%p\n", MP_STATE_
VM
(nlr_top), val),assert(MP_STATE_
VM
(nlr_top) != val),nlr_push(val)
printf("nlr_push: before: nlr_top=%p, val=%p\n", MP_STATE_
THREAD
(nlr_top), val),assert(MP_STATE_
THREAD
(nlr_top) != val),nlr_push(val)
#endif
#endif
*/
*/
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
py/nlrsetjmp.c
+
2
−
2
View file @
94238d4a
...
@@ -29,8 +29,8 @@
...
@@ -29,8 +29,8 @@
#if MICROPY_NLR_SETJMP
#if MICROPY_NLR_SETJMP
void
nlr_setjmp_jump
(
void
*
val
)
{
void
nlr_setjmp_jump
(
void
*
val
)
{
nlr_buf_t
*
buf
=
MP_STATE_
VM
(
nlr_top
);
nlr_buf_t
*
buf
=
MP_STATE_
THREAD
(
nlr_top
);
MP_STATE_
VM
(
nlr_top
)
=
buf
->
prev
;
MP_STATE_
THREAD
(
nlr_top
)
=
buf
->
prev
;
buf
->
ret_val
=
val
;
buf
->
ret_val
=
val
;
longjmp
(
buf
->
jmpbuf
,
1
);
longjmp
(
buf
->
jmpbuf
,
1
);
}
}
...
...
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