/[pcre]/code/trunk/pcre_jit_compile.c
ViewVC logotype

Diff of /code/trunk/pcre_jit_compile.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 929 by zherczeg, Fri Feb 24 11:07:47 2012 UTC revision 958 by zherczeg, Wed Apr 11 10:19:10 2012 UTC
# Line 272  typedef struct compiler_common { Line 272  typedef struct compiler_common {
272    struct sljit_compiler *compiler;    struct sljit_compiler *compiler;
273    pcre_uchar *start;    pcre_uchar *start;
274    
275    /* Local stack area size and variable pointers. */    /* Opcode local area direct map. */
   int localsize;  
276    int *localptrs;    int *localptrs;
277    int cbraptr;    int cbraptr;
278    /* OVector starting point. Must be divisible by 2. */    /* OVector starting point. Must be divisible by 2. */
# Line 307  typedef struct compiler_common { Line 306  typedef struct compiler_common {
306    
307    /* Labels and jump lists. */    /* Labels and jump lists. */
308    struct sljit_label *partialmatchlabel;    struct sljit_label *partialmatchlabel;
309      struct sljit_label *leavelabel;
310    struct sljit_label *acceptlabel;    struct sljit_label *acceptlabel;
311    stub_list *stubs;    stub_list *stubs;
312    recurse_entry *entries;    recurse_entry *entries;
313    recurse_entry *currententry;    recurse_entry *currententry;
314    jump_list *partialmatch;    jump_list *partialmatch;
315      jump_list *leave;
316    jump_list *accept;    jump_list *accept;
317    jump_list *calllimit;    jump_list *calllimit;
318    jump_list *stackalloc;    jump_list *stackalloc;
# Line 446  the start pointers when the end of the c Line 447  the start pointers when the end of the c
447    sljit_set_label(sljit_emit_cmp(compiler, (type), (src1), (src1w), (src2), (src2w)), (label))    sljit_set_label(sljit_emit_cmp(compiler, (type), (src1), (src1w), (src2), (src2w)), (label))
448  #define COND_VALUE(op, dst, dstw, type) \  #define COND_VALUE(op, dst, dstw, type) \
449    sljit_emit_cond_value(compiler, (op), (dst), (dstw), (type))    sljit_emit_cond_value(compiler, (op), (dst), (dstw), (type))
450    #define GET_LOCAL_BASE(dst, dstw, offset) \
451      sljit_get_local_base(compiler, (dst), (dstw), (offset))
452    
453  static pcre_uchar* bracketend(pcre_uchar* cc)  static pcre_uchar* bracketend(pcre_uchar* cc)
454  {  {
# Line 517  switch(*cc) Line 520  switch(*cc)
520    case OP_BRAZERO:    case OP_BRAZERO:
521    case OP_BRAMINZERO:    case OP_BRAMINZERO:
522    case OP_BRAPOSZERO:    case OP_BRAPOSZERO:
523      case OP_COMMIT:
524    case OP_FAIL:    case OP_FAIL:
525    case OP_ACCEPT:    case OP_ACCEPT:
526    case OP_ASSERT_ACCEPT:    case OP_ASSERT_ACCEPT:
# Line 1322  if (length < 8) Line 1326  if (length < 8)
1326    }    }
1327  else  else
1328    {    {
1329    OP2(SLJIT_ADD, SLJIT_TEMPORARY_REG2, 0, SLJIT_LOCALS_REG, 0, SLJIT_IMM, OVECTOR_START - sizeof(sljit_w));    GET_LOCAL_BASE(SLJIT_TEMPORARY_REG2, 0, OVECTOR_START - sizeof(sljit_w));
1330    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG3, 0, SLJIT_IMM, length);    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG3, 0, SLJIT_IMM, length);
1331    loop = LABEL();    loop = LABEL();
1332    OP1(SLJIT_MOVU, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), sizeof(sljit_w), SLJIT_TEMPORARY_REG1, 0);    OP1(SLJIT_MOVU, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), sizeof(sljit_w), SLJIT_TEMPORARY_REG1, 0);
# Line 1349  if (common->mark_ptr != 0) Line 1353  if (common->mark_ptr != 0)
1353    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_TEMPORARY_REG1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_TEMPORARY_REG3, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_TEMPORARY_REG1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_TEMPORARY_REG3, 0);
1354  OP2(SLJIT_SUB, SLJIT_TEMPORARY_REG3, 0, SLJIT_MEM1(SLJIT_TEMPORARY_REG1), SLJIT_OFFSETOF(jit_arguments, offsets), SLJIT_IMM, sizeof(int));  OP2(SLJIT_SUB, SLJIT_TEMPORARY_REG3, 0, SLJIT_MEM1(SLJIT_TEMPORARY_REG1), SLJIT_OFFSETOF(jit_arguments, offsets), SLJIT_IMM, sizeof(int));
1355  OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG1, 0, SLJIT_MEM1(SLJIT_TEMPORARY_REG1), SLJIT_OFFSETOF(jit_arguments, begin));  OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG1, 0, SLJIT_MEM1(SLJIT_TEMPORARY_REG1), SLJIT_OFFSETOF(jit_arguments, begin));
1356  OP2(SLJIT_ADD, SLJIT_SAVED_REG1, 0, SLJIT_LOCALS_REG, 0, SLJIT_IMM, OVECTOR_START);  GET_LOCAL_BASE(SLJIT_SAVED_REG1, 0, OVECTOR_START);
1357  /* Unlikely, but possible */  /* Unlikely, but possible */
1358  earlyexit = CMP(SLJIT_C_EQUAL, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, 0);  earlyexit = CMP(SLJIT_C_EQUAL, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, 0);
1359  loop = LABEL();  loop = LABEL();
# Line 1367  JUMPHERE(earlyexit); Line 1371  JUMPHERE(earlyexit);
1371  /* Calculate the return value, which is the maximum ovector value. */  /* Calculate the return value, which is the maximum ovector value. */
1372  if (topbracket > 1)  if (topbracket > 1)
1373    {    {
1374    OP2(SLJIT_ADD, SLJIT_TEMPORARY_REG1, 0, SLJIT_LOCALS_REG, 0, SLJIT_IMM, OVECTOR_START + topbracket * 2 * sizeof(sljit_w));    GET_LOCAL_BASE(SLJIT_TEMPORARY_REG1, 0, OVECTOR_START + topbracket * 2 * sizeof(sljit_w));
1375    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, topbracket + 1);    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, topbracket + 1);
1376    
1377    /* OVECTOR(0) is never equal to SLJIT_SAVED_REG3. */    /* OVECTOR(0) is never equal to SLJIT_SAVED_REG3. */
# Line 1820  of the character (>= 0xc0). Return char Line 1824  of the character (>= 0xc0). Return char
1824  DEFINE_COMPILER;  DEFINE_COMPILER;
1825  struct sljit_jump *jump;  struct sljit_jump *jump;
1826    
1827  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
1828  /* Searching for the first zero. */  /* Searching for the first zero. */
1829  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);
1830  jump = JUMP(SLJIT_C_NOT_ZERO);  jump = JUMP(SLJIT_C_NOT_ZERO);
# Line 1879  DEFINE_COMPILER; Line 1883  DEFINE_COMPILER;
1883  struct sljit_jump *jump;  struct sljit_jump *jump;
1884  struct sljit_jump *compare;  struct sljit_jump *compare;
1885    
1886  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
1887    
1888  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x20);  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x20);
1889  jump = JUMP(SLJIT_C_NOT_ZERO);  jump = JUMP(SLJIT_C_NOT_ZERO);
# Line 1916  of the character (>= 0xd800). Return cha Line 1920  of the character (>= 0xd800). Return cha
1920  DEFINE_COMPILER;  DEFINE_COMPILER;
1921  struct sljit_jump *jump;  struct sljit_jump *jump;
1922    
1923  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
1924  jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xdc00);  jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xdc00);
1925  /* Do nothing, only return. */  /* Do nothing, only return. */
1926  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
# Line 1953  DEFINE_COMPILER; Line 1957  DEFINE_COMPILER;
1957    
1958  SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && sizeof(ucd_record) == 8);  SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && sizeof(ucd_record) == 8);
1959    
1960  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
1961  OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);  OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
1962  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_w)PRIV(ucd_stage1));  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_w)PRIV(ucd_stage1));
1963  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
# Line 2381  DEFINE_COMPILER; Line 2385  DEFINE_COMPILER;
2385  struct sljit_jump *jump;  struct sljit_jump *jump;
2386  struct sljit_label *mainloop;  struct sljit_label *mainloop;
2387    
2388  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
2389  OP1(SLJIT_MOV, TMP1, 0, STACK_TOP, 0);  OP1(SLJIT_MOV, TMP1, 0, STACK_TOP, 0);
2390    GET_LOCAL_BASE(TMP3, 0, 0);
2391    
2392  /* Drop frames until we reach STACK_TOP. */  /* Drop frames until we reach STACK_TOP. */
2393  mainloop = LABEL();  mainloop = LABEL();
2394  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), 0);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), 0);
2395  jump = CMP(SLJIT_C_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, frame_end);  jump = CMP(SLJIT_C_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, frame_end);
2396  OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, SLJIT_LOCALS_REG, 0);  OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP3, 0);
2397  OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_w));  OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_w));
2398  OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_w), SLJIT_MEM1(TMP1), 2 * sizeof(sljit_w));  OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_w), SLJIT_MEM1(TMP1), 2 * sizeof(sljit_w));
2399  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_w));  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_w));
# Line 2434  struct sljit_jump *jump; Line 2439  struct sljit_jump *jump;
2439    
2440  SLJIT_COMPILE_ASSERT(ctype_word == 0x10, ctype_word_must_be_16);  SLJIT_COMPILE_ASSERT(ctype_word == 0x10, ctype_word_must_be_16);
2441    
2442  sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);
2443  /* Get type of the previous char, and put it to LOCALS1. */  /* Get type of the previous char, and put it to LOCALS1. */
2444  OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);  OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
2445  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
# Line 2537  static void check_anynewline(compiler_co Line 2542  static void check_anynewline(compiler_co
2542  /* Check whether TMP1 contains a newline character. TMP2 destroyed. */  /* Check whether TMP1 contains a newline character. TMP2 destroyed. */
2543  DEFINE_COMPILER;  DEFINE_COMPILER;
2544    
2545  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
2546    
2547  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);
2548  OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);  OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
# Line 2564  static void check_hspace(compiler_common Line 2569  static void check_hspace(compiler_common
2569  /* Check whether TMP1 contains a newline character. TMP2 destroyed. */  /* Check whether TMP1 contains a newline character. TMP2 destroyed. */
2570  DEFINE_COMPILER;  DEFINE_COMPILER;
2571    
2572  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
2573    
2574  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x09);  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x09);
2575  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_EQUAL);  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_EQUAL);
# Line 2603  static void check_vspace(compiler_common Line 2608  static void check_vspace(compiler_common
2608  /* Check whether TMP1 contains a newline character. TMP2 destroyed. */  /* Check whether TMP1 contains a newline character. TMP2 destroyed. */
2609  DEFINE_COMPILER;  DEFINE_COMPILER;
2610    
2611  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
2612    
2613  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);
2614  OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);  OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
# Line 2635  DEFINE_COMPILER; Line 2640  DEFINE_COMPILER;
2640  struct sljit_jump *jump;  struct sljit_jump *jump;
2641  struct sljit_label *label;  struct sljit_label *label;
2642    
2643  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
2644  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
2645  OP1(SLJIT_MOV, TMP3, 0, CHAR1, 0);  OP1(SLJIT_MOV, TMP3, 0, CHAR1, 0);
2646  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, CHAR2, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, CHAR2, 0);
# Line 2664  DEFINE_COMPILER; Line 2669  DEFINE_COMPILER;
2669  struct sljit_jump *jump;  struct sljit_jump *jump;
2670  struct sljit_label *label;  struct sljit_label *label;
2671    
2672  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
2673  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
2674    
2675  OP1(SLJIT_MOV, TMP3, 0, LCC_TABLE, 0);  OP1(SLJIT_MOV, TMP3, 0, LCC_TABLE, 0);
# Line 3743  switch(type) Line 3748  switch(type)
3748    
3749    case OP_REVERSE:    case OP_REVERSE:
3750    length = GET(cc, 0);    length = GET(cc, 0);
3751    SLJIT_ASSERT(length > 0);    if (length == 0)
3752        return cc + LINK_SIZE;
3753    OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);    OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
3754  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
3755    if (common->utf)    if (common->utf)
# Line 4159  if (common->has_set_som && common->mark_ Line 4165  if (common->has_set_som && common->mark_
4165    }    }
4166  else if (common->has_set_som || common->mark_ptr != 0)  else if (common->has_set_som || common->mark_ptr != 0)
4167    {    {
4168    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->has_set_som ? (OVECTOR(0)) : common->mark_ptr);    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->has_set_som ? (int)(OVECTOR(0)) : common->mark_ptr);
4169    allocate_stack(common, 1);    allocate_stack(common, 1);
4170    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
4171    }    }
# Line 4186  jump_list *tmp = NULL; Line 4192  jump_list *tmp = NULL;
4192  jump_list **target = (conditional) ? &fallback->condfailed : &fallback->common.topfallbacks;  jump_list **target = (conditional) ? &fallback->condfailed : &fallback->common.topfallbacks;
4193  jump_list **found;  jump_list **found;
4194  /* Saving previous accept variables. */  /* Saving previous accept variables. */
4195    struct sljit_label *save_leavelabel = common->leavelabel;
4196  struct sljit_label *save_acceptlabel = common->acceptlabel;  struct sljit_label *save_acceptlabel = common->acceptlabel;
4197    jump_list *save_leave = common->leave;
4198    jump_list *save_accept = common->accept;
4199  struct sljit_jump *jump;  struct sljit_jump *jump;
4200  struct sljit_jump *brajump = NULL;  struct sljit_jump *brajump = NULL;
 jump_list *save_accept = common->accept;  
