/[pcre]/code/branches/pcre16/pcre_jit_compile.c
ViewVC logotype

Diff of /code/branches/pcre16/pcre_jit_compile.c

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

revision 763 by zherczeg, Tue Nov 22 21:46:22 2011 UTC revision 767 by zherczeg, Sat Nov 26 12:48:56 2011 UTC
# Line 62  system files. */ Line 62  system files. */
62  #include "sljit/sljitLir.c"  #include "sljit/sljitLir.c"
63    
64  #if defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED  #if defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED
65  #error "Unsupported architecture"  #error Unsupported architecture
66  #endif  #endif
67    
68  /* Allocate memory on the stack. Fast, but limited size. */  /* Allocate memory on the stack. Fast, but limited size. */
# Line 148  Thus we can restore the locals to a part Line 148  Thus we can restore the locals to a part
148  typedef struct jit_arguments {  typedef struct jit_arguments {
149    /* Pointers first. */    /* Pointers first. */
150    struct sljit_stack *stack;    struct sljit_stack *stack;
151    PCRE_SPTR str;    const pcre_uchar *str;
152    PCRE_SPTR begin;    const pcre_uchar *begin;
153    PCRE_SPTR end;    const pcre_uchar *end;
154    int *offsets;    int *offsets;
155    pcre_uchar *ptr;    pcre_uchar *ptr;
156    /* Everything else after. */    /* Everything else after. */
# Line 316  typedef struct compare_context { Line 316  typedef struct compare_context {
316    int length;    int length;
317    int sourcereg;    int sourcereg;
318  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
319    int byteptr;    int ucharptr;
320    union {    union {
321      int asint;      sljit_i asint;
322      short asshort;      sljit_h asshort;
323    #ifdef COMPILE_PCRE8
324      sljit_ub asbyte;      sljit_ub asbyte;
325      sljit_ub asbytes[4];      sljit_ub asuchars[4];
326    #else
327    #ifdef COMPILE_PCRE16
328        sljit_uh asuchars[2];
329    #endif
330    #endif
331    } c;    } c;
332    union {    union {
333      int asint;      sljit_i asint;
334      short asshort;      sljit_h asshort;
335    #ifdef COMPILE_PCRE8
336      sljit_ub asbyte;      sljit_ub asbyte;
337      sljit_ub asbytes[4];      sljit_ub asuchars[4];
338    #else
339    #ifdef COMPILE_PCRE16
340        sljit_uh asuchars[2];
341    #endif
342    #endif
343    } oc;    } oc;
344  #endif  #endif
345  } compare_context;  } compare_context;
# Line 373  the start pointers when the end of the c Line 385  the start pointers when the end of the c
385  #define OVECTOR_START    (8 * sizeof(sljit_w))  #define OVECTOR_START    (8 * sizeof(sljit_w))
386  #define OVECTOR(i)       (OVECTOR_START + (i) * sizeof(sljit_w))  #define OVECTOR(i)       (OVECTOR_START + (i) * sizeof(sljit_w))
387  #define OVECTOR_PRIV(i)  (common->cbraptr + (i) * sizeof(sljit_w))  #define OVECTOR_PRIV(i)  (common->cbraptr + (i) * sizeof(sljit_w))
388  #define PRIV(cc)         (common->localptrs[(cc) - common->start])  #define PRIV_DATA(cc)    (common->localptrs[(cc) - common->start])
389    
390    #ifdef COMPILE_PCRE8
391    #define MOV_UCHAR SLJIT_MOV_UB
392    #else
393    #ifdef COMPILE_PCRE16
394    #define MOV_UCHAR SLJIT_MOV_UH
395    #else
396    #error Unsupported compiling mode
397    #endif
398    #endif
399    
400  /* Shortcuts. */  /* Shortcuts. */
401  #define DEFINE_COMPILER \  #define DEFINE_COMPILER \
# Line 522  switch(*cc) Line 544  switch(*cc)
544    case OP_NOTPOSQUERYI:    case OP_NOTPOSQUERYI:
545    cc += 2;    cc += 2;
546  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
547    if (common->utf8 && cc[-1] >= 0xc0) cc += _pcre_utf8_table4[cc[-1] & 0x3f];    if (common->utf8 && cc[-1] >= 0xc0) cc += PRIV(utf8_table4)[cc[-1] & 0x3f];
548  #endif  #endif
549    return cc;    return cc;
550    
# Line 544  switch(*cc) Line 566  switch(*cc)
566    case OP_NOTPOSUPTOI:    case OP_NOTPOSUPTOI:
567    cc += 4;    cc += 4;
568  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
569    if (common->utf8 && cc[-1] >= 0xc0) cc += _pcre_utf8_table4[cc[-1] & 0x3f];    if (common->utf8 && cc[-1] >= 0xc0) cc += PRIV(utf8_table4)[cc[-1] & 0x3f];
570  #endif  #endif
571    return cc;    return cc;
572    
# Line 938  while (status != end) Line 960  while (status != end)
960        case OP_SBRAPOS:        case OP_SBRAPOS:
961        case OP_SCOND:        case OP_SCOND:
962        count = 1;        count = 1;
963        srcw[0] = PRIV(cc);        srcw[0] = PRIV_DATA(cc);
964        SLJIT_ASSERT(srcw[0] != 0);        SLJIT_ASSERT(srcw[0] != 0);
965        cc += 1 + LINK_SIZE;        cc += 1 + LINK_SIZE;
966        break;        break;
# Line 954  while (status != end) Line 976  while (status != end)
976        case OP_SCBRAPOS:        case OP_SCBRAPOS:
977        count = 2;        count = 2;
978        srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));        srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
979        srcw[0] = PRIV(cc);        srcw[0] = PRIV_DATA(cc);
980        SLJIT_ASSERT(srcw[0] != 0);        SLJIT_ASSERT(srcw[0] != 0);
981        cc += 1 + LINK_SIZE + 2;        cc += 1 + LINK_SIZE + 2;
982        break;        break;
# Line 965  while (status != end) Line 987  while (status != end)
987        if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)        if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
988          {          {
989          count = 1;          count = 1;
990          srcw[0] = PRIV(cc);          srcw[0] = PRIV_DATA(cc);
991          SLJIT_ASSERT(srcw[0] != 0);          SLJIT_ASSERT(srcw[0] != 0);
992          }          }
993        cc += 1 + LINK_SIZE;        cc += 1 + LINK_SIZE;
# Line 1173  struct sljit_label *loop; Line 1195  struct sljit_label *loop;
1195  int i;  int i;
1196  /* At this point we can freely use all temporary registers. */  /* At this point we can freely use all temporary registers. */
1197  /* TMP1 returns with begin - 1. */  /* TMP1 returns with begin - 1. */
1198  OP2(SLJIT_SUB, SLJIT_TEMPORARY_REG1, 0, SLJIT_MEM1(SLJIT_GENERAL_REG1), SLJIT_OFFSETOF(jit_arguments, begin), SLJIT_IMM, 1);  OP2(SLJIT_SUB, SLJIT_TEMPORARY_REG1, 0, SLJIT_MEM1(SLJIT_GENERAL_REG1), SLJIT_OFFSETOF(jit_arguments, begin), SLJIT_IMM, IN_UCHARS(1));
1199  if (length < 8)  if (length < 8)
1200    {    {
1201    for (i = 0; i < length; i++)    for (i = 0; i < length; i++)
# Line 1211  loop = LABEL(); Line 1233  loop = LABEL();
1233  OP2(SLJIT_SUB, SLJIT_GENERAL_REG2, 0, SLJIT_MEM1(SLJIT_GENERAL_REG1), 0, SLJIT_TEMPORARY_REG1, 0);  OP2(SLJIT_SUB, SLJIT_GENERAL_REG2, 0, SLJIT_MEM1(SLJIT_GENERAL_REG1), 0, SLJIT_TEMPORARY_REG1, 0);
1234  OP2(SLJIT_ADD, SLJIT_GENERAL_REG1, 0, SLJIT_GENERAL_REG1, 0, SLJIT_IMM, sizeof(sljit_w));  OP2(SLJIT_ADD, SLJIT_GENERAL_REG1, 0, SLJIT_GENERAL_REG1, 0, SLJIT_IMM, sizeof(sljit_w));
1235  /* Copy the integer value to the output buffer */  /* Copy the integer value to the output buffer */
1236    #ifdef COMPILE_PCRE16
1237    OP2(SLJIT_LSHR, SLJIT_GENERAL_REG2, 0, SLJIT_GENERAL_REG2, 0, SLJIT_IMM, 1);
1238    #endif
1239  OP1(SLJIT_MOVU_SI, SLJIT_MEM1(SLJIT_TEMPORARY_REG3), sizeof(int), SLJIT_GENERAL_REG2, 0);  OP1(SLJIT_MOVU_SI, SLJIT_MEM1(SLJIT_TEMPORARY_REG3), sizeof(int), SLJIT_GENERAL_REG2, 0);
1240  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_TEMPORARY_REG2, 0, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, 1);  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_TEMPORARY_REG2, 0, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, 1);
1241  JUMPTO(SLJIT_C_NOT_ZERO, loop);  JUMPTO(SLJIT_C_NOT_ZERO, loop);
# Line 1320  if (!ispowerof2(bit)) Line 1345  if (!ispowerof2(bit))
1345  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1346  if (common->utf8 && c > 127)  if (common->utf8 && c > 127)
1347    {    {
1348    n = _pcre_utf8_table4[*cc & 0x3f];    n = PRIV(utf8_table4)[*cc & 0x3f];
1349    while ((bit & 0x3f) == 0)    while ((bit & 0x3f) == 0)
1350      {      {
1351      n--;      n--;
# Line 1347  DEFINE_COMPILER; Line 1372  DEFINE_COMPILER;
1372  struct sljit_jump *jump;  struct sljit_jump *jump;
1373  #endif  #endif
1374    
1375  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
1376  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1377  if (common->utf8)  if (common->utf8)
1378    {    {
# Line 1356  if (common->utf8) Line 1381  if (common->utf8)
1381    JUMPHERE(jump);    JUMPHERE(jump);
1382    }    }
1383  #endif  #endif
1384  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
1385  }  }
1386    
1387  static void peek_char(compiler_common *common)  static void peek_char(compiler_common *common)
# Line 1565  sljit_emit_fast_return(compiler, RETURN_ Line 1590  sljit_emit_fast_return(compiler, RETURN_
1590  JUMPHERE(jump);  JUMPHERE(jump);
1591    
1592  /* We only have types for characters less than 256. */  /* We only have types for characters less than 256. */
1593  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), (sljit_w)_pcre_utf8_table4 - 0xc0);  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), (sljit_w)PRIV(utf8_table4) - 0xc0);
1594  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1595  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
1596  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
# Line 1589  SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && si Line 1614  SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && si
1614    
1615  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);  sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);
1616  OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);  OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
1617  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_w)_pcre_ucd_stage1);  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_w)PRIV(ucd_stage1));
1618  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
1619  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
1620  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);
1621  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_w)_pcre_ucd_stage2);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_w)PRIV(ucd_stage2));
1622  OP1(SLJIT_MOV_UH, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);  OP1(SLJIT_MOV_UH, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);
1623  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_w)_pcre_ucd_records + SLJIT_OFFSETOF(ucd_record, chartype));  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_w)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));
1624  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
1625  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
1626  }  }
# Line 1614  struct sljit_jump *singlebyte; Line 1639  struct sljit_jump *singlebyte;
1639  #endif  #endif
1640  jump_list *newline = NULL;  jump_list *newline = NULL;
1641  BOOL newlinecheck = FALSE;  BOOL newlinecheck = FALSE;
1642  BOOL readbyte = FALSE;  BOOL readuchar = FALSE;
1643    
1644  if (!(hascrorlf || firstline) && (common->nltype == NLTYPE_ANY ||  if (!(hascrorlf || firstline) && (common->nltype == NLTYPE_ANY ||
1645      common->nltype == NLTYPE_ANYCRLF || common->newline > 255))      common->nltype == NLTYPE_ANYCRLF || common->newline > 255))
# Line 1629  if (firstline) Line 1654  if (firstline)
1654    if (common->nltype == NLTYPE_FIXED && common->newline > 255)    if (common->nltype == NLTYPE_FIXED && common->newline > 255)
1655      {      {
1656      mainloop = LABEL();      mainloop = LABEL();
1657      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
1658      end = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);      end = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
1659      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -1);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1));
1660      OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);      OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
1661      CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, mainloop);      CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, mainloop);
1662      CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, mainloop);      CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, mainloop);
1663      OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_LOCALS_REG), FIRSTLINE_END, STR_PTR, 0, SLJIT_IMM, 1);      OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_LOCALS_REG), FIRSTLINE_END, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
1664      }      }
1665    else    else
1666      {      {
# Line 1659  start = JUMP(SLJIT_JUMP); Line 1684  start = JUMP(SLJIT_JUMP);
1684  if (newlinecheck)  if (newlinecheck)
1685    {    {
1686    newlinelabel = LABEL();    newlinelabel = LABEL();
1687    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
1688    end = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);    end = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
1689    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
1690    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, common->newline & 0xff);    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, common->newline & 0xff);
1691    COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);    COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);
1692    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
# Line 1672  mainloop = LABEL(); Line 1697  mainloop = LABEL();
1697    
1698  /* Increasing the STR_PTR here requires one less jump in the most common case. */  /* Increasing the STR_PTR here requires one less jump in the most common case. */
1699  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1700  if (common->utf8) readbyte = TRUE;  if (common->utf8) readuchar = TRUE;
1701  #endif  #endif
1702  if (newlinecheck) readbyte = TRUE;  if (newlinecheck) readuchar = TRUE;
1703    
1704  if (readbyte)  if (readuchar)
1705    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
1706    
1707  if (newlinecheck)  if (newlinecheck)
1708    CMPTO(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, newlinelabel);    CMPTO(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, newlinelabel);
1709    
1710  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
1711  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1712  if (common->utf8)  if (common->utf8)
1713    {    {
1714    singlebyte = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    singlebyte = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
1715    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
1716    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1717    JUMPHERE(singlebyte);    JUMPHERE(singlebyte);
1718    }    }
# Line 1743  else Line 1768  else
1768      }      }
1769    }    }
1770    
1771  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
1772  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1773  if (common->utf8)  if (common->utf8)
1774    {    {
1775    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
1776    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
1777    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1778    }    }
1779  #endif  #endif
# Line 1875  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S Line 1900  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S
1900  if (common->utf8)  if (common->utf8)
1901    {    {
1902    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
1903    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
1904    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1905    }    }
1906  #endif  #endif
# Line 2257  static pcre_uchar *byte_sequence_compare Line 2282  static pcre_uchar *byte_sequence_compare
2282  {  {
2283  DEFINE_COMPILER;  DEFINE_COMPILER;
2284  unsigned int othercasebit = 0;  unsigned int othercasebit = 0;
2285  pcre_uint8 *othercasebyte = NULL;  pcre_uchar *othercasechar = NULL;
2286  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2287  int utf8length;  int utf8length;
2288  #endif  #endif
# Line 2267  if (caseless && char_has_othercase(commo Line 2292  if (caseless && char_has_othercase(commo
2292    othercasebit = char_get_othercase_bit(common, cc);    othercasebit = char_get_othercase_bit(common, cc);
2293    SLJIT_ASSERT(othercasebit);    SLJIT_ASSERT(othercasebit);
2294    /* Extracting bit difference info. */    /* Extracting bit difference info. */
2295    othercasebyte = cc + (othercasebit >> 8);  #ifdef COMPILE_PCRE8
2296      othercasechar = cc + (othercasebit >> 8);
2297    othercasebit &= 0xff;    othercasebit &= 0xff;
2298    #else
2299    #ifdef COMPILE_PCRE16
2300      othercasechar = cc + (othercasebit >> 9);
2301      if ((othercasebit & 0x100) != 0)
2302        othercasebit = (othercasebit & 0xff) << 8;
2303      else
2304        othercasebit &= 0xff;
2305    #endif
2306    #endif
2307    }    }
2308    
2309  if (context->sourcereg == -1)  if (context->sourcereg == -1)
2310    {    {
2311    #ifdef COMPILE_PCRE8
2312  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
2313    if (context->length >= 4)    if (context->length >= 4)
2314      OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
# Line 2281  if (context->sourcereg == -1) Line 2317  if (context->sourcereg == -1)
2317    else    else
2318  #endif  #endif
2319      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
2320    #else
2321    #ifdef COMPILE_PCRE16
2322    #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
2323      if (context->length >= 4)
2324        OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
2325      else
2326    #endif
2327        OP1(SLJIT_MOV_SH, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
2328    #endif
2329    #endif /* COMPILE_PCRE8 */
2330    context->sourcereg = TMP2;    context->sourcereg = TMP2;
2331    }    }
2332    
2333  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2334  utf8length = 1;  utf8length = 1;
2335  if (common->utf8 && *cc >= 0xc0)  if (common->utf8 && *cc >= 0xc0)
2336    utf8length += _pcre_utf8_table4[*cc & 0x3f];    utf8length += PRIV(utf8_table4)[*cc & 0x3f];
2337    
2338  do  do
2339    {    {
2340  #endif  #endif
2341    
2342    context->length--;    context->length -= IN_UCHARS(1);
2343  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
2344    
2345    /* Unaligned read is supported. */    /* Unaligned read is supported. */
2346    if (othercasebit != 0 && othercasebyte == cc)    if (othercasebit != 0 && othercasechar == cc)
2347      {      {
2348      context->c.asbytes[context->byteptr] = *cc | othercasebit;      context->c.asuchars[context->ucharptr] = *cc | othercasebit;
2349      context->oc.asbytes[context->byteptr] = othercasebit;      context->oc.asuchars[context->ucharptr] = othercasebit;
2350      }      }
2351    else    else
2352      {      {
2353      context->c.asbytes[context->byteptr] = *cc;      context->c.asuchars[context->ucharptr] = *cc;
2354      context->oc.asbytes[context->byteptr] = 0;      context->oc.asuchars[context->ucharptr] = 0;
2355      }      }
2356    context->byteptr++;    context->ucharptr++;
2357    
2358    if (context->byteptr >= 4 || context->length == 0 || (context->byteptr == 2 && context->length == 1))  #ifdef COMPILE_PCRE8
2359      if (context->ucharptr >= 4 || context->length == 0 || (context->ucharptr == 2 && context->length == 1))
2360    #else
2361      if (context->ucharptr >= 2 || context->length == 0)
2362    #endif
2363      {      {
2364      if (context->length >= 4)      if (context->length >= 4)
2365        OP1(SLJIT_MOV_SI, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);        OP1(SLJIT_MOV_SI, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
2366    #ifdef COMPILE_PCRE8
2367      else if (context->length >= 2)      else if (context->length >= 2)
2368        OP1(SLJIT_MOV_SH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);        OP1(SLJIT_MOV_SH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
2369      else if (context->length >= 1)      else if (context->length >= 1)
2370        OP1(SLJIT_MOV_UB, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);        OP1(SLJIT_MOV_UB, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
2371    #else
2372        else if (context->length >= 2)
2373          OP1(SLJIT_MOV_SH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
2374    #endif
2375      context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;      context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;
2376    
2377      switch(context->byteptr)      switch(context->ucharptr)
2378        {        {
2379        case 4:        case 4 / sizeof(pcre_uchar):
2380        if (context->oc.asint != 0)        if (context->oc.asint != 0)
2381          OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, context->oc.asint);          OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, context->oc.asint);
2382        add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asint | context->oc.asint));        add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asint | context->oc.asint));
2383        break;        break;
2384    
2385        case 2:        case 2 / sizeof(pcre_uchar):
2386        if (context->oc.asshort != 0)        if (context->oc.asshort != 0)
2387          OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, context->oc.asshort);          OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, context->oc.asshort);
2388        add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asshort | context->oc.asshort));        add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asshort | context->oc.asshort));
2389        break;        break;
2390    
2391    #ifdef COMPILE_PCRE8
2392        case 1:        case 1:
2393        if (context->oc.asbyte != 0)        if (context->oc.asbyte != 0)
2394          OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, context->oc.asbyte);          OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, context->oc.asbyte);
2395        add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asbyte | context->oc.asbyte));        add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asbyte | context->oc.asbyte));
2396        break;        break;
2397    #endif
2398    
2399        default:        default:
2400        SLJIT_ASSERT_STOP();        SLJIT_ASSERT_STOP();
2401        break;        break;
2402        }        }
2403      context->byteptr = 0;      context->ucharptr = 0;
2404      }      }
2405    
2406  #else  #else
2407    
2408    /* Unaligned read is unsupported. */    /* Unaligned read is unsupported. */
2409    #ifdef COMPILE_PCRE8
2410    if (context->length > 0)    if (context->length > 0)
2411      OP1(SLJIT_MOV_UB, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_UB, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
2412    #else
2413      if (context->length > 0)
2414        OP1(SLJIT_MOV_UH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
2415    #endif
2416    context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;    context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;
2417    
2418    if (othercasebit != 0 && othercasebyte == cc)    if (othercasebit != 0 && othercasechar == cc)
2419      {      {
2420      OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, othercasebit);      OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, othercasebit);
2421      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, *cc | othercasebit));      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, *cc | othercasebit));
# Line 2449  while (*cc != XCL_END) Line 2511  while (*cc != XCL_END)
2511      {      {
2512      cc += 2;      cc += 2;
2513  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2514      if (common->utf8 && cc[-1] >= 0xc0) cc += _pcre_utf8_table4[cc[-1] & 0x3f];      if (common->utf8 && cc[-1] >= 0xc0) cc += PRIV(utf8_table4)[cc[-1] & 0x3f];
2515  #endif  #endif
2516  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2517      needschar = TRUE;      needschar = TRUE;
# Line 2459  while (*cc != XCL_END) Line 2521  while (*cc != XCL_END)
2521      {      {
2522      cc += 2;      cc += 2;
2523  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2524      if (common->utf8 && cc[-1] >= 0xc0) cc += _pcre_utf8_table4[cc[-1] & 0x3f];      if (common->utf8 && cc[-1] >= 0xc0) cc += PRIV(utf8_table4)[cc[-1] & 0x3f];
2525  #endif  #endif
2526      cc++;      cc++;
2527  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2528      if (common->utf8 && cc[-1] >= 0xc0) cc += _pcre_utf8_table4[cc[-1] & 0x3f];      if (common->utf8 && cc[-1] >= 0xc0) cc += PRIV(utf8_table4)[cc[-1] & 0x3f];
2529  #endif  #endif
2530  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2531      needschar = TRUE;      needschar = TRUE;
# Line 2533  if (needstype || needsscript) Line 2595  if (needstype || needsscript)
2595      {      {
2596      if (scriptreg == TMP1)      if (scriptreg == TMP1)
2597        {        {
2598        OP1(SLJIT_MOV, scriptreg, 0, SLJIT_IMM, (sljit_w)_pcre_ucd_records + SLJIT_OFFSETOF(ucd_record, script));        OP1(SLJIT_MOV, scriptreg, 0, SLJIT_IMM, (sljit_w)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, script));
2599        OP1(SLJIT_MOV_UB, scriptreg, 0, SLJIT_MEM2(scriptreg, TMP2), 3);        OP1(SLJIT_MOV_UB, scriptreg, 0, SLJIT_MEM2(scriptreg, TMP2), 3);
2600        }        }
2601      else      else
2602        {        {
2603        OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3);        OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3);
2604        OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, SLJIT_IMM, (sljit_w)_pcre_ucd_records + SLJIT_OFFSETOF(ucd_record, script));        OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, SLJIT_IMM, (sljit_w)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, script));
2605        OP1(SLJIT_MOV_UB, scriptreg, 0, SLJIT_MEM1(TMP2), 0);        OP1(SLJIT_MOV_UB, scriptreg, 0, SLJIT_MEM1(TMP2), 0);
2606        }        }
2607      }      }
# Line 2660  while (*cc != XCL_END) Line 2722  while (*cc != XCL_END)
2722        break;        break;
2723    
2724        case PT_GC:        case PT_GC:
2725        c = _pcre_ucp_typerange[(int)cc[1] * 2];        c = PRIV(ucp_typerange)[(int)cc[1] * 2];
2726        SET_TYPE_OFFSET(c);        SET_TYPE_OFFSET(c);
2727        jump = CMP(SLJIT_C_LESS_EQUAL ^ invertcmp, typereg, 0, SLJIT_IMM, _pcre_ucp_typerange[(int)cc[1] * 2 + 1] - c);        jump = CMP(SLJIT_C_LESS_EQUAL ^ invertcmp, typereg, 0, SLJIT_IMM, PRIV(ucp_typerange)[(int)cc[1] * 2 + 1] - c);
2728        break;        break;
2729    
2730        case PT_PC:        case PT_PC:
# Line 2806  switch(type) Line 2868  switch(type)
2868      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2869      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);
2870      jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);      jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
2871      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0);      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
2872      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
2873      JUMPHERE(jump[0]);      JUMPHERE(jump[0]);
2874      return cc;      return cc;
# Line 3019  switch(type) Line 3081  switch(type)
3081    
3082    case OP_CHAR:    case OP_CHAR:
3083    case OP_CHARI:    case OP_CHARI:
3084    length = 1;    length = IN_UCHARS(1);
3085  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
3086    if (common->utf8 && *cc >= 0xc0) length += _pcre_utf8_table4[*cc & 0x3f];    if (common->utf8 && *cc >= 0xc0) length += PRIV(utf8_table4)[*cc & 0x3f];
3087  #endif  #endif
3088    if (type == OP_CHAR || !char_has_othercase(common, cc) || char_get_othercase_bit(common, cc) != 0)    if (type == OP_CHAR || !char_has_othercase(common, cc) || char_get_othercase_bit(common, cc) != 0)
3089      {      {
# Line 3031  switch(type) Line 3093  switch(type)
3093      context.length = length;      context.length = length;
3094      context.sourcereg = -1;      context.sourcereg = -1;
3095  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
3096      context.byteptr = 0;      context.ucharptr = 0;
3097  #endif  #endif
3098      return byte_sequence_compare(common, type == OP_CHARI, cc, &context, fallbacks);      return byte_sequence_compare(common, type == OP_CHARI, cc, &context, fallbacks);
3099      }      }
3100    add_jump(compiler, fallbacks, CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));    check_input_end(common, fallbacks);
3101    read_char(common);    read_char(common);
3102  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
3103    if (common->utf8)    if (common->utf8)
# Line 3058  switch(type) Line 3120  switch(type)
3120  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
3121    if (common->utf8)    if (common->utf8)
3122      {      {
3123      if (*cc >= 0xc0) length += _pcre_utf8_table4[*cc & 0x3f];      if (*cc >= 0xc0) length += PRIV(utf8_table4)[*cc & 0x3f];
3124    
3125      check_input_end(common, fallbacks);      check_input_end(common, fallbacks);
3126      GETCHAR(c, cc);      GETCHAR(c, cc);
# Line 3077  switch(type) Line 3139  switch(type)
3139        /* Skip the variable-length character. */        /* Skip the variable-length character. */
3140        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);
3141        jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);        jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
3142        OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0);        OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
3143        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
3144        JUMPHERE(jump[0]);        JUMPHERE(jump[0]);
3145        return cc + length;        return cc + length;
# Line 3192  do Line 3254  do
3254      size = 1;      size = 1;
3255  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
3256      if (common->utf8 && cc[1] >= 0xc0)      if (common->utf8 && cc[1] >= 0xc0)
3257        size += _pcre_utf8_table4[cc[1] & 0x3f];        size += PRIV(utf8_table4)[cc[1] & 0x3f];
3258  #endif  #endif
3259      }      }
3260    else if (*cc == OP_CHARI)    else if (*cc == OP_CHARI)
# Line 3204  do Line 3266  do
3266        if (char_has_othercase(common, cc + 1) && char_get_othercase_bit(common, cc + 1) == 0)        if (char_has_othercase(common, cc + 1) && char_get_othercase_bit(common, cc + 1) == 0)
3267          size = 0;          size = 0;
3268        else if (cc[1] >= 0xc0)        else if (cc[1] >= 0xc0)
3269          size += _pcre_utf8_table4[cc[1] & 0x3f];          size += PRIV(utf8_table4)[cc[1] & 0x3f];
3270        }        }
3271      else      else
3272  #endif  #endif
# Line 3215  do Line 3277  do
3277      size = 0;      size = 0;
3278    
3279    cc += 1 + size;    cc += 1 + size;
3280    context.length += size;    context.length += IN_UCHARS(size);
3281    }    }
3282  while (size > 0 && context.length <= 128);  while (size > 0 && context.length <= 128);
3283    
# Line 3228  if (context.length > 0) Line 3290  if (context.length > 0)
3290    
3291    context.sourcereg = -1;    context.sourcereg = -1;
3292  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
3293    context.byteptr = 0;    context.ucharptr = 0;
3294  #endif  #endif
3295    do cc = byte_sequence_compare(common, *cc == OP_CHARI, cc + 1, &context, fallbacks); while (context.length > 0);    do cc = byte_sequence_compare(common, *cc == OP_CHARI, cc + 1, &context, fallbacks); while (context.length > 0);
3296    sljit_emit_op0(compiler, SLJIT_NOP);
3297    return cc;    return cc;
3298    }    }
3299    
# Line 3557  if (*cc == OP_BRAZERO || *cc == OP_BRAMI Line 3620  if (*cc == OP_BRAZERO || *cc == OP_BRAMI
3620    bra = *cc;    bra = *cc;
3621    cc++;    cc++;
3622    }    }
3623  localptr = PRIV(cc);  localptr = PRIV_DATA(cc);
3624  SLJIT_ASSERT(localptr != 0);  SLJIT_ASSERT(localptr != 0);
3625  framesize = get_framesize(common, cc, FALSE);  framesize = get_framesize(common, cc, FALSE);
3626  fallback->framesize = framesize;  fallback->framesize = framesize;
# Line 4043  if (opcode == OP_CBRA || opcode == OP_SC Line 4106  if (opcode == OP_CBRA || opcode == OP_SC
4106  else if (opcode == OP_ONCE || opcode == OP_SBRA || opcode == OP_SCOND)  else if (opcode == OP_ONCE || opcode == OP_SBRA || opcode == OP_SCOND)
4107    {    {
4108    /* Other brackets simply allocate the next entry. */    /* Other brackets simply allocate the next entry. */
4109    localptr = PRIV(ccbegin);    localptr = PRIV_DATA(ccbegin);
4110    SLJIT_ASSERT(localptr != 0);    SLJIT_ASSERT(localptr != 0);
4111    FALLBACK_AS(bracket_fallback)->localptr = localptr;    FALLBACK_AS(bracket_fallback)->localptr = localptr;
4112    if (opcode == OP_ONCE)    if (opcode == OP_ONCE)
# Line 4429  if (*cc == OP_BRAPOSZERO) Line 4492  if (*cc == OP_BRAPOSZERO)
4492    }    }
4493    
4494  opcode = *cc;  opcode = *cc;
4495  localptr = PRIV(cc);  localptr = PRIV_DATA(cc);
4496  SLJIT_ASSERT(localptr != 0);  SLJIT_ASSERT(localptr != 0);
4497  FALLBACK_AS(bracketpos_fallback)->localptr = localptr;  FALLBACK_AS(bracketpos_fallback)->localptr = localptr;
4498  switch(opcode)  switch(opcode)
# Line 4709  if (end != NULL) Line 4772  if (end != NULL)
4772    {    {
4773    *end = cc + 1;    *end = cc + 1;
4774  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
4775    if (common->utf8 && *cc >= 0xc0) *end += _pcre_utf8_table4[*cc & 0x3f];    if (common->utf8 && *cc >= 0xc0) *end += PRIV(utf8_table4)[*cc & 0x3f];
4776  #endif  #endif
4777    }    }
4778  return cc;  return cc;
# Line 6088  sljit_emit_fast_return(compiler, SLJIT_M Line 6151  sljit_emit_fast_return(compiler, SLJIT_M
6151  #undef CURRENT_AS  #undef CURRENT_AS
6152    
6153  void  void
6154  _pcre_jit_compile(const real_pcre *re, pcre_extra *extra)  PRIV(jit_compile)(const real_pcre *re, pcre_extra *extra)
6155  {  {
6156  struct sljit_compiler *compiler;  struct sljit_compiler *compiler;
6157  fallback_common rootfallback;  fallback_common rootfallback;
# Line 6111  SLJIT_ASSERT((extra->flags & PCRE_EXTRA_ Line 6174  SLJIT_ASSERT((extra->flags & PCRE_EXTRA_
6174  study = extra->study_data;  study = extra->study_data;
6175    
6176  if (!tables)  if (!tables)
6177    tables = _pcre_default_tables;    tables = PRIV(default_tables);
6178    
6179  memset(&rootfallback, 0, sizeof(fallback_common));  memset(&rootfallback, 0, sizeof(fallback_common));
6180  rootfallback.cc = (pcre_uchar *)re + re->name_table_offset + re->name_count * re->name_entry_size;  rootfallback.cc = (pcre_uchar *)re + re->name_table_offset + re->name_count * re->name_entry_size;
# Line 6284  if ((re->options & PCRE_ANCHORED) == 0) Line 6347  if ((re->options & PCRE_ANCHORED) == 0)
6347      {      {
6348      if (study != NULL && study->minlength > 1)      if (study != NULL && study->minlength > 1)
6349        {        {
6350        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, study->minlength);        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength));
6351        CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, STR_END, 0, mainloop);        CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, STR_END, 0, mainloop);
6352        }        }
6353      else      else
# Line 6294  if ((re->options & PCRE_ANCHORED) == 0) Line 6357  if ((re->options & PCRE_ANCHORED) == 0)
6357      {      {
6358      if (study != NULL && study->minlength > 1)      if (study != NULL && study->minlength > 1)
6359        {        {
6360        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, study->minlength);        OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength));
6361        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);
6362        COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_GREATER);        COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_GREATER);
6363        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), FIRSTLINE_END);        OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), FIRSTLINE_END);
# Line 6467  return convert_executable_func.call_exec Line 6530  return convert_executable_func.call_exec
6530  }  }
6531    
6532  int  int
6533  _pcre_jit_exec(const real_pcre *re, void *executable_func,  PRIV(jit_exec)(const real_pcre *re, void *executable_func,
6534    PCRE_SPTR subject, int length, int start_offset, int options,    const pcre_uchar *subject, int length, int start_offset, int options,
6535    int match_limit, int *offsets, int offsetcount)    int match_limit, int *offsets, int offsetcount)
6536  {  {
6537  executable_function *function = (executable_function*)executable_func;  executable_function *function = (executable_function*)executable_func;
# Line 6523  return retval; Line 6586  return retval;
6586  }  }
6587    
6588  void  void
6589  _pcre_jit_free(void *executable_func)  PRIV(jit_free)(void *executable_func)
6590  {  {
6591  executable_function *function = (executable_function*)executable_func;  executable_function *function = (executable_function*)executable_func;
6592  sljit_free_code(function->executable_func);  sljit_free_code(function->executable_func);
6593  SLJIT_FREE(function);  SLJIT_FREE(function);
6594  }  }
6595    
6596    #ifdef COMPILE_PCRE8
6597  PCRE_EXP_DECL pcre_jit_stack *  PCRE_EXP_DECL pcre_jit_stack *
6598  pcre_jit_stack_alloc(int startsize, int maxsize)  pcre_jit_stack_alloc(int startsize, int maxsize)
6599    #else
6600    PCRE_EXP_DECL pcre_jit_stack *
6601    pcre16_jit_stack_alloc(int startsize, int maxsize)
6602    #endif
6603  {  {
6604  if (startsize < 1 || maxsize < 1)  if (startsize < 1 || maxsize < 1)
6605    return NULL;    return NULL;
# Line 6542  maxsize = (maxsize + STACK_GROWTH_RATE - Line 6610  maxsize = (maxsize + STACK_GROWTH_RATE -
6610  return (pcre_jit_stack*)sljit_allocate_stack(startsize, maxsize);  return (pcre_jit_stack*)sljit_allocate_stack(startsize, maxsize);
6611  }  }
6612    
6613    #ifdef COMPILE_PCRE8
6614  PCRE_EXP_DECL void  PCRE_EXP_DECL void
6615  pcre_jit_stack_free(pcre_jit_stack *stack)  pcre_jit_stack_free(pcre_jit_stack *stack)
6616    #else
6617    PCRE_EXP_DECL void
6618    pcre16_jit_stack_free(pcre_jit_stack *stack)
6619    #endif
6620  {  {
6621  sljit_free_stack((struct sljit_stack*)stack);  sljit_free_stack((struct sljit_stack*)stack);
6622  }  }
6623    
6624    #ifdef COMPILE_PCRE8
6625  PCRE_EXP_DECL void  PCRE_EXP_DECL void
6626  pcre_assign_jit_stack(pcre_extra *extra, pcre_jit_callback callback, void *userdata)  pcre_assign_jit_stack(pcre_extra *extra, pcre_jit_callback callback, void *userdata)
6627    #else
6628    PCRE_EXP_DECL void
6629    pcre16_assign_jit_stack(pcre_extra *extra, pcre_jit_callback callback, void *userdata)
6630    #endif
6631  {  {
6632  executable_function *function;  executable_function *function;
6633  if (extra != NULL &&  if (extra != NULL &&
# Line 6567  if (extra != NULL && Line 6645  if (extra != NULL &&
6645  /* These are dummy functions to avoid linking errors when JIT support is not  /* These are dummy functions to avoid linking errors when JIT support is not
6646  being compiled. */  being compiled. */
6647    
6648    #ifdef COMPILE_PCRE8
6649  PCRE_EXP_DECL pcre_jit_stack *  PCRE_EXP_DECL pcre_jit_stack *
6650  pcre_jit_stack_alloc(int startsize, int maxsize)  pcre_jit_stack_alloc(int startsize, int maxsize)
6651    #else
6652    PCRE_EXP_DECL pcre_jit_stack *
6653    pcre16_jit_stack_alloc(int startsize, int maxsize)
6654    #endif
6655  {  {
6656  (void)startsize;  (void)startsize;
6657  (void)maxsize;  (void)maxsize;
6658  return NULL;  return NULL;
6659  }  }
6660    
6661    #ifdef COMPILE_PCRE8
6662  PCRE_EXP_DECL void  PCRE_EXP_DECL void
6663  pcre_jit_stack_free(pcre_jit_stack *stack)  pcre_jit_stack_free(pcre_jit_stack *stack)
6664    #else
6665    PCRE_EXP_DECL void
6666    pcre16_jit_stack_free(pcre_jit_stack *stack)
6667    #endif
6668  {  {
6669  (void)stack;  (void)stack;
6670  }  }
6671    
6672    #ifdef COMPILE_PCRE8
6673  PCRE_EXP_DECL void  PCRE_EXP_DECL void
6674  pcre_assign_jit_stack(pcre_extra *extra, pcre_jit_callback callback, void *userdata)  pcre_assign_jit_stack(pcre_extra *extra, pcre_jit_callback callback, void *userdata)
6675    #else
6676    PCRE_EXP_DECL void
6677    pcre16_assign_jit_stack(pcre_extra *extra, pcre_jit_callback callback, void *userdata)
6678    #endif
6679  {  {
6680  (void)extra;  (void)extra;
6681  (void)callback;  (void)callback;

Legend:
Removed from v.763  
changed lines
  Added in v.767

  ViewVC Help
Powered by ViewVC 1.1.5