/[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 924 by zherczeg, Wed Feb 22 10:23:56 2012 UTC revision 929 by zherczeg, Fri Feb 24 11:07:47 2012 UTC
# Line 152  typedef struct jit_arguments { Line 152  typedef struct jit_arguments {
152    const pcre_uchar *begin;    const pcre_uchar *begin;
153    const pcre_uchar *end;    const pcre_uchar *end;
154    int *offsets;    int *offsets;
155    pcre_uchar *ptr;    pcre_uchar *uchar_ptr;
156      pcre_uchar *mark_ptr;
157    /* Everything else after. */    /* Everything else after. */
158    int offsetcount;    int offsetcount;
159    int calllimit;    int calllimit;
# Line 287  typedef struct compiler_common { Line 288  typedef struct compiler_common {
288    int hit_start;    int hit_start;
289    /* End pointer of the first line. */    /* End pointer of the first line. */
290    int first_line_end;    int first_line_end;
291      /* Points to the marked string. */
292      int mark_ptr;
293    
294    /* Other  */    /* Other  */
295    const pcre_uint8 *fcc;    const pcre_uint8 *fcc;
# Line 296  typedef struct compiler_common { Line 299  typedef struct compiler_common {
299    int newline;    int newline;
300    int bsr_nltype;    int bsr_nltype;
301    int endonly;    int endonly;
302      BOOL has_set_som;
303    sljit_w ctypes;    sljit_w ctypes;
304    sljit_uw name_table;    sljit_uw name_table;
305    sljit_w name_count;    sljit_w name_count;
# Line 370  typedef struct compare_context { Line 374  typedef struct compare_context {
374    
375  enum {  enum {
376    frame_end = 0,    frame_end = 0,
377    frame_setstrbegin = -1    frame_setstrbegin = -1,
378      frame_setmark = -2
379  };  };
380    
381  /* Undefine sljit macros. */  /* Undefine sljit macros. */
# Line 650  switch(*cc) Line 655  switch(*cc)
655    case OP_SCBRAPOS:    case OP_SCBRAPOS:
656    return cc + 1 + LINK_SIZE + IMM2_SIZE;    return cc + 1 + LINK_SIZE + IMM2_SIZE;
657    
658      case OP_MARK:
659      return cc + 1 + 2 + cc[1];
660    
661    default:    default:
662    return NULL;    return NULL;
663    }    }
# Line 664  while (cc < ccend) Line 672  while (cc < ccend)
672    {    {
673    switch(*cc)    switch(*cc)
674      {      {
675        case OP_SET_SOM:
676        common->has_set_som = TRUE;
677        cc += 1;
678        break;
679    
680      case OP_ASSERT:      case OP_ASSERT:
681      case OP_ASSERT_NOT:      case OP_ASSERT_NOT:
682      case OP_ASSERTBACK:      case OP_ASSERTBACK:
# Line 702  while (cc < ccend) Line 715  while (cc < ccend)
715      cc += 1 + LINK_SIZE;      cc += 1 + LINK_SIZE;
716      break;      break;
717    
718        case OP_MARK:
719        if (common->mark_ptr == 0)
720          {
721          common->mark_ptr = common->ovector_start;
722          common->ovector_start += sizeof(sljit_w);
723          }
724        cc += 1 + 2 + cc[1];
725        break;
726    
727      default:      default:
728      cc = next_opcode(common, cc);      cc = next_opcode(common, cc);
729      if (cc == NULL)      if (cc == NULL)
# Line 767  static int get_framesize(compiler_common Line 789  static int get_framesize(compiler_common
789  pcre_uchar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
790  int length = 0;  int length = 0;
791  BOOL possessive = FALSE;  BOOL possessive = FALSE;
792  BOOL setsom_found = FALSE;  BOOL setsom_found = recursive;
793    BOOL setmark_found = recursive;
794    
795  if (!recursive && (*cc == OP_CBRAPOS || *cc == OP_SCBRAPOS))  if (!recursive && (*cc == OP_CBRAPOS || *cc == OP_SCBRAPOS))
796    {    {
# Line 781  while (cc < ccend) Line 804  while (cc < ccend)
804    switch(*cc)    switch(*cc)
805      {      {
806      case OP_SET_SOM:      case OP_SET_SOM:
807      case OP_RECURSE:      SLJIT_ASSERT(common->has_set_som);
808      if (!setsom_found)      if (!setsom_found)
809        {        {
810        length += 2;        length += 2;
811        setsom_found = TRUE;        setsom_found = TRUE;
812        }        }
813      cc += (*cc == OP_SET_SOM) ? 1 : 1 + LINK_SIZE;      cc += 1;
814        break;
815    
816        case OP_MARK:
817        SLJIT_ASSERT(common->mark_ptr != 0);
818        if (!setmark_found)
819          {
820          length += 2;
821          setmark_found = TRUE;
822          }
823        cc += 1 + 2 + cc[1];
824        break;
825    
826        case OP_RECURSE:
827        if (common->has_set_som && !setsom_found)
828          {
829          length += 2;
830          setsom_found = TRUE;
831          }
832        if (common->mark_ptr != 0 && !setmark_found)
833          {
834          length += 2;
835          setmark_found = TRUE;
836          }
837        cc += 1 + LINK_SIZE;
838      break;      break;
839    
840      case OP_CBRA:      case OP_CBRA:
# Line 817  static void init_frame(compiler_common * Line 864  static void init_frame(compiler_common *
864  {  {
865  DEFINE_COMPILER;  DEFINE_COMPILER;
866  pcre_uchar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
867  BOOL setsom_found = FALSE;  BOOL setsom_found = recursive;
868    BOOL setmark_found = recursive;
869  int offset;  int offset;
870    
871  /* >= 1 + shortest item size (2) */  /* >= 1 + shortest item size (2) */
# Line 832  while (cc < ccend) Line 880  while (cc < ccend)
880    switch(*cc)    switch(*cc)
881      {      {
882      case OP_SET_SOM:      case OP_SET_SOM:
883      case OP_RECURSE:      SLJIT_ASSERT(common->has_set_som);
884      if (!setsom_found)      if (!setsom_found)
885        {        {
886        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));
# Line 842  while (cc < ccend) Line 890  while (cc < ccend)
890        stackpos += (int)sizeof(sljit_w);        stackpos += (int)sizeof(sljit_w);
891        setsom_found = TRUE;        setsom_found = TRUE;
892        }        }
893      cc += (*cc == OP_SET_SOM) ? 1 : 1 + LINK_SIZE;      cc += 1;
894        break;
895    
896        case OP_MARK:
897        SLJIT_ASSERT(common->mark_ptr != 0);
898        if (!setmark_found)
899          {
900          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr);
901          OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, frame_setmark);
902          stackpos += (int)sizeof(sljit_w);
903          OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
904          stackpos += (int)sizeof(sljit_w);
905          setmark_found = TRUE;
906          }
907        cc += 1 + 2 + cc[1];
908        break;
909    
910        case OP_RECURSE:
911        if (common->has_set_som && !setsom_found)
912          {
913          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));
914          OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, frame_setstrbegin);
915          stackpos += (int)sizeof(sljit_w);
916          OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
917          stackpos += (int)sizeof(sljit_w);
918          setsom_found = TRUE;
919          }
920        if (common->mark_ptr != 0 && !setmark_found)
921          {
922          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr);
923          OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, frame_setmark);
924          stackpos += (int)sizeof(sljit_w);
925          OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
926          stackpos += (int)sizeof(sljit_w);
927          setmark_found = TRUE;
928          }
929        cc += 1 + LINK_SIZE;
930      break;      break;
931    
932      case OP_CBRA:      case OP_CBRA:
# Line 1258  OP1(SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJI Line 1342  OP1(SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJI
1342  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1), STR_PTR, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1), STR_PTR, 0);
1343    
1344  OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG1, 0, ARGUMENTS, 0);  OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG1, 0, ARGUMENTS, 0);
1345    if (common->mark_ptr != 0)
1346      OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG3, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr);
1347  OP1(SLJIT_MOV_SI, SLJIT_TEMPORARY_REG2, 0, SLJIT_MEM1(SLJIT_TEMPORARY_REG1), SLJIT_OFFSETOF(jit_arguments, offsetcount));  OP1(SLJIT_MOV_SI, SLJIT_TEMPORARY_REG2, 0, SLJIT_MEM1(SLJIT_TEMPORARY_REG1), SLJIT_OFFSETOF(jit_arguments, offsetcount));
1348    if (common->mark_ptr != 0)
1349      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_TEMPORARY_REG1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_TEMPORARY_REG3, 0);
1350  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));
1351  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));
1352  OP2(SLJIT_ADD, SLJIT_SAVED_REG1, 0, SLJIT_LOCALS_REG, 0, SLJIT_IMM, OVECTOR_START);  OP2(SLJIT_ADD, SLJIT_SAVED_REG1, 0, SLJIT_LOCALS_REG, 0, SLJIT_IMM, OVECTOR_START);
# Line 2320  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_R Line 2408  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_R
2408  JUMPTO(SLJIT_JUMP, mainloop);  JUMPTO(SLJIT_JUMP, mainloop);
2409    
2410  JUMPHERE(jump);  JUMPHERE(jump);
2411    if (common->mark_ptr != 0)
2412      {
2413      jump = CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, frame_setmark);
2414      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), sizeof(sljit_w));
2415      OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_w));
2416      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, TMP2, 0);
2417      JUMPTO(SLJIT_JUMP, mainloop);
2418    
2419      JUMPHERE(jump);
2420      }
2421    
2422  /* Unknown command. */  /* Unknown command. */
2423  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_w));  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_w));
2424  JUMPTO(SLJIT_JUMP, mainloop);  JUMPTO(SLJIT_JUMP, mainloop);
# Line 2612  static const pcre_uchar *SLJIT_CALL do_u Line 2711  static const pcre_uchar *SLJIT_CALL do_u
2711  {  {
2712  /* This function would be ineffective to do in JIT level. */  /* This function would be ineffective to do in JIT level. */
2713  int c1, c2;  int c1, c2;
2714  const pcre_uchar *src2 = args->ptr;  const pcre_uchar *src2 = args->uchar_ptr;
2715  const pcre_uchar *end2 = args->end;  const pcre_uchar *end2 = args->end;
2716    
2717  while (src1 < end1)  while (src1 < end1)
# Line 3815  if (common->utf && *cc == OP_REFI) Line 3914  if (common->utf && *cc == OP_REFI)
3914    /* Needed to save important temporary registers. */    /* Needed to save important temporary registers. */
3915    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0);
3916    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, ARGUMENTS, 0);    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, ARGUMENTS, 0);
3917    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), SLJIT_OFFSETOF(jit_arguments, ptr), STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), SLJIT_OFFSETOF(jit_arguments, uchar_ptr), STR_PTR, 0);
3918    sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf_caselesscmp));    sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf_caselesscmp));
3919    OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);    OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);
3920    if (common->mode == JIT_COMPILE)    if (common->mode == JIT_COMPILE)
# Line 4050  if (entry == NULL) Line 4149  if (entry == NULL)
4149      common->entries = entry;      common->entries = entry;
4150    }    }
4151    
4152  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));  if (common->has_set_som && common->mark_ptr != 0)
4153  allocate_stack(common, 1);    {
4154  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));
4155      allocate_stack(common, 2);
4156      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr);
4157      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
4158      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0);
4159      }
4160    else if (common->has_set_som || common->mark_ptr != 0)
4161      {
4162      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->has_set_som ? (OVECTOR(0)) : common->mark_ptr);
4163      allocate_stack(common, 1);
4164      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
4165      }
4166    
4167  if (entry->entry == NULL)  if (entry->entry == NULL)
4168    add_jump(compiler, &entry->calls, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &entry->calls, JUMP(SLJIT_FAST_CALL));
# Line 5519  while (cc < ccend) Line 5629  while (cc < ccend)
5629    
5630      case OP_SET_SOM:      case OP_SET_SOM:
5631      PUSH_FALLBACK_NOVALUE(sizeof(fallback_common), cc);      PUSH_FALLBACK_NOVALUE(sizeof(fallback_common), cc);
5632        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));
5633      allocate_stack(common, 1);      allocate_stack(common, 1);
     OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));  