4201    
4202  if (*cc == OP_BRAZERO || *cc == OP_BRAMINZERO)  if (*cc == OP_BRAZERO || *cc == OP_BRAMINZERO)
4203    {    {
# Line 4234  else Line 4242  else
4242    }    }
4243    
4244  memset(&altfallback, 0, sizeof(fallback_common));  memset(&altfallback, 0, sizeof(fallback_common));
4245    common->leavelabel = NULL;
4246    common->leave = NULL;
4247  while (1)  while (1)
4248    {    {
4249    common->acceptlabel = NULL;    common->acceptlabel = NULL;
# Line 4248  while (1) Line 4258  while (1)
4258    compile_hotpath(common, ccbegin + 1 + LINK_SIZE, cc, &altfallback);    compile_hotpath(common, ccbegin + 1 + LINK_SIZE, cc, &altfallback);
4259    if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))    if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
4260      {      {
4261        common->leavelabel = save_leavelabel;
4262      common->acceptlabel = save_acceptlabel;      common->acceptlabel = save_acceptlabel;
4263        common->leave = save_leave;
4264      common->accept = save_accept;      common->accept = save_accept;
4265      return NULL;      return NULL;
4266      }      }
# Line 4301  while (1) Line 4313  while (1)
4313    compile_fallbackpath(common, altfallback.top);    compile_fallbackpath(common, altfallback.top);
4314    if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))    if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
4315      {      {
4316        common->leavelabel = save_leavelabel;
4317      common->acceptlabel = save_acceptlabel;      common->acceptlabel = save_acceptlabel;
4318        common->leave = save_leave;
4319      common->accept = save_accept;      common->accept = save_accept;
4320      return NULL;      return NULL;
4321      }      }
# Line 4314  while (1) Line 4328  while (1)
4328    cc += GET(cc, 1);    cc += GET(cc, 1);
4329    }    }
4330  /* None of them matched. */  /* None of them matched. */
4331    if (common->leave != NULL)
4332      set_jumps(common->leave, LABEL());
4333    
4334  if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK)  if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK)
4335    {    {
# Line 4438  else Line 4454  else
4454      }      }
4455    }    }
4456    
4457    common->leavelabel = save_leavelabel;
4458  common->acceptlabel = save_acceptlabel;  common->acceptlabel = save_acceptlabel;
4459    common->leave = save_leave;
4460  common->accept = save_accept;  common->accept = save_accept;
4461  return cc + 1 + LINK_SIZE;  return cc + 1 + LINK_SIZE;
4462  }  }
# Line 4855  if (opcode == OP_COND || opcode == OP_SC Line 4873  if (opcode == OP_COND || opcode == OP_SC
4873      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, SLJIT_IMM, common->name_count);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, SLJIT_IMM, common->name_count);
4874      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, SLJIT_IMM, common->name_entry_size);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, SLJIT_IMM, common->name_entry_size);
4875      OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG1, 0, SLJIT_IMM, (stacksize << 8) | (common->ovector_start / sizeof(sljit_w)));      OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG1, 0, SLJIT_IMM, (stacksize << 8) | (common->ovector_start / sizeof(sljit_w)));
4876      OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, SLJIT_LOCALS_REG, 0);      GET_LOCAL_BASE(SLJIT_TEMPORARY_REG2, 0, 0);
4877      OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG3, 0, SLJIT_IMM, common->name_table);      OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG3, 0, SLJIT_IMM, common->name_table);
4878      sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_searchovector));      sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_searchovector));
4879      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1);      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1);
# Line 4905  if (opcode == OP_COND || opcode == OP_SC Line 4923  if (opcode == OP_COND || opcode == OP_SC
4923        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, SLJIT_IMM, common->name_entry_size);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, SLJIT_IMM, common->name_entry_size);
4924        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, SLJIT_IMM, GET2(common->start, common->currententry->start + 1 + LINK_SIZE));        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, SLJIT_IMM, GET2(common->start, common->currententry->start + 1 + LINK_SIZE));
4925        OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG1, 0, SLJIT_IMM, stacksize);        OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG1, 0, SLJIT_IMM, stacksize);
4926        OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, SLJIT_LOCALS_REG, 0);        GET_LOCAL_BASE(SLJIT_TEMPORARY_REG2, 0, 0);
4927        OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG3, 0, SLJIT_IMM, common->name_table);        OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG3, 0, SLJIT_IMM, common->name_table);
4928        sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_searchgroups));        sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_searchgroups));
4929        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1);        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1);
# Line 5810  while (cc < ccend) Line 5828  while (cc < ccend)
5828      cc += 1 + 2 + cc[1];      cc += 1 + 2 + cc[1];
5829      break;      break;
5830    
5831        case OP_COMMIT:
5832        PUSH_FALLBACK_NOVALUE(sizeof(fallback_common), cc);
5833        cc += 1;
5834        break;
5835    
5836      case OP_FAIL:      case OP_FAIL:
5837      case OP_ACCEPT:      case OP_ACCEPT:
5838      case OP_ASSERT_ACCEPT:      case OP_ASSERT_ACCEPT:
# Line 6016  else if (common->has_set_som || common-> Line 6039  else if (common->has_set_som || common->
6039    {    {
6040    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0));    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
6041    free_stack(common, 1);    free_stack(common, 1);
6042    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->has_set_som ? (OVECTOR(0)) : common->mark_ptr, TMP2, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->has_set_som ? (int)(OVECTOR(0)) : common->mark_ptr, TMP2, 0);
6043    }    }
6044  }  }
6045    
# Line 6659  while (current) Line 6682  while (current)
6682      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, TMP1, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, TMP1, 0);
6683      break;      break;
6684    
6685        case OP_COMMIT:
6686        OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_NOMATCH);
6687        if (common->leavelabel == NULL)
6688          add_jump(compiler, &common->leave, JUMP(SLJIT_JUMP));
6689        else
6690          JUMPTO(SLJIT_JUMP, common->leavelabel);
6691        break;
6692    
6693      case OP_FAIL:      case OP_FAIL:
6694      case OP_ACCEPT:      case OP_ACCEPT:
6695      case OP_ASSERT_ACCEPT:      case OP_ASSERT_ACCEPT:
# Line 6684  int framesize = get_framesize(common, cc Line 6715  int framesize = get_framesize(common, cc
6715  int alternativesize;  int alternativesize;
6716  BOOL needsframe;  BOOL needsframe;
6717  fallback_common altfallback;  fallback_common altfallback;
6718    struct sljit_label *save_leavelabel = common->leavelabel;
6719    jump_list *save_leave = common->leave;
6720  struct sljit_jump *jump;  struct sljit_jump *jump;
6721    
6722  SLJIT_ASSERT(*cc == OP_BRA || *cc == OP_CBRA || *cc == OP_CBRAPOS || *cc == OP_SCBRA || *cc == OP_SCBRAPOS);  SLJIT_ASSERT(*cc == OP_BRA || *cc == OP_CBRA || *cc == OP_CBRAPOS || *cc == OP_SCBRA || *cc == OP_SCBRAPOS);
# Line 6696  SLJIT_ASSERT(common->currententry->entry Line 6729  SLJIT_ASSERT(common->currententry->entry
6729  common->currententry->entry = LABEL();  common->currententry->entry = LABEL();
6730  set_jumps(common->currententry->calls, common->currententry->entry);  set_jumps(common->currententry->calls, common->currententry->entry);
6731    
6732  sljit_emit_fast_enter(compiler, TMP2, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, TMP2, 0);
6733  allocate_stack(common, localsize + framesize + alternativesize);  allocate_stack(common, localsize + framesize + alternativesize);
6734  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(localsize + framesize + alternativesize - 1), TMP2, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(localsize + framesize + alternativesize - 1), TMP2, 0);
6735  copy_locals(common, ccbegin, ccend, TRUE, localsize + framesize + alternativesize, framesize + alternativesize);  copy_locals(common, ccbegin, ccend, TRUE, localsize + framesize + alternativesize, framesize + alternativesize);
# Line 6708  if (alternativesize > 0) Line 6741  if (alternativesize > 0)
6741    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
6742    
6743  memset(&altfallback, 0, sizeof(fallback_common));  memset(&altfallback, 0, sizeof(fallback_common));
6744    common->leavelabel = NULL;
6745  common->acceptlabel = NULL;  common->acceptlabel = NULL;
6746    common->leave = NULL;
6747  common->accept = NULL;  common->accept = NULL;
6748  altfallback.cc = ccbegin;  altfallback.cc = ccbegin;
6749  cc += GET(cc, 1);  cc += GET(cc, 1);
# Line 6722  while (1) Line 6757  while (1)
6757    
6758    compile_hotpath(common, altfallback.cc, cc, &altfallback);    compile_hotpath(common, altfallback.cc, cc, &altfallback);
6759    if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))    if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
6760        {
6761        common->leavelabel = save_leavelabel;
6762        common->leave = save_leave;
6763      return;      return;
6764        }
6765    
6766    add_jump(compiler, &common->accept, JUMP(SLJIT_JUMP));    add_jump(compiler, &common->accept, JUMP(SLJIT_JUMP));
6767    
6768    compile_fallbackpath(common, altfallback.top);    compile_fallbackpath(common, altfallback.top);
6769    if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))    if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
6770        {
6771        common->leavelabel = save_leavelabel;
6772        common->leave = save_leave;
6773      return;      return;
6774        }
6775    set_jumps(altfallback.topfallbacks, LABEL());    set_jumps(altfallback.topfallbacks, LABEL());
6776    
6777    if (*cc != OP_ALT)    if (*cc != OP_ALT)
# Line 6738  while (1) Line 6781  while (1)
6781    cc += GET(cc, 1);    cc += GET(cc, 1);
6782    }    }
6783  /* None of them matched. */  /* None of them matched. */
6784    if (common->leave != NULL)
6785      set_jumps(common->leave, LABEL());
6786    
6787  OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 0);  OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 0);
6788  jump = JUMP(SLJIT_JUMP);  jump = JUMP(SLJIT_JUMP);
6789    
# Line 6758  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK Line 6804  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK
6804  OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);  OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
6805  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head, TMP2, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head, TMP2, 0);
6806  sljit_emit_fast_return(compiler, SLJIT_MEM1(STACK_TOP), 0);  sljit_emit_fast_return(compiler, SLJIT_MEM1(STACK_TOP), 0);
6807    
6808    common->leavelabel = save_leavelabel;
6809    common->leave = save_leave;
6810  }  }
6811    
6812  #undef COMPILE_FALLBACKPATH  #undef COMPILE_FALLBACKPATH
# Line 6772  compiler_common common_data; Line 6821  compiler_common common_data;
6821  compiler_common *common = &common_data;  compiler_common *common = &common_data;
6822  const pcre_uint8 *tables = re->tables;  const pcre_uint8 *tables = re->tables;
6823  pcre_study_data *study;  pcre_study_data *study;
6824    int localsize;
6825  pcre_uchar *ccend;  pcre_uchar *ccend;
6826  executable_functions *functions;  executable_functions *functions;
6827  void *executable_func;  void *executable_func;
6828  sljit_uw executable_size;  sljit_uw executable_size;
 struct sljit_label *leave;  
