forked from rurban/perl-compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cc_runtime.h
124 lines (110 loc) · 3.04 KB
/
cc_runtime.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* cc_runtime.h
*
* Copyright (C) 1999, 2000, 2001, 2004, 2006, 2008 by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
*/
#define DOOP(ppname) PUTBACK; PL_op = ppname(aTHX); SPAGAIN
#define CCPP(s) OP * s(pTHX)
#define PP_LIST(g) do { \
dMARK; \
if (g != G_ARRAY) { \
if (++MARK <= SP) \
*MARK = *SP; \
else \
*MARK = &PL_sv_undef; \
SP = MARK; \
} \
} while (0)
#define MAYBE_TAINT_SASSIGN_SRC(sv) \
if (PL_tainting && PL_tainted && (!SvGMAGICAL(left) || !SvSMAGICAL(left) || \
!((mg=mg_find(left, 't')) && mg->mg_len & 1)))\
TAINT_NOT
#define PP_PREINC(sv) do { \
if (SvIOK(sv)) { \
++SvIVX(sv); \
SvFLAGS(sv) &= ~(SVf_NOK|SVf_POK|SVp_NOK|SVp_POK); \
} \
else \
sv_inc(sv); \
SvSETMAGIC(sv); \
} while (0)
#define PP_UNSTACK do { \
TAINT_NOT; \
PL_stack_sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp; \
FREETMPS; \
oldsave = PL_scopestack[PL_scopestack_ix - 1]; \
LEAVE_SCOPE(oldsave); \
SPAGAIN; \
} while(0)
/* Anyone using eval "" deserves this mess */
#if PERL_VERSION > 9
#define PP_EVAL(ppaddr, nxt) do { \
int ret; \
PUTBACK; \
JMPENV_PUSH(ret); \
switch (ret) { \
case 0: \
PL_op = ppaddr(aTHX); \
cxstack[cxstack_ix].blk_eval.retop = Nullop; \
if (PL_op != nxt) CALLRUNOPS(aTHX); \
JMPENV_POP; \
break; \
case 1: JMPENV_POP; JMPENV_JUMP(1); \
case 2: JMPENV_POP; JMPENV_JUMP(2); \
case 3: \
JMPENV_POP; \
if (PL_restartop && PL_restartop != nxt) \
JMPENV_JUMP(3); \
} \
PL_op = nxt; \
SPAGAIN; \
} while (0)
#define PP_ENTERTRY(label) \
STMT_START { \
int ret; \
JMPENV_PUSH(ret); \
switch (ret) { \
case 1: JMPENV_POP; JMPENV_JUMP(1);\
case 2: JMPENV_POP; JMPENV_JUMP(2);\
case 3: JMPENV_POP; SPAGAIN; goto label;\
} \
} STMT_END
#else /* 5.6 and 5.8 */
#define PP_EVAL(ppaddr, nxt) do { \
dJMPENV; \
int ret; \
PUTBACK; \
JMPENV_PUSH(ret); \
switch (ret) { \
case 0: \
PL_op = ppaddr(aTHX); \
PL_retstack[PL_retstack_ix - 1] = Nullop; \
if (PL_op != nxt) CALLRUNOPS(); \
JMPENV_POP; \
break; \
case 1: JMPENV_POP; JMPENV_JUMP(1); \
case 2: JMPENV_POP; JMPENV_JUMP(2); \
case 3: \
JMPENV_POP; \
if (PL_restartop && PL_restartop != nxt) \
JMPENV_JUMP(3); \
} \
PL_op = nxt; \
SPAGAIN; \
} while (0)
#define PP_ENTERTRY(jmpbuf,label) \
STMT_START { \
int ret; \
JMPENV_PUSH_ENV(jmpbuf,ret); \
switch (ret) { \
case 1: JMPENV_POP_ENV(jmpbuf); JMPENV_JUMP(1);\
case 2: JMPENV_POP_ENV(jmpbuf); JMPENV_JUMP(2);\
case 3: JMPENV_POP_ENV(jmpbuf); SPAGAIN; goto label;\
} \
} STMT_END
#endif
#define PP_LEAVETRY \
STMT_START { PL_top_env = PL_top_env->je_prev; } STMT_END