5634      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), STR_PTR, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), STR_PTR, 0);
5635      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
5636      cc++;      cc++;
5637      break;      break;
5638    
# Line 5687  while (cc < ccend) Line 5797  while (cc < ccend)
5797      cc = compile_bracketpos_hotpath(common, cc, parent);      cc = compile_bracketpos_hotpath(common, cc, parent);
5798      break;      break;
5799    
5800        case OP_MARK:
5801        PUSH_FALLBACK_NOVALUE(sizeof(fallback_common), cc);
5802        SLJIT_ASSERT(common->mark_ptr != 0);
5803        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr);
5804        allocate_stack(common, 1);
5805        OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
5806        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
5807        OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_w)(cc + 2));
5808        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, TMP2, 0);
5809        OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0);
5810        cc += 1 + 2 + cc[1];
5811        break;
5812    
5813      case OP_FAIL:      case OP_FAIL:
5814      case OP_ACCEPT:      case OP_ACCEPT:
5815      case OP_ASSERT_ACCEPT:      case OP_ASSERT_ACCEPT:
# Line 5880  static void compile_recurse_fallbackpath Line 6003  static void compile_recurse_fallbackpath
6003  DEFINE_COMPILER;  DEFINE_COMPILER;
6004    
6005  set_jumps(current->topfallbacks, LABEL());  set_jumps(current->topfallbacks, LABEL());
6006  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0));  
6007  free_stack(common, 1);  if (common->has_set_som && common->mark_ptr != 0)
6008  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), TMP2, 0);    {
6009      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
6010      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
6011      free_stack(common, 2);
6012      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), TMP2, 0);
6013      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, TMP1, 0);
6014      }
6015    else if (common->has_set_som || common->mark_ptr != 0)
6016      {
6017      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
6018      free_stack(common, 1);
6019      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->has_set_som ? (OVECTOR(0)) : common->mark_ptr, TMP2, 0);
6020      }
6021  }  }
6022    
6023  static void compile_assert_fallbackpath(compiler_common *common, struct fallback_common *current)  static void compile_assert_fallbackpath(compiler_common *common, struct fallback_common *current)
# Line 6518  while (current) Line 6653  while (current)
6653      compile_braminzero_fallbackpath(common, current);      compile_braminzero_fallbackpath(common, current);
6654      break;      break;
6655    
6656        case OP_MARK:
6657        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
6658        free_stack(common, 1);
6659        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, TMP1, 0);
6660        break;
6661    
6662      case OP_FAIL:      case OP_FAIL:
6663      case OP_ACCEPT:      case OP_ACCEPT:
6664      case OP_ASSERT_ACCEPT:      case OP_ASSERT_ACCEPT:
# Line 6561  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), ST Line 6702  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), ST
6702  copy_locals(common, ccbegin, ccend, TRUE, localsize + framesize + alternativesize, framesize + alternativesize);  copy_locals(common, ccbegin, ccend, TRUE, localsize + framesize + alternativesize, framesize + alternativesize);
6703  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head, STACK_TOP, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head, STACK_TOP, 0);
6704  if (needsframe)  if (needsframe)
6705    init_frame(common, cc, framesize + alternativesize - 1, alternativesize, FALSE);    init_frame(common, cc, framesize + alternativesize - 1, alternativesize, TRUE);
6706    
6707  if (alternativesize > 0)  if (alternativesize > 0)
6708    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
# Line 6604  set_jumps(common->accept, LABEL()); Line 6745  set_jumps(common->accept, LABEL());
6745  OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head);  OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head);
6746  if (needsframe)  if (needsframe)
6747    {    {
   OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));  