6829  struct sljit_label *mainloop = NULL;  struct sljit_label *mainloop = NULL;
6830  struct sljit_label *empty_match_found;  struct sljit_label *empty_match_found;
6831  struct sljit_label *empty_match_fallback;  struct sljit_label *empty_match_fallback;
# Line 6849  ccend = bracketend(rootfallback.cc); Line 6898  ccend = bracketend(rootfallback.cc);
6898  common->ovector_start = CALL_LIMIT + sizeof(sljit_w);  common->ovector_start = CALL_LIMIT + sizeof(sljit_w);
6899    
6900  SLJIT_ASSERT(*rootfallback.cc == OP_BRA && ccend[-(1 + LINK_SIZE)] == OP_KET);  SLJIT_ASSERT(*rootfallback.cc == OP_BRA && ccend[-(1 + LINK_SIZE)] == OP_KET);
6901  common->localsize = get_localspace(common, rootfallback.cc, ccend);  localsize = get_localspace(common, rootfallback.cc, ccend);
6902  if (common->localsize < 0)  if (localsize < 0)
6903    return;    return;
6904    
6905  /* Checking flags and updating ovector_start. */  /* Checking flags and updating ovector_start. */
6906  if (mode == JIT_COMPILE && (re->flags & PCRE_REQCHSET) != 0)  if (mode == JIT_COMPILE && (re->flags & PCRE_REQCHSET) != 0 && (re->options & PCRE_NO_START_OPTIMIZE) == 0)
6907    {    {
6908    common->req_char_ptr = common->ovector_start;    common->req_char_ptr = common->ovector_start;
6909    common->ovector_start += sizeof(sljit_w);    common->ovector_start += sizeof(sljit_w);
# Line 6881  if ((common->ovector_start & sizeof(slji Line 6930  if ((common->ovector_start & sizeof(slji
6930    
6931  SLJIT_ASSERT(!(common->req_char_ptr != 0 && common->start_used_ptr != 0));  SLJIT_ASSERT(!(common->req_char_ptr != 0 && common->start_used_ptr != 0));
6932  common->cbraptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_w);  common->cbraptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_w);
6933  common->localsize += common->cbraptr + (re->top_bracket + 1) * sizeof(sljit_w);  localsize += common->cbraptr + (re->top_bracket + 1) * sizeof(sljit_w);
6934  if (common->localsize > SLJIT_MAX_LOCAL_SIZE)  if (localsize > SLJIT_MAX_LOCAL_SIZE)
6935    return;    return;
6936  common->localptrs = (int *)SLJIT_MALLOC((ccend - rootfallback.cc) * sizeof(int));  common->localptrs = (int *)SLJIT_MALLOC((ccend - rootfallback.cc) * sizeof(int));
6937  if (!common->localptrs)  if (!common->localptrs)
# Line 6899  if (!compiler) Line 6948  if (!compiler)
6948  common->compiler = compiler;  common->compiler = compiler;
6949    
6950  /* Main pcre_jit_exec entry. */  /* Main pcre_jit_exec entry. */
6951  sljit_emit_enter(compiler, 1, 5, 5, common->localsize);  sljit_emit_enter(compiler, 1, 5, 5, localsize);
6952    
6953  /* Register init. */  /* Register init. */
6954  reset_ovector(common, (re->top_bracket + 1) * 2);  reset_ovector(common, (re->top_bracket + 1) * 2);
6955  if (mode == JIT_COMPILE && (re->flags & PCRE_REQCHSET) != 0)  if (common->req_char_ptr != 0)
6956    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->req_char_ptr, SLJIT_TEMPORARY_REG1, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->req_char_ptr, SLJIT_TEMPORARY_REG1, 0);
6957    
6958  OP1(SLJIT_MOV, ARGUMENTS, 0, SLJIT_SAVED_REG1, 0);  OP1(SLJIT_MOV, ARGUMENTS, 0, SLJIT_SAVED_REG1, 0);
# Line 6924  if ((re->options & PCRE_ANCHORED) == 0) Line 6973  if ((re->options & PCRE_ANCHORED) == 0)
6973    {    {
6974    mainloop = mainloop_entry(common, (re->flags & PCRE_HASCRORLF) != 0, (re->options & PCRE_FIRSTLINE) != 0);    mainloop = mainloop_entry(common, (re->flags & PCRE_HASCRORLF) != 0, (re->options & PCRE_FIRSTLINE) != 0);
6975    /* Forward search if possible. */    /* Forward search if possible. */
6976    if ((re->flags & PCRE_FIRSTSET) != 0)    if ((re->options & PCRE_NO_START_OPTIMIZE) == 0)
6977      fast_forward_first_char(common, (pcre_uchar)re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);      {
6978    else if ((re->flags & PCRE_STARTLINE) != 0)      if ((re->flags & PCRE_FIRSTSET) != 0)
6979      fast_forward_newline(common, (re->options & PCRE_FIRSTLINE) != 0);        fast_forward_first_char(common, (pcre_uchar)re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);
6980    else if ((re->flags & PCRE_STARTLINE) == 0 && study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)      else if ((re->flags & PCRE_STARTLINE) != 0)
6981      fast_forward_start_bits(common, (sljit_uw)study->start_bits, (re->options & PCRE_FIRSTLINE) != 0);        fast_forward_newline(common, (re->options & PCRE_FIRSTLINE) != 0);
6982        else if ((re->flags & PCRE_STARTLINE) == 0 && study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)
6983          fast_forward_start_bits(common, (sljit_uw)study->start_bits, (re->options & PCRE_FIRSTLINE) != 0);
6984        }
6985    }    }
6986  if (mode == JIT_COMPILE && (re->flags & PCRE_REQCHSET) != 0)  if (common->req_char_ptr != 0)
6987    reqbyte_notfound = search_requested_char(common, (pcre_uchar)re->req_char, (re->flags & PCRE_RCH_CASELESS) != 0, (re->flags & PCRE_FIRSTSET) != 0);    reqbyte_notfound = search_requested_char(common, (pcre_uchar)re->req_char, (re->flags & PCRE_RCH_CASELESS) != 0, (re->flags & PCRE_FIRSTSET) != 0);
6988    
6989  /* Store the current STR_PTR in OVECTOR(0). */  /* Store the current STR_PTR in OVECTOR(0). */
# Line 6967  if (common->accept != NULL) Line 7019  if (common->accept != NULL)
7019    
7020  /* This means we have a match. Update the ovector. */  /* This means we have a match. Update the ovector. */
7021  copy_ovector(common, re->top_bracket + 1);  copy_ovector(common, re->top_bracket + 1);
7022  leave = LABEL();  common->leavelabel = LABEL();
7023    if (common->leave != NULL)
7024      set_jumps(common->leave, common->leavelabel);
7025  sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);  sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
7026    
7027  if (mode != JIT_COMPILE)  if (mode != JIT_COMPILE)
7028    {    {
7029    common->partialmatchlabel = LABEL();    common->partialmatchlabel = LABEL();
7030    set_jumps(common->partialmatch, common->partialmatchlabel);    set_jumps(common->partialmatch, common->partialmatchlabel);
7031    return_with_partial_match(common, leave);    return_with_partial_match(common, common->leavelabel);
7032    }    }
7033    
7034  empty_match_fallback = LABEL();  empty_match_fallback = LABEL();
# Line 7005  if ((re->options & PCRE_ANCHORED) == 0) Line 7059  if ((re->options & PCRE_ANCHORED) == 0)
7059    {    {
7060    if ((re->options & PCRE_FIRSTLINE) == 0)    if ((re->options & PCRE_FIRSTLINE) == 0)
7061      {      {
7062      if (mode == JIT_COMPILE && study != NULL && study->minlength > 1)      if (mode == JIT_COMPILE && study != NULL && study->minlength > 1 && (re->options & PCRE_NO_START_OPTIMIZE) == 0)
7063        {        {
7064        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength + 1));        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength + 1));
7065        CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, STR_END, 0, mainloop);        CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, STR_END, 0, mainloop);
# Line 7016  if ((re->options & PCRE_ANCHORED) == 0) Line 7070  if ((re->options & PCRE_ANCHORED) == 0)
7070    else    else
7071      {      {
7072      SLJIT_ASSERT(common->first_line_end != 0);      SLJIT_ASSERT(common->first_line_end != 0);
7073      if (mode == JIT_COMPILE && study != NULL && study->minlength > 1)      if (mode == JIT_COMPILE && study != NULL && study->minlength > 1 && (re->options & PCRE_NO_START_OPTIMIZE) == 0)
7074        {        {
7075        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength + 1));        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength + 1));
7076        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, STR_END, 0);        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, STR_END, 0);
# Line 7038  if (mode == JIT_PARTIAL_SOFT_COMPILE) Line 7092  if (mode == JIT_PARTIAL_SOFT_COMPILE)
7092    CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), common->hit_start, SLJIT_IMM, 0, common->partialmatchlabel);    CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), common->hit_start, SLJIT_IMM, 0, common->partialmatchlabel);
7093    
7094  OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_NOMATCH);  OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_NOMATCH);
7095  JUMPTO(SLJIT_JUMP, leave);  JUMPTO(SLJIT_JUMP, common->leavelabel);
7096    
7097  flush_stubs(common);  flush_stubs(common);
7098    
# Line 7071  while (common->currententry != NULL) Line 7125  while (common->currententry != NULL)
7125  /* This is a (really) rare case. */  /* This is a (really) rare case. */
7126  set_jumps(common->stackalloc, LABEL());  set_jumps(common->stackalloc, LABEL());
7127  /* RETURN_ADDR is not a saved register. */  /* RETURN_ADDR is not a saved register. */
7128  sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);
7129  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, TMP2, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, TMP2, 0);
7130  OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);  OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
7131  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
# Line 7091  sljit_emit_fast_return(compiler, SLJIT_M Line 7145  sljit_emit_fast_return(compiler, SLJIT_M
7145  JUMPHERE(jump);  JUMPHERE(jump);
7146  /* We break the return address cache here, but this is a really rare case. */  /* We break the return address cache here, but this is a really rare case. */
7147  OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_JIT_STACKLIMIT);  OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_JIT_STACKLIMIT);
7148  JUMPTO(SLJIT_JUMP, leave);  JUMPTO(SLJIT_JUMP, common->leavelabel);
7149    
7150  /* Call limit reached. */  /* Call limit reached. */
7151  set_jumps(common->calllimit, LABEL());  set_jumps(common->calllimit, LABEL());
7152  OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_MATCHLIMIT);  OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_MATCHLIMIT);
7153  JUMPTO(SLJIT_JUMP, leave);  JUMPTO(SLJIT_JUMP, common->leavelabel);
7154    
7155  if (common->revertframes != NULL)  if (common->revertframes != NULL)
7156    {    {
# Line 7203  return convert_executable_func.call_exec Line 7257  return convert_executable_func.call_exec
7257  }  }
7258    
7259  int  int
7260  PRIV(jit_exec)(const REAL_PCRE *re, void *executable_funcs,  PRIV(jit_exec)(const REAL_PCRE *re, const PUBL(extra) *extra_data, const pcre_uchar *subject,
7261    const pcre_uchar *subject, int length, int start_offset, int options,    int length, int start_offset, int options, int *offsets, int offsetcount)
   int match_limit, int *offsets, int offsetcount, pcre_uchar **mark_ptr)  
