/[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 1245 by zherczeg, Sat Feb 9 11:30:51 2013 UTC revision 1246 by zherczeg, Sun Feb 10 08:44:53 2013 UTC
# Line 395  typedef struct compare_context { Line 395  typedef struct compare_context {
395  #endif  #endif
396  } compare_context;  } compare_context;
397    
 enum {  
   frame_end = 0,  
   frame_setstrbegin = -1,  
   frame_setmark = -2  
 };  
   
398  /* Undefine sljit macros. */  /* Undefine sljit macros. */
399  #undef CMP  #undef CMP
400    
# Line 464  the start pointers when the end of the c Line 458  the start pointers when the end of the c
458    sljit_set_label(sljit_emit_jump(compiler, (type)), (label))    sljit_set_label(sljit_emit_jump(compiler, (type)), (label))
459  #define JUMPHERE(jump) \  #define JUMPHERE(jump) \
460    sljit_set_label((jump), sljit_emit_label(compiler))    sljit_set_label((jump), sljit_emit_label(compiler))
461    #define SET_LABEL(jump, label) \
462      sljit_set_label((jump), (label))
463  #define CMP(type, src1, src1w, src2, src2w) \  #define CMP(type, src1, src1w, src2, src2w) \
464    sljit_emit_cmp(compiler, (type), (src1), (src1w), (src2), (src2w))    sljit_emit_cmp(compiler, (type), (src1), (src1w), (src2), (src2w))
465  #define CMPTO(type, src1, src1w, src2, src2w, label) \  #define CMPTO(type, src1, src1w, src2, src2w, label) \
# Line 1127  static int get_framesize(compiler_common Line 1123  static int get_framesize(compiler_common
1123  {  {
1124  pcre_uchar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
1125  int length = 0;  int length = 0;
1126  BOOL possessive = FALSE;  int possessive = 0;
1127  BOOL setsom_found = recursive;  BOOL setsom_found = recursive;
1128  BOOL setmark_found = recursive;  BOOL setmark_found = recursive;
1129    BOOL capture_last_found = recursive;
1130    
1131  if (!recursive && (*cc == OP_CBRAPOS || *cc == OP_SCBRAPOS))  if (!recursive && (*cc == OP_CBRAPOS || *cc == OP_SCBRAPOS))
1132    {    {
1133    length = 3;    possessive = length = (common->capture_last_ptr != 0) ? 5 : 3;
1134    possessive = TRUE;    /* This is correct regardless of common->capture_last_ptr. */
1135      capture_last_found = TRUE;
1136    }    }
1137    
1138  cc = next_opcode(common, cc);  cc = next_opcode(common, cc);
# Line 1173  while (cc < ccend) Line 1171  while (cc < ccend)
1171        length += 2;        length += 2;
1172        setmark_found = TRUE;        setmark_found = TRUE;
1173        }        }
1174        if (common->capture_last_ptr != 0 && !capture_last_found)
1175          {
1176          length += 2;
1177          capture_last_found = TRUE;
1178          }
1179      cc += 1 + LINK_SIZE;      cc += 1 + LINK_SIZE;
1180      break;      break;
1181    
# Line 1180  while (cc < ccend) Line 1183  while (cc < ccend)
1183      case OP_CBRAPOS:      case OP_CBRAPOS:
1184      case OP_SCBRA:      case OP_SCBRA:
1185      case OP_SCBRAPOS:      case OP_SCBRAPOS:
1186        if (common->capture_last_ptr != 0 && !capture_last_found)
1187          {
1188          length += 2;
1189          capture_last_found = TRUE;
1190          }
1191      length += 3;      length += 3;
1192      cc += 1 + LINK_SIZE + IMM2_SIZE;      cc += 1 + LINK_SIZE + IMM2_SIZE;
1193      break;      break;
# Line 1191  while (cc < ccend) Line 1199  while (cc < ccend)
1199      }      }
1200    
1201  /* Possessive quantifiers can use a special case. */  /* Possessive quantifiers can use a special case. */
1202  if (SLJIT_UNLIKELY(possessive) && length == 3)  if (SLJIT_UNLIKELY(possessive == length))
1203    return -1;    return -1;
1204    
1205  if (length > 0)  if (length > 0)
# Line 1205  DEFINE_COMPILER; Line 1213  DEFINE_COMPILER;
1213  pcre_uchar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
1214  BOOL setsom_found = recursive;  BOOL setsom_found = recursive;
1215  BOOL setmark_found = recursive;  BOOL setmark_found = recursive;
1216    BOOL capture_last_found = recursive;
1217  int offset;  int offset;
1218    
1219  /* >= 1 + shortest item size (2) */  /* >= 1 + shortest item size (2) */
# Line 1223  while (cc < ccend) Line 1232  while (cc < ccend)
1232      if (!setsom_found)      if (!setsom_found)
1233        {        {
1234        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));
1235        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, frame_setstrbegin);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -OVECTOR(0));
1236        stackpos += (int)sizeof(sljit_sw);        stackpos += (int)sizeof(sljit_sw);
1237        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
1238        stackpos += (int)sizeof(sljit_sw);        stackpos += (int)sizeof(sljit_sw);
# Line 1237  while (cc < ccend) Line 1246  while (cc < ccend)
1246      if (!setmark_found)      if (!setmark_found)
1247        {        {
1248        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr);        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr);
1249        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, frame_setmark);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr);
1250        stackpos += (int)sizeof(sljit_sw);        stackpos += (int)sizeof(sljit_sw);
1251        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
1252        stackpos += (int)sizeof(sljit_sw);        stackpos += (int)sizeof(sljit_sw);
# Line 1250  while (cc < ccend) Line 1259  while (cc < ccend)
1259      if (common->has_set_som && !setsom_found)      if (common->has_set_som && !setsom_found)
1260        {        {
1261        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0));
1262        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, frame_setstrbegin);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -OVECTOR(0));
1263        stackpos += (int)sizeof(sljit_sw);        stackpos += (int)sizeof(sljit_sw);
1264        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
1265        stackpos += (int)sizeof(sljit_sw);        stackpos += (int)sizeof(sljit_sw);
# Line 1259  while (cc < ccend) Line 1268  while (cc < ccend)
1268      if (common->mark_ptr != 0 && !setmark_found)      if (common->mark_ptr != 0 && !setmark_found)
1269        {        {
1270        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr);        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr);
1271        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, frame_setmark);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr);
1272        stackpos += (int)sizeof(sljit_sw);        stackpos += (int)sizeof(sljit_sw);
1273        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
1274        stackpos += (int)sizeof(sljit_sw);        stackpos += (int)sizeof(sljit_sw);
1275        setmark_found = TRUE;        setmark_found = TRUE;
1276        }        }
1277        if (common->capture_last_ptr != 0 && !capture_last_found)
1278          {
1279          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr);
1280          OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr);
1281          stackpos += (int)sizeof(sljit_sw);
1282          OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
1283          stackpos += (int)sizeof(sljit_sw);
1284          capture_last_found = TRUE;
1285          }
1286      cc += 1 + LINK_SIZE;      cc += 1 + LINK_SIZE;
1287      break;      break;
1288    
# Line 1272  while (cc < ccend) Line 1290  while (cc < ccend)
1290      case OP_CBRAPOS:      case OP_CBRAPOS:
1291      case OP_SCBRA:      case OP_SCBRA:
1292      case OP_SCBRAPOS:      case OP_SCBRAPOS:
1293        if (common->capture_last_ptr != 0 && !capture_last_found)
1294          {
1295          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr);
1296          OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr);
1297          stackpos += (int)sizeof(sljit_sw);
1298          OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
1299          stackpos += (int)sizeof(sljit_sw);
1300          capture_last_found = TRUE;
1301          }
1302      offset = (GET2(cc, 1 + LINK_SIZE)) << 1;      offset = (GET2(cc, 1 + LINK_SIZE)) << 1;
1303      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, OVECTOR(offset));      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, OVECTOR(offset));
1304      stackpos += (int)sizeof(sljit_sw);      stackpos += (int)sizeof(sljit_sw);
# Line 1291  while (cc < ccend) Line 1318  while (cc < ccend)
1318      break;      break;
1319      }      }
1320    
1321  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, frame_end);  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, 0);
1322  SLJIT_ASSERT(stackpos == STACK(stacktop));  SLJIT_ASSERT(stackpos == STACK(stacktop));
1323  }  }
1324    
# Line 1731  while (list) Line 1758  while (list)
1758    {    {
1759    /* sljit_set_label is clever enough to do nothing    /* sljit_set_label is clever enough to do nothing
1760    if either the jump or the label is NULL. */    if either the jump or the label is NULL. */
1761    sljit_set_label(list->jump, label);    SET_LABEL(list->jump, label);
1762    list = list->next;    list = list->next;
1763    }    }
1764  }  }
# Line 3060  GET_LOCAL_BASE(TMP3, 0, 0); Line 3087  GET_LOCAL_BASE(TMP3, 0, 0);
3087  /* Drop frames until we reach STACK_TOP. */  /* Drop frames until we reach STACK_TOP. */
3088  mainloop = LABEL();  mainloop = LABEL();
3089  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), 0);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), 0);
3090  jump = CMP(SLJIT_C_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, frame_end);  OP2(SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0);
3091    jump = JUMP(SLJIT_C_SIG_LESS_EQUAL);
3092    
3093  OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP3, 0);  OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP3, 0);
3094  OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));  OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));
3095  OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(TMP1), 2 * sizeof(sljit_sw));  OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(TMP1), 2 * sizeof(sljit_sw));
# Line 3068  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_I Line 3097  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_I
3097  JUMPTO(SLJIT_JUMP, mainloop);  JUMPTO(SLJIT_JUMP, mainloop);
3098    
3099  JUMPHERE(jump);  JUMPHERE(jump);
3100  jump = CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, frame_end);  jump = JUMP(SLJIT_C_SIG_LESS);
3101  /* End of dropping frames. */  /* End of dropping frames. */
3102  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
3103    
3104  JUMPHERE(jump);  JUMPHERE(jump);
3105  jump = CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, frame_setstrbegin);  OP1(SLJIT_NEG, TMP2, 0, TMP2, 0);
3106  /* Set string begin. */  OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP3, 0);
3107  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));  OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));
 OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));  
 OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), TMP2, 0);  
 JUMPTO(SLJIT_JUMP, mainloop);  
   
 JUMPHERE(jump);  
 if (common->mark_ptr != 0)  
   {  
   jump = CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, frame_setmark);  
   OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));  
   OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));  
   OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, TMP2, 0);  
   JUMPTO(SLJIT_JUMP, mainloop);  
   
   JUMPHERE(jump);  
   }  
   
 /* Unknown command. */  
