separate nlist instructions from clist

This commit is contained in:
Kyryl Melekhin
2021-10-19 20:38:09 +00:00
parent e6965856b2
commit 8046a29f1e

62
pike.c
View File

@@ -487,6 +487,39 @@ memcpy(s1->sub, nsub->sub, osubp / 2);) \
newsub(/*nop*/, /*nop*/) \ newsub(/*nop*/, /*nop*/) \
memcpy(s1->sub, nsub->sub, osubp); \ memcpy(s1->sub, nsub->sub, osubp); \
#define instclist(nn) \
case WBEG: \
if (((sp != s || sp != _sp) && isword(sp)) \
|| !isword(_sp)) \
deccheck(nn) \
npc++; goto rec##nn; \
case BOL: \
if (_sp != s) { \
if (!i && !clistidx) \
return 0; \
deccheck(nn) \
} \
npc++; goto rec##nn; \
#define instnlist(nn) \
case JMP: \
npc += 2 + npc[1]; \
goto rec##nn; \
case RSPLIT: \
onnlist(nn) \
npc += 2; \
pcs[i] = npc; \
npc += npc[-1]; \
fastrec(nn, nlist, nlistidx) \
case WEND: \
if (isword(_sp)) \
deccheck(nn) \
npc++; goto rec##nn; \
case EOL: \
if (*_sp) \
deccheck(nn) \
npc++; goto rec##nn; \
#define addthread(nn, list, listidx) \ #define addthread(nn, list, listidx) \
{ \ { \
int i = 0; \ int i = 0; \
@@ -504,20 +537,11 @@ memcpy(s1->sub, nsub->sub, osubp); \
} \ } \
next##nn: \ next##nn: \
switch(*npc) { \ switch(*npc) { \
case JMP: \
npc += 2 + npc[1]; \
goto rec##nn; \
case SPLIT: \ case SPLIT: \
on##list(nn) \ on##list(nn) \
npc += 2; \ npc += 2; \
pcs[i] = npc + npc[-1]; \ pcs[i] = npc + npc[-1]; \
fastrec(nn, list, listidx) \ fastrec(nn, list, listidx) \
case RSPLIT: \
on##list(nn) \
npc += 2; \
pcs[i] = npc; \
npc += npc[-1]; \
fastrec(nn, list, listidx) \
case SAVE: \ case SAVE: \
if (nsub->ref > 1) { \ if (nsub->ref > 1) { \
nsub->ref--; \ nsub->ref--; \
@@ -528,27 +552,9 @@ memcpy(s1->sub, nsub->sub, osubp); \
nsub->sub[npc[1]] = _sp; \ nsub->sub[npc[1]] = _sp; \
npc += 2; \ npc += 2; \
goto rec##nn; \ goto rec##nn; \
case WBEG: \ inst##list(nn) \
if (((sp != s || sp != _sp) && isword(sp)) \
|| !isword(_sp)) \
deccheck(nn) \
npc++; goto rec##nn; \
case WEND: \
if (isword(_sp)) \
deccheck(nn) \
npc++; goto rec##nn; \
case BOL: \
if (_sp != s) { \
if (!i && !listidx) \
return 0; \
deccheck(nn) \
} \ } \
npc++; goto rec##nn; \
case EOL: \
if (*_sp) \
deccheck(nn) \ deccheck(nn) \
npc++; goto rec##nn; \
} \
} \ } \
int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp) int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)