7262  {  {
7263  executable_functions *functions = (executable_functions *)executable_funcs;  executable_functions *functions = (executable_functions *)extra_data->executable_jit;
7264  union {  union {
7265     void* executable_func;     void* executable_func;
7266     jit_function call_executable_func;     jit_function call_executable_func;
# Line 7232  arguments.begin = subject; Line 7285  arguments.begin = subject;
7285  arguments.end = subject + length;  arguments.end = subject + length;
7286  arguments.mark_ptr = NULL;  arguments.mark_ptr = NULL;
7287  /* JIT decreases this value less frequently than the interpreter. */  /* JIT decreases this value less frequently than the interpreter. */
7288  arguments.calllimit = match_limit;  arguments.calllimit = ((extra_data->flags & PCRE_EXTRA_MATCH_LIMIT) == 0) ? MATCH_LIMIT : extra_data->match_limit;
7289  arguments.notbol = (options & PCRE_NOTBOL) != 0;  arguments.notbol = (options & PCRE_NOTBOL) != 0;
7290  arguments.noteol = (options & PCRE_NOTEOL) != 0;  arguments.noteol = (options & PCRE_NOTEOL) != 0;
7291  arguments.notempty = (options & PCRE_NOTEMPTY) != 0;  arguments.notempty = (options & PCRE_NOTEMPTY) != 0;
# Line 7267  else Line 7320  else
7320    
7321  if (retval * 2 > offsetcount)  if (retval * 2 > offsetcount)
7322    retval = 0;    retval = 0;
7323  if (mark_ptr != NULL)  if ((extra_data->flags & PCRE_EXTRA_MARK) != 0)
7324    *mark_ptr = arguments.mark_ptr;    *(extra_data->mark) = arguments.mark_ptr;
7325    
7326  return retval;  return retval;
7327  }  }

Legend:
Removed from v.929  
changed lines
  Added in v.958

  ViewVC Help
Powered by ViewVC 1.1.5