3108  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
3109  JUMPTO(SLJIT_JUMP, mainloop);  JUMPTO(SLJIT_JUMP, mainloop);
3110  }  }
# Line 5394  if (opcode == OP_ASSERT || opcode == OP_ Line 5406  if (opcode == OP_ASSERT || opcode == OP_
5406    if (bra == OP_BRAZERO)    if (bra == OP_BRAZERO)
5407      {      {
5408      backtrack->matchingpath = LABEL();      backtrack->matchingpath = LABEL();
5409      sljit_set_label(jump, backtrack->matchingpath);      SET_LABEL(jump, backtrack->matchingpath);
5410      }      }
5411    else if (bra == OP_BRAMINZERO)    else if (bra == OP_BRAMINZERO)
5412      {      {
# Line 6163  framesize = get_framesize(common, cc, FA Line 6175  framesize = get_framesize(common, cc, FA
6175  BACKTRACK_AS(bracketpos_backtrack)->framesize = framesize;  BACKTRACK_AS(bracketpos_backtrack)->framesize = framesize;
6176  if (framesize < 0)  if (framesize < 0)
6177    {    {
6178    stacksize = (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS) ? 2 : 1;    if (offset != 0)
6179        {
6180        stacksize = 2;
6181        if (common->capture_last_ptr != 0)
6182          stacksize++;
6183        }
6184      else
6185        stacksize = 1;
6186    
6187    if (!zero)    if (!zero)
6188      stacksize++;      stacksize++;
6189    
6190    BACKTRACK_AS(bracketpos_backtrack)->stacksize = stacksize;    BACKTRACK_AS(bracketpos_backtrack)->stacksize = stacksize;
6191    allocate_stack(common, stacksize);    allocate_stack(common, stacksize);
6192    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0);
6193    
6194    if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)    if (offset != 0)
6195      {      {
6196      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
6197      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
6198      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0);
6199        if (common->capture_last_ptr != 0)
6200          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr);
6201      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP2, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP2, 0);
6202        if (common->capture_last_ptr != 0)
6203          OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), TMP1, 0);
6204      }      }
6205    else    else
6206      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 6191  else Line 6216  else
6216    if (opcode == OP_BRAPOS || opcode == OP_SBRAPOS)    if (opcode == OP_BRAPOS || opcode == OP_SBRAPOS)
6217      stacksize++;      stacksize++;
6218    BACKTRACK_AS(bracketpos_backtrack)->stacksize = stacksize;    BACKTRACK_AS(bracketpos_backtrack)->stacksize = stacksize;
   allocate_stack(common, stacksize);  
