use memcpy
compiler assumes there might be overlap, this is incorrect. calling memcpy directly allows for better codegen
This commit is contained in:
10
pike.c
10
pike.c
@@ -480,12 +480,12 @@ subs[i++] = nsub; \
|
|||||||
goto next##nn; \
|
goto next##nn; \
|
||||||
|
|
||||||
#define saveclist() \
|
#define saveclist() \
|
||||||
newsub(for (j = 0; j < nsubp; j++) s1->sub[j] = nsub->sub[j];, \
|
newsub(memcpy(s1->sub, nsub->sub, osubp);, \
|
||||||
for (j = 0; j < nsubp / 2 - 1; j++) s1->sub[j] = nsub->sub[j];) \
|
memcpy(s1->sub, nsub->sub, osubp / 2);) \
|
||||||
|
|
||||||
#define savenlist() \
|
#define savenlist() \
|
||||||
newsub(/*nop*/, /*nop*/) \
|
newsub(/*nop*/, /*nop*/) \
|
||||||
for (j = 0; j < nsubp; j++) s1->sub[j] = nsub->sub[j]; \
|
memcpy(s1->sub, nsub->sub, osubp); \
|
||||||
|
|
||||||
#define onnlist(nn) \
|
#define onnlist(nn) \
|
||||||
if (npc[2] == gen) \
|
if (npc[2] == gen) \
|
||||||
@@ -562,7 +562,7 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
|
|||||||
{
|
{
|
||||||
int rsubsize = sizeof(rsub)+(sizeof(char*)*nsubp);
|
int rsubsize = sizeof(rsub)+(sizeof(char*)*nsubp);
|
||||||
int i, j, c, gen, suboff = rsubsize, *npc;
|
int i, j, c, gen, suboff = rsubsize, *npc;
|
||||||
int clistidx = 0, nlistidx = 0;
|
int clistidx = 0, nlistidx = 0, osubp = nsubp * sizeof(char*);
|
||||||
const char *sp = s, *_sp = s;
|
const char *sp = s, *_sp = s;
|
||||||
int *insts = prog->insts;
|
int *insts = prog->insts;
|
||||||
int *pcs[prog->splits];
|
int *pcs[prog->splits];
|
||||||
@@ -611,7 +611,7 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
|
|||||||
nlistidx = 0;
|
nlistidx = 0;
|
||||||
if (!matched) {
|
if (!matched) {
|
||||||
jmp_start:
|
jmp_start:
|
||||||
newsub(for (i = 1; i < nsubp; i++) s1->sub[i] = NULL;, /*nop*/)
|
newsub(memset(s1->sub, 0, osubp);, /*nop*/)
|
||||||
s1->ref = 1;
|
s1->ref = 1;
|
||||||
s1->sub[0] = _sp;
|
s1->sub[0] = _sp;
|
||||||
nsub = s1;
|
nsub = s1;
|
||||||
|
|||||||
Reference in New Issue
Block a user