/[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 1426 by zherczeg, Wed Jan 1 13:14:19 2014 UTC revision 1427 by zherczeg, Wed Jan 1 15:15:09 2014 UTC
# Line 2563  DEFINE_COMPILER; Line 2563  DEFINE_COMPILER;
2563  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2564  struct sljit_jump *jump;  struct sljit_jump *jump;
2565  #endif  #endif
2566    #if defined SUPPORT_UTF && defined COMPILE_PCRE8
2567    struct sljit_jump *jump2;
2568    #endif
2569    
2570  SLJIT_UNUSED_ARG(update_str_ptr);  SLJIT_UNUSED_ARG(update_str_ptr);
2571  SLJIT_UNUSED_ARG(min);  SLJIT_UNUSED_ARG(min);
2572  SLJIT_UNUSED_ARG(max);  SLJIT_UNUSED_ARG(max);
2573  SLJIT_ASSERT(min <= max);  SLJIT_ASSERT(min <= max);
2574    
2575  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
2576  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2577    
2578  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
# Line 2578  if (common->utf) Line 2581  if (common->utf)
2581    if (max < 128 && !update_str_ptr) return;    if (max < 128 && !update_str_ptr) return;
2582    
2583    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
2584    if (max >= 0x800)    if (min >= 0x10000)
2585        {
2586        OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xf0);
2587        if (update_str_ptr)
2588          OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
2589        OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
2590        jump2 = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0x7);
2591        OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
2592        OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);
2593        OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
2594        OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
2595        OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);
2596        OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
2597        OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
2598        OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(2));
2599        if (!update_str_ptr)
2600          OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(3));
2601        OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);
2602        OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
2603        OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
2604        JUMPHERE(jump2);
2605        if (update_str_ptr)
2606          OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, RETURN_ADDR, 0);
2607        }
2608      else if (min >= 0x800 && max <= 0xffff)
2609        {
2610        OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xe0);
2611        if (update_str_ptr)
2612          OP1(SLJIT_MOV_UB, RETURN_ADDR, 0, SLJIT_MEM1(TMP1), (sljit_sw)PRIV(utf8_table4) - 0xc0);
2613        OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
2614        jump2 = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 0xf);
2615        OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
2616        OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);
2617        OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
2618        OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
2619        if (!update_str_ptr)
2620          OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
2621        OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);
2622        OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
2623        OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
2624        JUMPHERE(jump2);
2625        if (update_str_ptr)
2626          OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, RETURN_ADDR, 0);
2627        }
2628      else if (max >= 0x800)
2629      add_jump(compiler, (max < 0x10000) ? &common->utfreadchar16 : &common->utfreadchar, JUMP(SLJIT_FAST_CALL));      add_jump(compiler, (max < 0x10000) ? &common->utfreadchar16 : &common->utfreadchar, JUMP(SLJIT_FAST_CALL));
2630    else if (max < 128)    else if (max < 128)
2631      {      {
# Line 4502  while (*cc != XCL_END) Line 4549  while (*cc != XCL_END)
4549  /* We are not necessary in utf mode even in 8 bit mode. */  /* We are not necessary in utf mode even in 8 bit mode. */
4550  cc = ccbegin;  cc = ccbegin;
4551  detect_partial_match(common, backtracks);  detect_partial_match(common, backtracks);
4552  read_char_range(common, min, max, (cc[0] & XCL_NOT) != 0);  read_char_range(common, min, max, (cc[-1] & XCL_NOT) != 0);
4553    
4554  if ((cc[-1] & XCL_HASPROP) == 0)  if ((cc[-1] & XCL_HASPROP) == 0)
4555    {    {
# Line 4525  if ((cc[-1] & XCL_HASPROP) == 0) Line 4572  if ((cc[-1] & XCL_HASPROP) == 0)
4572      cc += 32 / sizeof(pcre_uchar);      cc += 32 / sizeof(pcre_uchar);
4573      }      }
4574    else    else
4575      add_jump(compiler, (cc[-1] & XCL_NOT) == 0 ? backtracks : &found, CMP(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, 0xff));      {
4576        OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, min);
4577        add_jump(compiler, (cc[-1] & XCL_NOT) == 0 ? backtracks : &found, CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, max - min));
4578        }
4579    }    }
4580  else if ((cc[-1] & XCL_MAP) != 0)  else if ((cc[-1] & XCL_MAP) != 0)
4581    {    {

Legend:
Removed from v.1426  
changed lines
  Added in v.1427

  ViewVC Help
Powered by ViewVC 1.1.5