Git-Raw
view release on metacpan or search on metacpan
deps/libgit2/deps/pcre/pcre_jit_compile.c view on Meta::CPAN
{
common->private_data_ptrs[(cc + 1) - common->start] = *private_data_start;
if (common->fast_fail_start_ptr == 0)
common->fast_fail_start_ptr = *private_data_start;
*private_data_start += sizeof(sljit_sw);
common->fast_fail_end_ptr = *private_data_start;
if (*private_data_start > SLJIT_MAX_LOCAL_SIZE)
return;
}
cc = next_alt;
}
while (*cc == OP_ALT);
}
static int get_class_iterator_size(pcre_uchar *cc)
{
sljit_u32 min;
sljit_u32 max;
switch(*cc)
{
case OP_CRSTAR:
case OP_CRPLUS:
return 2;
case OP_CRMINSTAR:
case OP_CRMINPLUS:
case OP_CRQUERY:
case OP_CRMINQUERY:
return 1;
case OP_CRRANGE:
case OP_CRMINRANGE:
min = GET2(cc, 1);
max = GET2(cc, 1 + IMM2_SIZE);
if (max == 0)
return (*cc == OP_CRRANGE) ? 2 : 1;
max -= min;
if (max > 2)
max = 2;
return max;
default:
return 0;
}
}
static BOOL detect_repeat(compiler_common *common, pcre_uchar *begin)
{
pcre_uchar *end = bracketend(begin);
pcre_uchar *next;
pcre_uchar *next_end;
pcre_uchar *max_end;
pcre_uchar type;
sljit_sw length = end - begin;
int min, max, i;
/* Detect fixed iterations first. */
if (end[-(1 + LINK_SIZE)] != OP_KET)
return FALSE;
/* Already detected repeat. */
if (common->private_data_ptrs[end - common->start - LINK_SIZE] != 0)
return TRUE;
next = end;
min = 1;
while (1)
{
if (*next != *begin)
break;
next_end = bracketend(next);
if (next_end - next != length || memcmp(begin, next, IN_UCHARS(length)) != 0)
break;
next = next_end;
min++;
}
if (min == 2)
return FALSE;
max = 0;
max_end = next;
if (*next == OP_BRAZERO || *next == OP_BRAMINZERO)
{
type = *next;
while (1)
{
if (next[0] != type || next[1] != OP_BRA || next[2 + LINK_SIZE] != *begin)
break;
next_end = bracketend(next + 2 + LINK_SIZE);
if (next_end - next != (length + 2 + LINK_SIZE) || memcmp(begin, next + 2 + LINK_SIZE, IN_UCHARS(length)) != 0)
break;
next = next_end;
max++;
}
if (next[0] == type && next[1] == *begin && max >= 1)
{
next_end = bracketend(next + 1);
if (next_end - next == (length + 1) && memcmp(begin, next + 1, IN_UCHARS(length)) == 0)
{
for (i = 0; i < max; i++, next_end += 1 + LINK_SIZE)
if (*next_end != OP_KET)
break;
if (i == max)
{
common->private_data_ptrs[max_end - common->start - LINK_SIZE] = next_end - max_end;
common->private_data_ptrs[max_end - common->start - LINK_SIZE + 1] = (type == OP_BRAZERO) ? OP_UPTO : OP_MINUPTO;
/* +2 the original and the last. */
common->private_data_ptrs[max_end - common->start - LINK_SIZE + 2] = max + 2;
if (min == 1)
return TRUE;
min--;
max_end -= (1 + LINK_SIZE) + GET(max_end, -LINK_SIZE);
}
}
( run in 1.235 second using v1.01-cache-2.11-cpan-140bd7fdf52 )