Skip to content
Browse files

borrow some code from the old PARROT_CALLIN_START macro set, and ensu…

…re the stacktop pointer is set/reset
  • Loading branch information...
1 parent 8499c81 commit d67e5d41c189a520c0ad48bac0fb83163b212e50 @Whiteknight Whiteknight committed Nov 9, 2010
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/embed/api.c
View
8 src/embed/api.c
@@ -5,6 +5,8 @@
#define EMBED_API_CALLIN(p, i) \
jmp_buf _env; \
Interp * (i) = PMC_IS_NULL(p) ? NULL : GET_RAW_INTERP(p); \
+ void *_oldtop = (i)->lo_var_ptr; \
+ if (_oldtop) {} else (1)->lo_var_ptr = &oldtop \
if (!(i)) \
return 0; \
if (setjmp(_env)) { \
@@ -15,6 +17,12 @@
{
#define EMBED_API_CALLOUT(p, i) \
} \
+ do {\
+ if (!_oldtop) {\
+ PARROT_ASSERT((i)->lo_var_ptr == &oldtop);\
+ (i)->lo_var_ptr = NULL;\
+ }\
+ } while (0); \
return 1; \
}

0 comments on commit d67e5d4

Please sign in to comment.
Something went wrong with that request. Please try again.