/[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 769 by zherczeg, Sun Nov 27 17:40:33 2011 UTC revision 770 by zherczeg, Mon Nov 28 20:39:30 2011 UTC
# Line 592  switch(*cc) Line 592  switch(*cc)
592    
593    case OP_CLASS:    case OP_CLASS:
594    case OP_NCLASS:    case OP_NCLASS:
595    return cc + 33;    return cc + 1 + 32 / sizeof(pcre_uchar);
596    
597  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
598    case OP_XCLASS:    case OP_XCLASS:
599    return cc + GET(cc, 1);    return cc + GET(cc, 1);
600  #endif  #endif
# Line 1879  if (firstline) Line 1879  if (firstline)
1879    
1880  start = LABEL();  start = LABEL();
1881  leave = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);  leave = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
1882  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
1883  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1884  if (common->utf8)  if (common->utf8)
1885    OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);    OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);
1886  #endif  #endif
1887    #ifndef COMPILE_PCRE8
1888    OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xff);
1889    #endif
1890  OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);  OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
1891  OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);  OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
1892  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), start_bits);  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), start_bits);
# Line 1891  OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TM Line 1894  OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TM
1894  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
1895  found = JUMP(SLJIT_C_NOT_ZERO);  found = JUMP(SLJIT_C_NOT_ZERO);
1896    
1897  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1898  if (common->utf8)  if (common->utf8)
1899    OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);    OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
1900  #endif  #endif
1901  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));
1902  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
1903  if (common->utf8)  if (common->utf8)
1904    {    {
# Line 2435  while (utf8length > 0); Line 2438  while (utf8length > 0);
2438  return cc;  return cc;
2439  }  }
2440    
2441  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
2442    
2443  #define SET_TYPE_OFFSET(value) \  #define SET_TYPE_OFFSET(value) \
2444    if ((value) != typeoffset) \    if ((value) != typeoffset) \
# Line 2482  read_char(common); Line 2485  read_char(common);
2485  if ((*cc++ & XCL_MAP) != 0)  if ((*cc++ & XCL_MAP) != 0)
2486    {    {
2487    OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);    OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);
2488    #ifndef COMPILE_PCRE8
2489      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
2490    #elif defined SUPPORT_UTF8
2491    if (common->utf8)    if (common->utf8)
2492      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
2493    #endif
2494    
2495    OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);    OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
2496    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
# Line 2492  if ((*cc++ & XCL_MAP) != 0) Line 2499  if ((*cc++ & XCL_MAP) != 0)
2499    OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);    OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
2500    add_jump(compiler, list, JUMP(SLJIT_C_NOT_ZERO));    add_jump(compiler, list, JUMP(SLJIT_C_NOT_ZERO));
2501    
2502    #ifndef COMPILE_PCRE8
2503      JUMPHERE(jump);
2504    #elif defined SUPPORT_UTF8
2505    if (common->utf8)    if (common->utf8)
2506      JUMPHERE(jump);      JUMPHERE(jump);
2507    #endif
2508    OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);    OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
2509  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2510    charsaved = TRUE;    charsaved = TRUE;
2511  #endif  #endif
2512    cc += 32;    cc += 32 / sizeof(pcre_uchar);
2513    }    }
2514    
2515  /* Scanning the necessary info. */  /* Scanning the necessary info. */
# Line 3179  switch(type) Line 3190  switch(type)
3190    case OP_NCLASS:    case OP_NCLASS:
3191    check_input_end(common, fallbacks);    check_input_end(common, fallbacks);
3192    read_char(common);    read_char(common);
3193  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
3194    jump[0] = NULL;    jump[0] = NULL;
3195    #ifdef SUPPORT_UTF8
3196      /* This check can only be skipped in pure 8 bit mode. */
3197    if (common->utf8)    if (common->utf8)
3198    #endif
3199      {      {
3200      jump[0] = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);      jump[0] = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
3201      if (type == OP_CLASS)      if (type == OP_CLASS)
# Line 3197  switch(type) Line 3211  switch(type)
3211    OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);    OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
3212    OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);    OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
3213    add_jump(compiler, fallbacks, JUMP(SLJIT_C_ZERO));    add_jump(compiler, fallbacks, JUMP(SLJIT_C_ZERO));
3214  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
3215    if (jump[0] != NULL)    if (jump[0] != NULL)
3216      JUMPHERE(jump[0]);      JUMPHERE(jump[0]);
3217  #endif  #endif
3218    return cc + 32;    return cc + 32 / sizeof(pcre_uchar);
3219    
3220  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || defined COMPILE_PCRE16
3221    case OP_XCLASS:    case OP_XCLASS:
3222    compile_xclass_hotpath(common, cc + LINK_SIZE, fallbacks);    compile_xclass_hotpath(common, cc + LINK_SIZE, fallbacks);
3223    return cc + GET(cc, 0) - 1;    return cc + GET(cc, 0) - 1;
# Line 4725  else Line 4739  else
4739    SLJIT_ASSERT(*opcode >= OP_CLASS || *opcode <= OP_XCLASS);    SLJIT_ASSERT(*opcode >= OP_CLASS || *opcode <= OP_XCLASS);
4740    *type = *opcode;    *type = *opcode;
4741    cc++;    cc++;
4742    class_len = (*type < OP_XCLASS) ? 33 : GET(cc, 0);    class_len = (*type < OP_XCLASS) ? (1 + (32 / sizeof(pcre_uchar))) : GET(cc, 0);
4743    *opcode = cc[class_len - 1];    *opcode = cc[class_len - 1];
4744    if (*opcode >= OP_CRSTAR && *opcode <= OP_CRMINQUERY)    if (*opcode >= OP_CRSTAR && *opcode <= OP_CRMINQUERY)
4745      {      {
# Line 5133  while (cc < ccend) Line 5147  while (cc < ccend)
5147    
5148      case OP_CLASS:      case OP_CLASS:
5149      case OP_NCLASS:      case OP_NCLASS:
5150      if (cc[33] >= OP_CRSTAR && cc[33] <= OP_CRMINRANGE)      if (cc[1 + (32 / sizeof(pcre_uchar))] >= OP_CRSTAR && cc[1 + (32 / sizeof(pcre_uchar))] <= OP_CRMINRANGE)
5151        cc = compile_iterator_hotpath(common, cc, parent);        cc = compile_iterator_hotpath(common, cc, parent);
5152      else      else
5153        cc = compile_char1_hotpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextfallbacks : &parent->topfallbacks);        cc = compile_char1_hotpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextfallbacks : &parent->topfallbacks);
5154      break;      break;
5155    
5156  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || defined COMPILE_PCRE16
5157      case OP_XCLASS:      case OP_XCLASS:
5158      if (*(cc + GET(cc, 1)) >= OP_CRSTAR && *(cc + GET(cc, 1)) <= OP_CRMINRANGE)      if (*(cc + GET(cc, 1)) >= OP_CRSTAR && *(cc + GET(cc, 1)) <= OP_CRMINRANGE)
5159        cc = compile_iterator_hotpath(common, cc, parent);        cc = compile_iterator_hotpath(common, cc, parent);
# Line 5994  while (current) Line 6008  while (current)
6008      case OP_TYPEPOSUPTO:      case OP_TYPEPOSUPTO:
6009      case OP_CLASS:      case OP_CLASS:
6010      case OP_NCLASS:      case OP_NCLASS:
6011    #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
6012      case OP_XCLASS:      case OP_XCLASS:
6013    #endif
6014      compile_iterator_fallbackpath(common, current);      compile_iterator_fallbackpath(common, current);
6015      break;      break;
6016    

Legend:
Removed from v.769  
changed lines
  Added in v.770

  ViewVC Help
Powered by ViewVC 1.1.5