6219    
6220      allocate_stack(common, stacksize);
6221    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
6222    OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, -STACK(stacksize - 1));    OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, -STACK(stacksize - 1));
6223    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP2, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP2, 0);
6224    
6225    stack = 0;    stack = 0;
6226    if (!zero)    if (!zero)
6227      {      {
# Line 6211  else Line 6237  else
6237    init_frame(common, cc, stacksize - 1, stacksize - framesize, FALSE);    init_frame(common, cc, stacksize - 1, stacksize - framesize, FALSE);
6238    }    }
6239    
6240  if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)  if (offset != 0)
6241    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr, STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr, STR_PTR, 0);
6242    
6243  loop = LABEL();  loop = LABEL();
# Line 6229  while (*cc != OP_KETRPOS) Line 6255  while (*cc != OP_KETRPOS)
6255      {      {
6256      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
6257    
6258      if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)      if (offset != 0)
6259        {        {
6260        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr);        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr);
6261        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), STR_PTR, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), STR_PTR, 0);
6262        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr, STR_PTR, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr, STR_PTR, 0);
6263          if (common->capture_last_ptr != 0)
6264            OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr, SLJIT_IMM, offset >> 1);
6265        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);
6266        }        }
6267      else      else
# Line 6251  while (*cc != OP_KETRPOS) Line 6279  while (*cc != OP_KETRPOS)
6279      }      }
6280    else    else
6281      {      {
6282      if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)      if (offset != 0)
6283        {        {
6284        OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, stacksize * sizeof(sljit_sw));        OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, stacksize * sizeof(sljit_sw));
6285        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr);        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr);
6286        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), STR_PTR, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), STR_PTR, 0);
6287        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr, STR_PTR, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr, STR_PTR, 0);
6288          if (common->capture_last_ptr != 0)
6289            OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr, SLJIT_IMM, offset >> 1);
6290        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);
6291        }        }
6292      else      else
# Line 6289  while (*cc != OP_KETRPOS) Line 6319  while (*cc != OP_KETRPOS)
6319    
6320    if (framesize < 0)    if (framesize < 0)
6321      {      {
6322      if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)      if (offset != 0)
6323        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr);        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr);
6324      else      else
6325        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
6326      }      }
6327    else    else
6328      {      {
6329      if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)      if (offset != 0)
6330        {        {
6331        /* Last alternative. */        /* Last alternative. */
6332        if (*cc == OP_KETRPOS)        if (*cc == OP_KETRPOS)
# Line 6443  PUSH_BACKTRACK(sizeof(iterator_backtrack Line 6473  PUSH_BACKTRACK(sizeof(iterator_backtrack
6473    
6474  cc = get_iterator_parameters(common, cc, &opcode, &type, &arg1, &arg2, &end);  cc = get_iterator_parameters(common, cc, &opcode, &type, &arg1, &arg2, &end);
6475    
6476  switch (type)  switch(type)
6477    {    {
6478    case OP_NOT_DIGIT:    case OP_NOT_DIGIT:
6479    case OP_DIGIT:    case OP_DIGIT:
# Line 7315  if (offset != 0) Line 7345  if (offset != 0)
7345    {    {
7346    if (common->capture_last_ptr != 0)    if (common->capture_last_ptr != 0)
7347      {      {
7348        SLJIT_ASSERT(common->optimized_cbracket[offset >> 1] == 0);
7349      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
7350      free_stack(common, 1);      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
7351      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr, TMP1, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr, TMP1, 0);
7352        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(2));
7353        free_stack(common, 3);
7354        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP2, 0);
7355        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP1, 0);
7356      }      }
7357    if (common->optimized_cbracket[offset >> 1] == 0)    else if (common->optimized_cbracket[offset >> 1] == 0)
7358      {      {
7359      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
7360      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1));      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
# Line 7671  if (CURRENT_AS(bracketpos_backtrack)->fr Line 7706  if (CURRENT_AS(bracketpos_backtrack)->fr
7706      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
7707      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1));      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
7708      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);
7709        if (common->capture_last_ptr != 0)
7710          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(2));
7711      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP2, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP2, 0);
7712        if (common->capture_last_ptr != 0)
7713          OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr, TMP1, 0);
7714      }      }
7715    set_jumps(current->topbacktracks, LABEL());    set_jumps(current->topbacktracks, LABEL());
7716    free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize);    free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize);
# Line 8232  if (common->quit != NULL) Line 8271  if (common->quit != NULL)
8271  if (common->forced_quit != NULL)  if (common->forced_quit != NULL)
8272    set_jumps(common->forced_quit, common->forced_quit_label);    set_jumps(common->forced_quit, common->forced_quit_label);
8273  if (minlength_check_failed != NULL)  if (minlength_check_failed != NULL)
8274    sljit_set_label(minlength_check_failed, common->forced_quit_label);    SET_LABEL(minlength_check_failed, common->forced_quit_label);
8275  sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);  sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
8276    
8277  if (mode != JIT_COMPILE)  if (mode != JIT_COMPILE)

Legend:
Removed from v.1245  
changed lines
  Added in v.1246

  ViewVC Help
Powered by ViewVC 1.1.5