6748    OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_w));    OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_w));
6749    add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
6750    OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_w));    OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_w));
   OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), TMP3, 0);  
6751    }    }
6752  OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 1);  OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 1);
6753    
# Line 6799  if (mode == JIT_COMPILE && (re->flags & Line 6938  if (mode == JIT_COMPILE && (re->flags &
6938  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), STR_PTR, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), STR_PTR, 0);
6939  /* Copy the limit of allowed recursions. */  /* Copy the limit of allowed recursions. */
6940  OP1(SLJIT_MOV, CALL_COUNT, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), CALL_LIMIT);  OP1(SLJIT_MOV, CALL_COUNT, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), CALL_LIMIT);
6941    if (common->mark_ptr != 0)
6942      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, SLJIT_IMM, 0);
6943  /* Copy the beginning of the string. */  /* Copy the beginning of the string. */
6944  if (mode == JIT_PARTIAL_SOFT_COMPILE)  if (mode == JIT_PARTIAL_SOFT_COMPILE)
6945    {    {
# Line 6866  if ((re->options & PCRE_ANCHORED) == 0) Line 7007  if ((re->options & PCRE_ANCHORED) == 0)
7007      {      {
7008      if (mode == JIT_COMPILE && study != NULL && study->minlength > 1)      if (mode == JIT_COMPILE && study != NULL && study->minlength > 1)
7009        {        {
7010        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength));        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength + 1));
7011        CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, STR_END, 0, mainloop);        CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, STR_END, 0, mainloop);
7012        }        }
7013      else      else
# Line 6877  if ((re->options & PCRE_ANCHORED) == 0) Line 7018  if ((re->options & PCRE_ANCHORED) == 0)
7018      SLJIT_ASSERT(common->first_line_end != 0);      SLJIT_ASSERT(common->first_line_end != 0);
7019      if (mode == JIT_COMPILE && study != NULL && study->minlength > 1)      if (mode == JIT_COMPILE && study != NULL && study->minlength > 1)
7020        {        {
7021        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength));        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength + 1));
7022        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);
7023        COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_GREATER);        COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_GREATER);
7024        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end);        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end);
# Line 7064  return convert_executable_func.call_exec Line 7205  return convert_executable_func.call_exec
7205  int  int
7206  PRIV(jit_exec)(const REAL_PCRE *re, void *executable_funcs,  PRIV(jit_exec)(const REAL_PCRE *re, void *executable_funcs,
7207    const pcre_uchar *subject, int length, int start_offset, int options,    const pcre_uchar *subject, int length, int start_offset, int options,
7208    int match_limit, int *offsets, int offsetcount)    int match_limit, int *offsets, int offsetcount, pcre_uchar **mark_ptr)
7209  {  {
7210  executable_functions *functions = (executable_functions *)executable_funcs;  executable_functions *functions = (executable_functions *)executable_funcs;
7211  union {  union {
# Line 7089  arguments.stack = NULL; Line 7230  arguments.stack = NULL;
7230  arguments.str = subject + start_offset;  arguments.str = subject + start_offset;
7231  arguments.begin = subject;  arguments.begin = subject;
7232  arguments.end = subject + length;  arguments.end = subject + length;
7233  arguments.calllimit = match_limit; /* JIT decreases this value less times. */  arguments.mark_ptr = NULL;
7234    /* JIT decreases this value less frequently than the interpreter. */
7235    arguments.calllimit = match_limit;
7236  arguments.notbol = (options & PCRE_NOTBOL) != 0;  arguments.notbol = (options & PCRE_NOTBOL) != 0;
7237  arguments.noteol = (options & PCRE_NOTEOL) != 0;  arguments.noteol = (options & PCRE_NOTEOL) != 0;
7238  arguments.notempty = (options & PCRE_NOTEMPTY) != 0;  arguments.notempty = (options & PCRE_NOTEMPTY) != 0;
# Line 7124  else Line 7267  else
7267    
7268  if (retval * 2 > offsetcount)  if (retval * 2 > offsetcount)
7269    retval = 0;    retval = 0;
7270    if (mark_ptr != NULL)
7271      *mark_ptr = arguments.mark_ptr;
7272    
7273  return retval;  return retval;
7274  }  }
7275    

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

  ViewVC Help
Powered by ViewVC 1.1.5