/[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 788 by ph10, Tue Dec 6 15:38:01 2011 UTC revision 883 by zherczeg, Mon Jan 16 08:35:42 2012 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2008 University of Cambridge             Copyright (c) 1997-2012 University of Cambridge
10    
11    The machine code generator part (this module) was written by Zoltan Herczeg    The machine code generator part (this module) was written by Zoltan Herczeg
12                        Copyright (c) 2010-2011                        Copyright (c) 2010-2012
13    
14  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
15  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 52  POSSIBILITY OF SUCH DAMAGE. Line 52  POSSIBILITY OF SUCH DAMAGE.
52  we just include it. This way we don't need to touch the build  we just include it. This way we don't need to touch the build
53  system files. */  system files. */
54    
55  #define SLJIT_MALLOC(size) (pcre_malloc)(size)  #define SLJIT_MALLOC(size) (PUBL(malloc))(size)
56  #define SLJIT_FREE(ptr) (pcre_free)(ptr)  #define SLJIT_FREE(ptr) (PUBL(free))(ptr)
57  #define SLJIT_CONFIG_AUTO 1  #define SLJIT_CONFIG_AUTO 1
58  #define SLJIT_CONFIG_STATIC 1  #define SLJIT_CONFIG_STATIC 1
59  #define SLJIT_VERBOSE 0  #define SLJIT_VERBOSE 0
# 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    uschar *ptr;    pcre_uchar *ptr;
156    /* Everything else after. */    /* Everything else after. */
157    int offsetcount;    int offsetcount;
158    int calllimit;    int calllimit;
159    uschar notbol;    pcre_uint8 notbol;
160    uschar noteol;    pcre_uint8 noteol;
161    uschar notempty;    pcre_uint8 notempty;
162    uschar notempty_atstart;    pcre_uint8 notempty_atstart;
163  } jit_arguments;  } jit_arguments;
164    
165  typedef struct executable_function {  typedef struct executable_function {
166    void *executable_func;    void *executable_func;
167    pcre_jit_callback callback;    PUBL(jit_callback) callback;
168    void *userdata;    void *userdata;
169    sljit_uw executable_size;    sljit_uw executable_size;
170  } executable_function;  } executable_function;
# Line 198  typedef struct fallback_common { Line 198  typedef struct fallback_common {
198    struct fallback_common *top;    struct fallback_common *top;
199    jump_list *topfallbacks;    jump_list *topfallbacks;
200    /* Opcode pointer. */    /* Opcode pointer. */
201    uschar *cc;    pcre_uchar *cc;
202  } fallback_common;  } fallback_common;
203    
204  typedef struct assert_fallback {  typedef struct assert_fallback {
# Line 269  typedef struct recurse_fallback { Line 269  typedef struct recurse_fallback {
269    
270  typedef struct compiler_common {  typedef struct compiler_common {
271    struct sljit_compiler *compiler;    struct sljit_compiler *compiler;
272    uschar *start;    pcre_uchar *start;
273    int localsize;    int localsize;
274    int *localptrs;    int *localptrs;
275    const uschar *fcc;    const pcre_uint8 *fcc;
276    sljit_w lcc;    sljit_w lcc;
277    int cbraptr;    int cbraptr;
278    int nltype;    int nltype;
# Line 298  typedef struct compiler_common { Line 298  typedef struct compiler_common {
298    jump_list *casefulcmp;    jump_list *casefulcmp;
299    jump_list *caselesscmp;    jump_list *caselesscmp;
300    BOOL jscript_compat;    BOOL jscript_compat;
301  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
302    BOOL utf8;    BOOL utf;
303  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
304    BOOL useucp;    BOOL use_ucp;
305  #endif  #endif
306    jump_list *utf8readchar;    jump_list *utfreadchar;
307    jump_list *utf8readtype8;  #ifdef COMPILE_PCRE8
308      jump_list *utfreadtype8;
309  #endif  #endif
310    #endif /* SUPPORT_UTF */
311  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
312    jump_list *getucd;    jump_list *getucd;
313  #endif  #endif
# Line 317  typedef struct compare_context { Line 319  typedef struct compare_context {
319    int length;    int length;
320    int sourcereg;    int sourcereg;
321  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
322    int byteptr;    int ucharptr;
323    union {    union {
324      int asint;      sljit_i asint;
325      short asshort;      sljit_uh asushort;
326    #ifdef COMPILE_PCRE8
327      sljit_ub asbyte;      sljit_ub asbyte;
328      sljit_ub asbytes[4];      sljit_ub asuchars[4];
329    #else
330    #ifdef COMPILE_PCRE16
331        sljit_uh asuchars[2];
332    #endif
333    #endif
334    } c;    } c;
335    union {    union {
336      int asint;      sljit_i asint;
337      short asshort;      sljit_uh asushort;
338    #ifdef COMPILE_PCRE8
339      sljit_ub asbyte;      sljit_ub asbyte;
340      sljit_ub asbytes[4];      sljit_ub asuchars[4];
341    #else
342    #ifdef COMPILE_PCRE16
343        sljit_uh asuchars[2];
344    #endif
345    #endif
346    } oc;    } oc;
347  #endif  #endif
348  } compare_context;  } compare_context;
# Line 338  enum { Line 352  enum {
352    frame_setstrbegin = -1    frame_setstrbegin = -1
353  };  };
354    
355    /* Undefine sljit macros. */
356    #undef CMP
357    
358  /* Used for accessing the elements of the stack. */  /* Used for accessing the elements of the stack. */
359  #define STACK(i)      ((-(i) - 1) * (int)sizeof(sljit_w))  #define STACK(i)      ((-(i) - 1) * (int)sizeof(sljit_w))
360    
361  #define TMP1          SLJIT_TEMPORARY_REG1  #define TMP1          SLJIT_TEMPORARY_REG1
362  #define TMP2          SLJIT_TEMPORARY_REG3  #define TMP2          SLJIT_TEMPORARY_REG3
363  #define TMP3          SLJIT_TEMPORARY_EREG2  #define TMP3          SLJIT_TEMPORARY_EREG2
364  #define STR_PTR       SLJIT_GENERAL_REG1  #define STR_PTR       SLJIT_SAVED_REG1
365  #define STR_END       SLJIT_GENERAL_REG2  #define STR_END       SLJIT_SAVED_REG2
366  #define STACK_TOP     SLJIT_TEMPORARY_REG2  #define STACK_TOP     SLJIT_TEMPORARY_REG2
367  #define STACK_LIMIT   SLJIT_GENERAL_REG3  #define STACK_LIMIT   SLJIT_SAVED_REG3
368  #define ARGUMENTS     SLJIT_GENERAL_EREG1  #define ARGUMENTS     SLJIT_SAVED_EREG1
369  #define CALL_COUNT    SLJIT_GENERAL_EREG2  #define CALL_COUNT    SLJIT_SAVED_EREG2
370  #define RETURN_ADDR   SLJIT_TEMPORARY_EREG1  #define RETURN_ADDR   SLJIT_TEMPORARY_EREG1
371    
372  /* Locals layout. */  /* Locals layout. */
# Line 364  enum { Line 381  enum {
381  /* Max limit of recursions. */  /* Max limit of recursions. */
382  #define CALL_LIMIT       (5 * sizeof(sljit_w))  #define CALL_LIMIT       (5 * sizeof(sljit_w))
383  /* Last known position of the requested byte. */  /* Last known position of the requested byte. */
384  #define REQ_BYTE_PTR     (6 * sizeof(sljit_w))  #define REQ_CHAR_PTR     (6 * sizeof(sljit_w))
385  /* End pointer of the first line. */  /* End pointer of the first line. */
386  #define FIRSTLINE_END    (7 * sizeof(sljit_w))  #define FIRSTLINE_END    (7 * sizeof(sljit_w))
387  /* The output vector is stored on the stack, and contains pointers  /* The output vector is stored on the stack, and contains pointers
# Line 374  the start pointers when the end of the c Line 391  the start pointers when the end of the c
391  #define OVECTOR_START    (8 * sizeof(sljit_w))  #define OVECTOR_START    (8 * sizeof(sljit_w))
392  #define OVECTOR(i)       (OVECTOR_START + (i) * sizeof(sljit_w))  #define OVECTOR(i)       (OVECTOR_START + (i) * sizeof(sljit_w))
393  #define OVECTOR_PRIV(i)  (common->cbraptr + (i) * sizeof(sljit_w))  #define OVECTOR_PRIV(i)  (common->cbraptr + (i) * sizeof(sljit_w))
394  #define PRIV(cc)         (common->localptrs[(cc) - common->start])  #define PRIV_DATA(cc)    (common->localptrs[(cc) - common->start])
395    
396    #ifdef COMPILE_PCRE8
397    #define MOV_UCHAR  SLJIT_MOV_UB
398    #define MOVU_UCHAR SLJIT_MOVU_UB
399    #else
400    #ifdef COMPILE_PCRE16
401    #define MOV_UCHAR  SLJIT_MOV_UH
402    #define MOVU_UCHAR SLJIT_MOVU_UH
403    #else
404    #error Unsupported compiling mode
405    #endif
406    #endif
407    
408  /* Shortcuts. */  /* Shortcuts. */
409  #define DEFINE_COMPILER \  #define DEFINE_COMPILER \
# Line 398  the start pointers when the end of the c Line 427  the start pointers when the end of the c
427  #define COND_VALUE(op, dst, dstw, type) \  #define COND_VALUE(op, dst, dstw, type) \
428    sljit_emit_cond_value(compiler, (op), (dst), (dstw), (type))    sljit_emit_cond_value(compiler, (op), (dst), (dstw), (type))
429    
430  static uschar* bracketend(uschar* cc)  static pcre_uchar* bracketend(pcre_uchar* cc)
431  {  {
432  SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND));  SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND));
433  do cc += GET(cc, 1); while (*cc == OP_ALT);  do cc += GET(cc, 1); while (*cc == OP_ALT);
# Line 419  return cc; Line 448  return cc;
448   compile_fallbackpath   compile_fallbackpath
449  */  */
450    
451  static uschar *next_opcode(compiler_common *common, uschar *cc)  static pcre_uchar *next_opcode(compiler_common *common, pcre_uchar *cc)
452  {  {
453  SLJIT_UNUSED_ARG(common);  SLJIT_UNUSED_ARG(common);
454  switch(*cc)  switch(*cc)
# Line 475  switch(*cc) Line 504  switch(*cc)
504    return cc + 1;    return cc + 1;
505    
506    case OP_ANYBYTE:    case OP_ANYBYTE:
507  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
508    if (common->utf8) return NULL;    if (common->utf) return NULL;
509  #endif  #endif
510    return cc + 1;    return cc + 1;
511    
# Line 484  switch(*cc) Line 513  switch(*cc)
513    case OP_CHARI:    case OP_CHARI:
514    case OP_NOT:    case OP_NOT:
515    case OP_NOTI:    case OP_NOTI:
   
516    case OP_STAR:    case OP_STAR:
517    case OP_MINSTAR:    case OP_MINSTAR:
518    case OP_PLUS:    case OP_PLUS:
# Line 522  switch(*cc) Line 550  switch(*cc)
550    case OP_NOTPOSPLUSI:    case OP_NOTPOSPLUSI:
551    case OP_NOTPOSQUERYI:    case OP_NOTPOSQUERYI:
552    cc += 2;    cc += 2;
553  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
554    if (common->utf8 && cc[-1] >= 0xc0) cc += _pcre_utf8_table4[cc[-1] & 0x3f];    if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
555  #endif  #endif
556    return cc;    return cc;
557    
# Line 543  switch(*cc) Line 571  switch(*cc)
571    case OP_NOTMINUPTOI:    case OP_NOTMINUPTOI:
572    case OP_NOTEXACTI:    case OP_NOTEXACTI:
573    case OP_NOTPOSUPTOI:    case OP_NOTPOSUPTOI:
574    cc += 4;    cc += 2 + IMM2_SIZE;
575  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
576    if (common->utf8 && cc[-1] >= 0xc0) cc += _pcre_utf8_table4[cc[-1] & 0x3f];    if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
577  #endif  #endif
578    return cc;    return cc;
579    
580    case OP_NOTPROP:    case OP_NOTPROP:
581    case OP_PROP:    case OP_PROP:
582      return cc + 1 + 2;
583    
584    case OP_TYPEUPTO:    case OP_TYPEUPTO:
585    case OP_TYPEMINUPTO:    case OP_TYPEMINUPTO:
586    case OP_TYPEEXACT:    case OP_TYPEEXACT:
# Line 562  switch(*cc) Line 592  switch(*cc)
592    case OP_RREF:    case OP_RREF:
593    case OP_NRREF:    case OP_NRREF:
594    case OP_CLOSE:    case OP_CLOSE:
595    cc += 3;    cc += 1 + IMM2_SIZE;
596    return cc;    return cc;
597    
598    case OP_CRRANGE:    case OP_CRRANGE:
599    case OP_CRMINRANGE:    case OP_CRMINRANGE:
600    return cc + 5;    return cc + 1 + 2 * IMM2_SIZE;
601    
602    case OP_CLASS:    case OP_CLASS:
603    case OP_NCLASS:    case OP_NCLASS:
604    return cc + 33;    return cc + 1 + 32 / sizeof(pcre_uchar);
605    
606  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
607    case OP_XCLASS:    case OP_XCLASS:
608    return cc + GET(cc, 1);    return cc + GET(cc, 1);
609  #endif  #endif
# Line 603  switch(*cc) Line 633  switch(*cc)
633    case OP_CBRAPOS:    case OP_CBRAPOS:
634    case OP_SCBRA:    case OP_SCBRA:
635    case OP_SCBRAPOS:    case OP_SCBRAPOS:
636    return cc + 1 + LINK_SIZE + 2;    return cc + 1 + LINK_SIZE + IMM2_SIZE;
637    
638    default:    default:
639    return NULL;    return NULL;
640    }    }
641  }  }
642    
643  static int get_localspace(compiler_common *common, uschar *cc, uschar *ccend)  static int get_localspace(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
644  {  {
645  int localspace = 0;  int localspace = 0;
646  uschar *alternative;  pcre_uchar *alternative;
647  /* Calculate important variables (like stack size) and checks whether all opcodes are supported. */  /* Calculate important variables (like stack size) and checks whether all opcodes are supported. */
648  while (cc < ccend)  while (cc < ccend)
649    {    {
# Line 636  while (cc < ccend) Line 666  while (cc < ccend)
666      case OP_CBRAPOS:      case OP_CBRAPOS:
667      case OP_SCBRAPOS:      case OP_SCBRAPOS:
668      localspace += sizeof(sljit_w);      localspace += sizeof(sljit_w);
669      cc += 1 + LINK_SIZE + 2;      cc += 1 + LINK_SIZE + IMM2_SIZE;
670      break;      break;
671    
672      case OP_COND:      case OP_COND:
# Line 657  while (cc < ccend) Line 687  while (cc < ccend)
687  return localspace;  return localspace;
688  }  }
689    
690  static void set_localptrs(compiler_common *common, int localptr, uschar *ccend)  static void set_localptrs(compiler_common *common, int localptr, pcre_uchar *ccend)
691  {  {
692  uschar *cc = common->start;  pcre_uchar *cc = common->start;
693  uschar *alternative;  pcre_uchar *alternative;
694  while (cc < ccend)  while (cc < ccend)
695    {    {
696    switch(*cc)    switch(*cc)
# Line 684  while (cc < ccend) Line 714  while (cc < ccend)
714      case OP_SCBRAPOS:      case OP_SCBRAPOS:
715      common->localptrs[cc - common->start] = localptr;      common->localptrs[cc - common->start] = localptr;
716      localptr += sizeof(sljit_w);      localptr += sizeof(sljit_w);
717      cc += 1 + LINK_SIZE + 2;      cc += 1 + LINK_SIZE + IMM2_SIZE;
718      break;      break;
719    
720      case OP_COND:      case OP_COND:
# Line 707  while (cc < ccend) Line 737  while (cc < ccend)
737  }  }
738    
739  /* Returns with -1 if no need for frame. */  /* Returns with -1 if no need for frame. */
740  static int get_framesize(compiler_common *common, uschar *cc, BOOL recursive)  static int get_framesize(compiler_common *common, pcre_uchar *cc, BOOL recursive)
741  {  {
742  uschar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
743  int length = 0;  int length = 0;
744  BOOL possessive = FALSE;  BOOL possessive = FALSE;
745  BOOL setsom_found = FALSE;  BOOL setsom_found = FALSE;
# Line 740  while (cc < ccend) Line 770  while (cc < ccend)
770      case OP_SCBRA:      case OP_SCBRA:
771      case OP_SCBRAPOS:      case OP_SCBRAPOS:
772      length += 3;      length += 3;
773      cc += 1 + LINK_SIZE + 2;      cc += 1 + LINK_SIZE + IMM2_SIZE;
774      break;      break;
775    
776      default:      default:
# Line 758  if (length > 0) Line 788  if (length > 0)
788  return -1;  return -1;
789  }  }
790    
791  static void init_frame(compiler_common *common, uschar *cc, int stackpos, int stacktop, BOOL recursive)  static void init_frame(compiler_common *common, pcre_uchar *cc, int stackpos, int stacktop, BOOL recursive)
792  {  {
793  DEFINE_COMPILER;  DEFINE_COMPILER;
794  uschar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
795  BOOL setsom_found = FALSE;  BOOL setsom_found = FALSE;
796  int offset;  int offset;
797    
# Line 803  while (cc < ccend) Line 833  while (cc < ccend)
833      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP2, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP2, 0);
834      stackpos += (int)sizeof(sljit_w);      stackpos += (int)sizeof(sljit_w);
835    
836      cc += 1 + LINK_SIZE + 2;      cc += 1 + LINK_SIZE + IMM2_SIZE;
837      break;      break;
838    
839      default:      default:
# Line 816  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), st Line 846  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), st
846  SLJIT_ASSERT(stackpos == STACK(stacktop));  SLJIT_ASSERT(stackpos == STACK(stacktop));
847  }  }
848    
849  static SLJIT_INLINE int get_localsize(compiler_common *common, uschar *cc, uschar *ccend)  static SLJIT_INLINE int get_localsize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
850  {  {
851  int localsize = 2;  int localsize = 2;
852  uschar *alternative;  pcre_uchar *alternative;
853  /* Calculate the sum of the local variables. */  /* Calculate the sum of the local variables. */
854  while (cc < ccend)  while (cc < ccend)
855    {    {
# Line 842  while (cc < ccend) Line 872  while (cc < ccend)
872      case OP_CBRA:      case OP_CBRA:
873      case OP_SCBRA:      case OP_SCBRA:
874      localsize++;      localsize++;
875      cc += 1 + LINK_SIZE + 2;      cc += 1 + LINK_SIZE + IMM2_SIZE;
876      break;      break;
877    
878      case OP_CBRAPOS:      case OP_CBRAPOS:
879      case OP_SCBRAPOS:      case OP_SCBRAPOS:
880      localsize += 2;      localsize += 2;
881      cc += 1 + LINK_SIZE + 2;      cc += 1 + LINK_SIZE + IMM2_SIZE;
882      break;      break;
883    
884      case OP_COND:      case OP_COND:
# Line 869  SLJIT_ASSERT(cc == ccend); Line 899  SLJIT_ASSERT(cc == ccend);
899  return localsize;  return localsize;
900  }  }
901    
902  static void copy_locals(compiler_common *common, uschar *cc, uschar *ccend,  static void copy_locals(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend,
903    BOOL save, int stackptr, int stacktop)    BOOL save, int stackptr, int stacktop)
904  {  {
905  DEFINE_COMPILER;  DEFINE_COMPILER;
# Line 878  int count; Line 908  int count;
908  BOOL tmp1next = TRUE;  BOOL tmp1next = TRUE;
909  BOOL tmp1empty = TRUE;  BOOL tmp1empty = TRUE;
910  BOOL tmp2empty = TRUE;  BOOL tmp2empty = TRUE;
911  uschar *alternative;  pcre_uchar *alternative;
912  enum {  enum {
913    start,    start,
914    loop,    loop,
# Line 939  while (status != end) Line 969  while (status != end)
969        case OP_SBRAPOS:        case OP_SBRAPOS:
970        case OP_SCOND:        case OP_SCOND:
971        count = 1;        count = 1;
972        srcw[0] = PRIV(cc);        srcw[0] = PRIV_DATA(cc);
973        SLJIT_ASSERT(srcw[0] != 0);        SLJIT_ASSERT(srcw[0] != 0);
974        cc += 1 + LINK_SIZE;        cc += 1 + LINK_SIZE;
975        break;        break;
# Line 948  while (status != end) Line 978  while (status != end)
978        case OP_SCBRA:        case OP_SCBRA:
979        count = 1;        count = 1;
980        srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));        srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
981        cc += 1 + LINK_SIZE + 2;        cc += 1 + LINK_SIZE + IMM2_SIZE;
982        break;        break;
983    
984        case OP_CBRAPOS:        case OP_CBRAPOS:
985        case OP_SCBRAPOS:        case OP_SCBRAPOS:
986        count = 2;        count = 2;
987        srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));        srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
988        srcw[0] = PRIV(cc);        srcw[0] = PRIV_DATA(cc);
989        SLJIT_ASSERT(srcw[0] != 0);        SLJIT_ASSERT(srcw[0] != 0);
990        cc += 1 + LINK_SIZE + 2;        cc += 1 + LINK_SIZE + IMM2_SIZE;
991        break;        break;
992    
993        case OP_COND:        case OP_COND:
# Line 966  while (status != end) Line 996  while (status != end)
996        if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)        if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
997          {          {
998          count = 1;          count = 1;
999          srcw[0] = PRIV(cc);          srcw[0] = PRIV_DATA(cc);
1000          SLJIT_ASSERT(srcw[0] != 0);          SLJIT_ASSERT(srcw[0] != 0);
1001          }          }
1002        cc += 1 + LINK_SIZE;        cc += 1 + LINK_SIZE;
# Line 1174  struct sljit_label *loop; Line 1204  struct sljit_label *loop;
1204  int i;  int i;
1205  /* At this point we can freely use all temporary registers. */  /* At this point we can freely use all temporary registers. */
1206  /* TMP1 returns with begin - 1. */  /* TMP1 returns with begin - 1. */
1207  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_SAVED_REG1), SLJIT_OFFSETOF(jit_arguments, begin), SLJIT_IMM, IN_UCHARS(1));
1208  if (length < 8)  if (length < 8)
1209    {    {
1210    for (i = 0; i < length; i++)    for (i = 0; i < length; i++)
# Line 1198  struct sljit_label *loop; Line 1228  struct sljit_label *loop;
1228  struct sljit_jump *earlyexit;  struct sljit_jump *earlyexit;
1229    
1230  /* At this point we can freely use all registers. */  /* At this point we can freely use all registers. */
1231  OP1(SLJIT_MOV, SLJIT_GENERAL_REG3, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1));  OP1(SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1));
1232  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);
1233    
1234  OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG1, 0, ARGUMENTS, 0);  OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG1, 0, ARGUMENTS, 0);
1235  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));
1236  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));
1237  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));
1238  OP2(SLJIT_ADD, SLJIT_GENERAL_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);
1239  /* Unlikely, but possible */  /* Unlikely, but possible */
1240  earlyexit = CMP(SLJIT_C_EQUAL, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, 0);  earlyexit = CMP(SLJIT_C_EQUAL, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, 0);
1241  loop = LABEL();  loop = LABEL();
1242  OP2(SLJIT_SUB, SLJIT_GENERAL_REG2, 0, SLJIT_MEM1(SLJIT_GENERAL_REG1), 0, SLJIT_TEMPORARY_REG1, 0);  OP2(SLJIT_SUB, SLJIT_SAVED_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_TEMPORARY_REG1, 0);
1243  OP2(SLJIT_ADD, SLJIT_GENERAL_REG1, 0, SLJIT_GENERAL_REG1, 0, SLJIT_IMM, sizeof(sljit_w));  OP2(SLJIT_ADD, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, sizeof(sljit_w));
1244  /* Copy the integer value to the output buffer */  /* Copy the integer value to the output buffer */
1245  OP1(SLJIT_MOVU_SI, SLJIT_MEM1(SLJIT_TEMPORARY_REG3), sizeof(int), SLJIT_GENERAL_REG2, 0);  #ifdef COMPILE_PCRE16
1246    OP2(SLJIT_ASHR, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 1);
1247    #endif
1248    OP1(SLJIT_MOVU_SI, SLJIT_MEM1(SLJIT_TEMPORARY_REG3), sizeof(int), SLJIT_SAVED_REG2, 0);
1249  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);
1250  JUMPTO(SLJIT_C_NOT_ZERO, loop);  JUMPTO(SLJIT_C_NOT_ZERO, loop);
1251  JUMPHERE(earlyexit);  JUMPHERE(earlyexit);
# Line 1223  if (topbracket > 1) Line 1256  if (topbracket > 1)
1256    OP2(SLJIT_ADD, SLJIT_TEMPORARY_REG1, 0, SLJIT_LOCALS_REG, 0, SLJIT_IMM, OVECTOR_START + topbracket * 2 * sizeof(sljit_w));    OP2(SLJIT_ADD, SLJIT_TEMPORARY_REG1, 0, SLJIT_LOCALS_REG, 0, SLJIT_IMM, OVECTOR_START + topbracket * 2 * sizeof(sljit_w));
1257    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, topbracket + 1);    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, topbracket + 1);
1258    
1259    /* OVECTOR(0) is never equal to SLJIT_GENERAL_REG3. */    /* OVECTOR(0) is never equal to SLJIT_SAVED_REG3. */
1260    loop = LABEL();    loop = LABEL();
1261    OP1(SLJIT_MOVU, SLJIT_TEMPORARY_REG3, 0, SLJIT_MEM1(SLJIT_TEMPORARY_REG1), -(2 * (sljit_w)sizeof(sljit_w)));    OP1(SLJIT_MOVU, SLJIT_TEMPORARY_REG3, 0, SLJIT_MEM1(SLJIT_TEMPORARY_REG1), -(2 * (sljit_w)sizeof(sljit_w)));
1262    OP2(SLJIT_SUB, SLJIT_TEMPORARY_REG2, 0, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, 1);    OP2(SLJIT_SUB, SLJIT_TEMPORARY_REG2, 0, SLJIT_TEMPORARY_REG2, 0, SLJIT_IMM, 1);
1263    CMPTO(SLJIT_C_EQUAL, SLJIT_TEMPORARY_REG3, 0, SLJIT_GENERAL_REG3, 0, loop);    CMPTO(SLJIT_C_EQUAL, SLJIT_TEMPORARY_REG3, 0, SLJIT_SAVED_REG3, 0, loop);
1264    OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_TEMPORARY_REG2, 0);    OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_TEMPORARY_REG2, 0);
1265    }    }
1266  else  else
1267    OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);    OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);
1268  }  }
1269    
1270  static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, uschar* cc)  static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, pcre_uchar* cc)
1271  {  {
1272  /* Detects if the character has an othercase. */  /* Detects if the character has an othercase. */
1273  unsigned int c;  unsigned int c;
1274    
1275  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1276  if (common->utf8)  if (common->utf)
1277    {    {
1278    GETCHAR(c, cc);    GETCHAR(c, cc);
1279    if (c > 127)    if (c > 127)
# Line 1251  if (common->utf8) Line 1284  if (common->utf8)
1284      return FALSE;      return FALSE;
1285  #endif  #endif
1286      }      }
1287    #ifndef COMPILE_PCRE8
1288      return common->fcc[c] != c;
1289    #endif
1290    }    }
1291  else  else
1292  #endif  #endif
1293    c = *cc;    c = *cc;
1294  return common->fcc[c] != c;  return MAX_255(c) ? common->fcc[c] != c : FALSE;
1295  }  }
1296    
1297  static SLJIT_INLINE unsigned int char_othercase(compiler_common *common, unsigned int c)  static SLJIT_INLINE unsigned int char_othercase(compiler_common *common, unsigned int c)
1298  {  {
1299  /* Returns with the othercase. */  /* Returns with the othercase. */
1300  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1301  if (common->utf8 && c > 127)  if (common->utf && c > 127)
1302    {    {
1303  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
1304    return UCD_OTHERCASE(c);    return UCD_OTHERCASE(c);
# Line 1271  if (common->utf8 && c > 127) Line 1307  if (common->utf8 && c > 127)
1307  #endif  #endif
1308    }    }
1309  #endif  #endif
1310  return common->fcc[c];  return TABLE_GET(c, common->fcc, c);
1311  }  }
1312    
1313  static unsigned int char_get_othercase_bit(compiler_common *common, uschar* cc)  static unsigned int char_get_othercase_bit(compiler_common *common, pcre_uchar* cc)
1314  {  {
1315  /* Detects if the character and its othercase has only 1 bit difference. */  /* Detects if the character and its othercase has only 1 bit difference. */
1316  unsigned int c, oc, bit;  unsigned int c, oc, bit;
1317  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
1318  int n;  int n;
1319  #endif  #endif
1320    
1321  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1322  if (common->utf8)  if (common->utf)
1323    {    {
1324    GETCHAR(c, cc);    GETCHAR(c, cc);
1325    if (c <= 127)    if (c <= 127)
# Line 1300  if (common->utf8) Line 1336  if (common->utf8)
1336  else  else
1337    {    {
1338    c = *cc;    c = *cc;
1339    oc = common->fcc[c];    oc = TABLE_GET(c, common->fcc, c);
1340    }    }
1341  #else  #else
1342  c = *cc;  c = *cc;
1343  oc = common->fcc[c];  oc = TABLE_GET(c, common->fcc, c);
1344  #endif  #endif
1345    
1346  SLJIT_ASSERT(c != oc);  SLJIT_ASSERT(c != oc);
# Line 1318  if (c <= 127 && bit == 0x20) Line 1354  if (c <= 127 && bit == 0x20)
1354  if (!ispowerof2(bit))  if (!ispowerof2(bit))
1355    return 0;    return 0;
1356    
1357  #ifdef SUPPORT_UTF8  #ifdef COMPILE_PCRE8
1358  if (common->utf8 && c > 127)  
1359    #ifdef SUPPORT_UTF
1360    if (common->utf && c > 127)
1361    {    {
1362    n = _pcre_utf8_table4[*cc & 0x3f];    n = GET_EXTRALEN(*cc);
1363    while ((bit & 0x3f) == 0)    while ((bit & 0x3f) == 0)
1364      {      {
1365      n--;      n--;
# Line 1329  if (common->utf8 && c > 127) Line 1367  if (common->utf8 && c > 127)
1367      }      }
1368    return (n << 8) | bit;    return (n << 8) | bit;
1369    }    }
1370  #endif  #endif /* SUPPORT_UTF */
1371  return (0 << 8) | bit;  return (0 << 8) | bit;
1372    
1373    #else /* COMPILE_PCRE8 */
1374    
1375    #ifdef COMPILE_PCRE16
1376    #ifdef SUPPORT_UTF
1377    if (common->utf && c > 65535)
1378      {
1379      if (bit >= (1 << 10))
1380        bit >>= 10;
1381      else
1382        return (bit < 256) ? ((2 << 8) | bit) : ((3 << 8) | (bit >> 8));
1383      }
1384    #endif /* SUPPORT_UTF */
1385    return (bit < 256) ? ((0 << 8) | bit) : ((1 << 8) | (bit >> 8));
1386    #endif /* COMPILE_PCRE16 */
1387    
1388    #endif /* COMPILE_PCRE8 */
1389  }  }
1390    
1391  static SLJIT_INLINE void check_input_end(compiler_common *common, jump_list **fallbacks)  static SLJIT_INLINE void check_input_end(compiler_common *common, jump_list **fallbacks)
# Line 1344  static void read_char(compiler_common *c Line 1399  static void read_char(compiler_common *c
1399  /* Reads the character into TMP1, updates STR_PTR.  /* Reads the character into TMP1, updates STR_PTR.
1400  Does not check STR_END. TMP2 Destroyed. */  Does not check STR_END. TMP2 Destroyed. */
1401  DEFINE_COMPILER;  DEFINE_COMPILER;
1402  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1403  struct sljit_jump *jump;  struct sljit_jump *jump;
1404  #endif  #endif
1405    
1406  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
1407  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1408  if (common->utf8)  if (common->utf)
1409    {    {
1410    #ifdef COMPILE_PCRE8
1411    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
1412    add_jump(compiler, &common->utf8readchar, JUMP(SLJIT_FAST_CALL));  #else
1413    #ifdef COMPILE_PCRE16
1414      jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
1415    #endif
1416    #endif /* COMPILE_PCRE8 */
1417      add_jump(compiler, &common->utfreadchar, JUMP(SLJIT_FAST_CALL));
1418    JUMPHERE(jump);    JUMPHERE(jump);
1419    }    }
1420  #endif  #endif
1421  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));
1422  }  }
1423    
1424  static void peek_char(compiler_common *common)  static void peek_char(compiler_common *common)
# Line 1365  static void peek_char(compiler_common *c Line 1426  static void peek_char(compiler_common *c
1426  /* Reads the character into TMP1, keeps STR_PTR.  /* Reads the character into TMP1, keeps STR_PTR.
1427  Does not check STR_END. TMP2 Destroyed. */  Does not check STR_END. TMP2 Destroyed. */
1428  DEFINE_COMPILER;  DEFINE_COMPILER;
1429  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1430  struct sljit_jump *jump;  struct sljit_jump *jump;
1431  #endif  #endif
1432    
1433  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
1434  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1435  if (common->utf8)  if (common->utf)
1436    {    {
1437    #ifdef COMPILE_PCRE8
1438    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
1439    add_jump(compiler, &common->utf8readchar, JUMP(SLJIT_FAST_CALL));  #else
1440    #ifdef COMPILE_PCRE16
1441      jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
1442    #endif
1443    #endif /* COMPILE_PCRE8 */
1444      add_jump(compiler, &common->utfreadchar, JUMP(SLJIT_FAST_CALL));
1445    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
1446    JUMPHERE(jump);    JUMPHERE(jump);
1447    }    }
# Line 1385  static void read_char8_type(compiler_com Line 1452  static void read_char8_type(compiler_com
1452  {  {
1453  /* Reads the character type into TMP1, updates STR_PTR. Does not check STR_END. */  /* Reads the character type into TMP1, updates STR_PTR. Does not check STR_END. */
1454  DEFINE_COMPILER;  DEFINE_COMPILER;
1455  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || defined COMPILE_PCRE16
1456  struct sljit_jump *jump;  struct sljit_jump *jump;
1457  #endif  #endif
1458    
1459  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1460  if (common->utf8)  if (common->utf)
1461    {    {
1462    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);    OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);
1463    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));
1464    #ifdef COMPILE_PCRE8
1465    /* This can be an extra read in some situations, but hopefully    /* This can be an extra read in some situations, but hopefully
1466    it is a clever early read in most cases. */    it is needed in most cases. */
1467    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
1468    jump = CMP(SLJIT_C_LESS, TMP2, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_C_LESS, TMP2, 0, SLJIT_IMM, 0xc0);
1469    add_jump(compiler, &common->utf8readtype8, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->utfreadtype8, JUMP(SLJIT_FAST_CALL));
1470      JUMPHERE(jump);
1471    #else
1472    #ifdef COMPILE_PCRE16
1473      OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
1474      jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 255);
1475      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
1476    JUMPHERE(jump);    JUMPHERE(jump);
1477      /* Skip low surrogate if necessary. */
1478      OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xfc00);
1479      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0xd800);
1480      COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_EQUAL);
1481      OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
1482      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
1483    #endif
1484    #endif /* COMPILE_PCRE8 */
1485    return;    return;
1486    }    }
1487  #endif  #endif
1488  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);
1489  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));
1490  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), common->ctypes);  #ifdef COMPILE_PCRE16
1491    /* The ctypes array contains only 256 values. */
1492    OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
1493    jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 255);
1494    #endif
1495    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
1496    #ifdef COMPILE_PCRE16
1497    JUMPHERE(jump);
1498    #endif
1499  }  }
1500    
1501  static void skip_char_back(compiler_common *common)  static void skip_char_back(compiler_common *common)
1502  {  {
1503  /* Goes one character back. Only affects STR_PTR. Does not check begin. */  /* Goes one character back. Affects STR_PTR and TMP1. Does not check begin. */
1504  DEFINE_COMPILER;  DEFINE_COMPILER;
1505  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
1506  struct sljit_label *label;  struct sljit_label *label;
1507    
1508  if (common->utf8)  if (common->utf)
1509    {    {
1510    label = LABEL();    label = LABEL();
1511    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), -IN_UCHARS(1));
1512    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
1513    OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xc0);    OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xc0);
1514    CMPTO(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, 0x80, label);    CMPTO(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, 0x80, label);
1515    return;    return;
1516    }    }
1517  #endif  #endif
1518  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);  #if defined SUPPORT_UTF && defined COMPILE_PCRE16
1519    if (common->utf)
1520      {
1521      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), -IN_UCHARS(1));
1522      OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
1523      /* Skip low surrogate if necessary. */
1524      OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
1525      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xdc00);
1526      COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);
1527      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
1528      OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1529      return;
1530      }
1531    #endif
1532    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
1533  }  }
1534    
1535  static void check_newlinechar(compiler_common *common, int nltype, jump_list **fallbacks, BOOL jumpiftrue)  static void check_newlinechar(compiler_common *common, int nltype, jump_list **fallbacks, BOOL jumpiftrue)
# Line 1448  else if (nltype == NLTYPE_ANYCRLF) Line 1552  else if (nltype == NLTYPE_ANYCRLF)
1552    }    }
1553  else  else
1554    {    {
1555    SLJIT_ASSERT(nltype == NLTYPE_FIXED && common->newline <= 255);    SLJIT_ASSERT(nltype == NLTYPE_FIXED && common->newline < 256);
1556    add_jump(compiler, fallbacks, CMP(jumpiftrue ? SLJIT_C_EQUAL : SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline));    add_jump(compiler, fallbacks, CMP(jumpiftrue ? SLJIT_C_EQUAL : SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline));
1557    }    }
1558  }  }
1559    
1560  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1561  static void do_utf8readchar(compiler_common *common)  
1562    #ifdef COMPILE_PCRE8
1563    static void do_utfreadchar(compiler_common *common)
1564  {  {
1565  /* Fast decoding an utf8 character. TMP1 contains the first byte  /* Fast decoding a UTF-8 character. TMP1 contains the first byte
1566  of the character (>= 0xc0). Return char value in TMP1, length - 1 in TMP2. */  of the character (>= 0xc0). Return char value in TMP1, length - 1 in TMP2. */
1567  DEFINE_COMPILER;  DEFINE_COMPILER;
1568  struct sljit_jump *jump;  struct sljit_jump *jump;
# Line 1465  sljit_emit_fast_enter(compiler, RETURN_A Line 1571  sljit_emit_fast_enter(compiler, RETURN_A
1571  /* Searching for the first zero. */  /* Searching for the first zero. */
1572  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);
1573  jump = JUMP(SLJIT_C_NOT_ZERO);  jump = JUMP(SLJIT_C_NOT_ZERO);
1574  /* 2 byte sequence */  /* Two byte sequence. */
1575  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 1);  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
1576  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));
1577  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1f);  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1f);
1578  OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);  OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);
1579  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
1580  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
1581  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
1582  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
1583  JUMPHERE(jump);  JUMPHERE(jump);
1584    
1585  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x10);  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x10);
1586  jump = JUMP(SLJIT_C_NOT_ZERO);  jump = JUMP(SLJIT_C_NOT_ZERO);
1587  /* 3 byte sequence */  /* Three byte sequence. */
1588  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 1);  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
1589  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0f);  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0f);
1590  OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 12);  OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 12);
1591  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
1592  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
1593  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
1594  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 2);  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(2));
1595  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 2);  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
1596  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
1597  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
1598  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 2);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, IN_UCHARS(2));
1599  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
1600  JUMPHERE(jump);  JUMPHERE(jump);
1601    
1602  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x08);  /* Four byte sequence. */
1603  jump = JUMP(SLJIT_C_NOT_ZERO);  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
 /* 4 byte sequence */  
 OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 1);  
1604  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x07);  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x07);
1605  OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 18);  OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 18);
1606  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
1607  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 12);  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 12);
1608  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
1609  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 2);  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(2));
1610  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
1611  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
1612  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
1613  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 3);  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(3));
1614  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 3);  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(3));
1615  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
1616  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
1617  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 3);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, IN_UCHARS(3));
 sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  
 JUMPHERE(jump);  
   
 /* 5 byte sequence */  
 OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 1);  
 OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x03);  
 OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 24);  
 OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);  
 OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 18);  
 OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);  
 OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 2);  
 OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);  
 OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 12);  
 OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);  
 OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 3);  
 OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);  
 OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);  
 OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);  
 OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 4);  
 OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 4);  
 OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);  
 OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);  
 OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 4);  
1618  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
1619  }  }
1620    
1621  static void do_utf8readtype8(compiler_common *common)  static void do_utfreadtype8(compiler_common *common)
1622  {  {
1623  /* Fast decoding an utf8 character type. TMP2 contains the first byte  /* Fast decoding a UTF-8 character type. TMP2 contains the first byte
1624  of the character (>= 0xc0) and TMP1 is destroyed. Return value in TMP1. */  of the character (>= 0xc0). Return value in TMP1. */
1625  DEFINE_COMPILER;  DEFINE_COMPILER;
1626  struct sljit_jump *jump;  struct sljit_jump *jump;
1627  struct sljit_jump *compare;  struct sljit_jump *compare;
# Line 1549  sljit_emit_fast_enter(compiler, RETURN_A Line 1630  sljit_emit_fast_enter(compiler, RETURN_A
1630    
1631  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x20);  OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x20);
1632  jump = JUMP(SLJIT_C_NOT_ZERO);  jump = JUMP(SLJIT_C_NOT_ZERO);
1633  /* 2 byte sequence */  /* Two byte sequence. */
1634  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
1635  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));
1636  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x1f);  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x1f);
1637  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 6);
1638  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3f);
# Line 1566  sljit_emit_fast_return(compiler, RETURN_ Line 1647  sljit_emit_fast_return(compiler, RETURN_
1647  JUMPHERE(jump);  JUMPHERE(jump);
1648    
1649  /* We only have types for characters less than 256. */  /* We only have types for characters less than 256. */
1650  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), (sljit_w)_pcre_utf8_char_sizes - 0xc0);  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), (sljit_w)PRIV(utf8_table4) - 0xc0);
1651  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1652  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
1653  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
1654  }  }
1655    
1656  #endif  #else /* COMPILE_PCRE8 */
1657    
1658    #ifdef COMPILE_PCRE16
1659    static void do_utfreadchar(compiler_common *common)
1660    {
1661    /* Fast decoding a UTF-16 character. TMP1 contains the first 16 bit char
1662    of the character (>= 0xd800). Return char value in TMP1, length - 1 in TMP2. */
1663    DEFINE_COMPILER;
1664    struct sljit_jump *jump;
1665    
1666    sljit_emit_fast_enter(compiler, RETURN_ADDR, 0, 1, 5, 5, common->localsize);
1667    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xdc00);
1668    /* Do nothing, only return. */
1669    sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
1670    
1671    JUMPHERE(jump);
1672    /* Combine two 16 bit characters. */
1673    OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
1674    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
1675    OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x3ff);
1676    OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 10);
1677    OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3ff);
1678    OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
1679    OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
1680    OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x10000);
1681    sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
1682    }
1683    #endif /* COMPILE_PCRE16 */
1684    
1685    #endif /* COMPILE_PCRE8 */
1686    
1687    #endif /* SUPPORT_UTF */
1688    
1689  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
1690    
# Line 1590  SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && si Line 1702  SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && si
1702    
1703  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);
1704  OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);  OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
1705  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));
1706  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);  OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
1707  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
1708  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);
1709  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_w)_pcre_ucd_stage2);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_w)PRIV(ucd_stage2));
1710  OP1(SLJIT_MOV_UH, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);  OP1(SLJIT_MOV_UH, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);
1711  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));
1712  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
1713  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
1714  }  }
# Line 1610  struct sljit_label *newlinelabel = NULL; Line 1722  struct sljit_label *newlinelabel = NULL;
1722  struct sljit_jump *start;  struct sljit_jump *start;
1723  struct sljit_jump *end = NULL;  struct sljit_jump *end = NULL;
1724  struct sljit_jump *nl = NULL;  struct sljit_jump *nl = NULL;
1725  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1726  struct sljit_jump *singlebyte;  struct sljit_jump *singlechar;
1727  #endif  #endif
1728  jump_list *newline = NULL;  jump_list *newline = NULL;
1729  BOOL newlinecheck = FALSE;  BOOL newlinecheck = FALSE;
1730  BOOL readbyte = FALSE;  BOOL readuchar = FALSE;
1731    
1732  if (!(hascrorlf || firstline) && (common->nltype == NLTYPE_ANY ||  if (!(hascrorlf || firstline) && (common->nltype == NLTYPE_ANY ||
1733      common->nltype == NLTYPE_ANYCRLF || common->newline > 255))      common->nltype == NLTYPE_ANYCRLF || common->newline > 255))
# Line 1630  if (firstline) Line 1742  if (firstline)
1742    if (common->nltype == NLTYPE_FIXED && common->newline > 255)    if (common->nltype == NLTYPE_FIXED && common->newline > 255)
1743      {      {
1744      mainloop = LABEL();      mainloop = LABEL();
1745      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));
1746      end = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);      end = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
1747      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -1);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1));
1748      OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);      OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
1749      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);
1750      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);
1751      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));
1752      }      }
1753    else    else
1754      {      {
# Line 1660  start = JUMP(SLJIT_JUMP); Line 1772  start = JUMP(SLJIT_JUMP);
1772  if (newlinecheck)  if (newlinecheck)
1773    {    {
1774    newlinelabel = LABEL();    newlinelabel = LABEL();
1775    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));
1776    end = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);    end = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
1777    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
1778    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);
1779    COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);    COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);
1780    #ifdef COMPILE_PCRE16
1781      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
1782    #endif
1783    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1784    nl = JUMP(SLJIT_JUMP);    nl = JUMP(SLJIT_JUMP);
1785    }    }
# Line 1672  if (newlinecheck) Line 1787  if (newlinecheck)
1787  mainloop = LABEL();  mainloop = LABEL();
1788    
1789  /* 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. */
1790  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
1791  if (common->utf8) readbyte = TRUE;  if (common->utf) readuchar = TRUE;
1792  #endif  #endif
1793  if (newlinecheck) readbyte = TRUE;  if (newlinecheck) readuchar = TRUE;
1794    
1795  if (readbyte)  if (readuchar)
1796    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
1797    
1798  if (newlinecheck)  if (newlinecheck)
1799    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);
1800    
1801  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));
1802  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
1803  if (common->utf8)  if (common->utf)
1804    {    {
1805    singlebyte = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    singlechar = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
1806    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
1807      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1808      JUMPHERE(singlechar);
1809      }
1810    #endif
1811    #if defined SUPPORT_UTF && defined COMPILE_PCRE16
1812    if (common->utf)
1813      {
1814      singlechar = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
1815      OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
1816      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
1817      COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);
1818      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
1819    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1820    JUMPHERE(singlebyte);    JUMPHERE(singlechar);
1821    }    }
1822  #endif  #endif
1823  JUMPHERE(start);  JUMPHERE(start);
# Line 1704  if (newlinecheck) Line 1831  if (newlinecheck)
1831  return mainloop;  return mainloop;
1832  }  }
1833    
1834  static SLJIT_INLINE void fast_forward_first_byte(compiler_common *common, pcre_uint16 firstbyte, BOOL firstline)  static SLJIT_INLINE void fast_forward_first_char(compiler_common *common, pcre_uchar first_char, BOOL caseless, BOOL firstline)
1835  {  {
1836  DEFINE_COMPILER;  DEFINE_COMPILER;
1837  struct sljit_label *start;  struct sljit_label *start;
1838  struct sljit_jump *leave;  struct sljit_jump *leave;
1839  struct sljit_jump *found;  struct sljit_jump *found;
1840  pcre_uint16 oc, bit;  pcre_uchar oc, bit;
1841    
1842  if (firstline)  if (firstline)
1843    {    {
# Line 1720  if (firstline) Line 1847  if (firstline)
1847    
1848  start = LABEL();  start = LABEL();
1849  leave = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);  leave = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
1850  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
1851    
1852  if ((firstbyte & REQ_CASELESS) == 0)  oc = first_char;
1853    found = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, firstbyte & 0xff);  if (caseless)
1854      {
1855      oc = TABLE_GET(first_char, common->fcc, first_char);
1856    #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)
1857      if (first_char > 127 && common->utf)
1858        oc = UCD_OTHERCASE(first_char);
1859    #endif
1860      }
1861    if (first_char == oc)
1862      found = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, first_char);
1863  else  else
1864    {    {
1865    firstbyte &= 0xff;    bit = first_char ^ oc;
   oc = common->fcc[firstbyte];  
   bit = firstbyte ^ oc;  
1866    if (ispowerof2(bit))    if (ispowerof2(bit))
1867      {      {
1868      OP2(SLJIT_OR, TMP2, 0, TMP1, 0, SLJIT_IMM, bit);      OP2(SLJIT_OR, TMP2, 0, TMP1, 0, SLJIT_IMM, bit);
1869      found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, firstbyte | bit);      found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, first_char | bit);
1870      }      }
1871    else    else
1872      {      {
1873      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, firstbyte);      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, first_char);
1874      COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_EQUAL);      COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_EQUAL);
1875      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, oc);      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, oc);
1876      COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);      COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);
# Line 1744  else Line 1878  else
1878      }      }
1879    }    }
1880    
1881  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));
1882  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
1883  if (common->utf8)  if (common->utf)
1884    {    {
1885    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
1886    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
1887      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1888      }
1889    #endif
1890    #if defined SUPPORT_UTF && defined COMPILE_PCRE16
1891    if (common->utf)
1892      {
1893      CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800, start);
1894      OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
1895      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
1896      COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);
1897      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
1898    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1899    }    }
1900  #endif  #endif
# Line 1786  if (common->nltype == NLTYPE_FIXED && co Line 1931  if (common->nltype == NLTYPE_FIXED && co
1931    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
1932    firstchar = CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP2, 0);    firstchar = CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP2, 0);
1933    
1934    OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 2);    OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(2));
1935    OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, TMP1, 0);
1936    COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_GREATER_EQUAL);    COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_GREATER_EQUAL);
1937    #ifdef COMPILE_PCRE16
1938      OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
1939    #endif
1940    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
1941    
1942    loop = LABEL();    loop = LABEL();
1943    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));
1944    leave = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);    leave = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
1945    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -2);    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-2));
1946    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), -1);    OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1));
1947    CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, loop);    CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, loop);
1948    CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, loop);    CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, loop);
1949    
# Line 1826  if (common->nltype == NLTYPE_ANY || comm Line 1974  if (common->nltype == NLTYPE_ANY || comm
1974    leave = JUMP(SLJIT_JUMP);    leave = JUMP(SLJIT_JUMP);
1975    JUMPHERE(foundcr);    JUMPHERE(foundcr);
1976    notfoundnl = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);    notfoundnl = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
1977    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
1978    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_NL);    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_NL);
1979    COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);    COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);
1980    #ifdef COMPILE_PCRE16
1981      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
1982    #endif
1983    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1984    JUMPHERE(notfoundnl);    JUMPHERE(notfoundnl);
1985    JUMPHERE(leave);    JUMPHERE(leave);
# Line 1846  DEFINE_COMPILER; Line 1997  DEFINE_COMPILER;
1997  struct sljit_label *start;  struct sljit_label *start;
1998  struct sljit_jump *leave;  struct sljit_jump *leave;
1999  struct sljit_jump *found;  struct sljit_jump *found;
2000    #ifndef COMPILE_PCRE8
2001    struct sljit_jump *jump;
2002    #endif
2003    
2004  if (firstline)  if (firstline)
2005    {    {
# Line 1855  if (firstline) Line 2009  if (firstline)
2009    
2010  start = LABEL();  start = LABEL();
2011  leave = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);  leave = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
2012  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2013  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2014  if (common->utf8)  if (common->utf)
2015    OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);    OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);
2016  #endif  #endif
2017    #ifndef COMPILE_PCRE8
2018    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 255);
2019    OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 255);
2020    JUMPHERE(jump);
2021    #endif
2022  OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);  OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
2023  OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);  OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
2024  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), start_bits);  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), start_bits);
# Line 1867  OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TM Line 2026  OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TM
2026  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);
2027  found = JUMP(SLJIT_C_NOT_ZERO);  found = JUMP(SLJIT_C_NOT_ZERO);
2028    
2029  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2030  if (common->utf8)  if (common->utf)
2031    OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);    OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
2032  #endif  #endif
2033  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));
2034  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF && defined COMPILE_PCRE8
2035  if (common->utf8)  if (common->utf)
2036    {    {
2037    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
2038    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
2039      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
2040      }
2041    #endif
2042    #if defined SUPPORT_UTF && defined COMPILE_PCRE16
2043    if (common->utf)
2044      {
2045      CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800, start);
2046      OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
2047      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
2048      COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);
2049      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
2050    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
2051    }    }
2052  #endif  #endif
# Line 1888  if (firstline) Line 2058  if (firstline)
2058    OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0);    OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0);
2059  }  }
2060    
2061  static SLJIT_INLINE struct sljit_jump *search_requested_char(compiler_common *common, pcre_uint16 reqbyte, BOOL has_firstbyte)  static SLJIT_INLINE struct sljit_jump *search_requested_char(compiler_common *common, pcre_uchar req_char, BOOL caseless, BOOL has_firstchar)
2062  {  {
2063  DEFINE_COMPILER;  DEFINE_COMPILER;
2064  struct sljit_label *loop;  struct sljit_label *loop;
# Line 1897  struct sljit_jump *alreadyfound; Line 2067  struct sljit_jump *alreadyfound;
2067  struct sljit_jump *found;  struct sljit_jump *found;
2068  struct sljit_jump *foundoc = NULL;  struct sljit_jump *foundoc = NULL;
2069  struct sljit_jump *notfound;  struct sljit_jump *notfound;
2070  pcre_uint16 oc, bit;  pcre_uchar oc, bit;
2071    
2072  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), REQ_BYTE_PTR);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), REQ_CHAR_PTR);
2073  OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, REQ_BYTE_MAX);  OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, REQ_BYTE_MAX);
2074  toolong = CMP(SLJIT_C_LESS, TMP1, 0, STR_END, 0);  toolong = CMP(SLJIT_C_LESS, TMP1, 0, STR_END, 0);
2075  alreadyfound = CMP(SLJIT_C_LESS, STR_PTR, 0, TMP2, 0);  alreadyfound = CMP(SLJIT_C_LESS, STR_PTR, 0, TMP2, 0);
2076    
2077  if (has_firstbyte)  if (has_firstchar)
2078    OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, 1);    OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2079  else  else
2080    OP1(SLJIT_MOV, TMP1, 0, STR_PTR, 0);    OP1(SLJIT_MOV, TMP1, 0, STR_PTR, 0);
2081    
2082  loop = LABEL();  loop = LABEL();
2083  notfound = CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, STR_END, 0);  notfound = CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, STR_END, 0);
2084    
2085  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), 0);  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(TMP1), 0);
2086  if ((reqbyte & REQ_CASELESS) == 0)  oc = req_char;
2087    found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, reqbyte & 0xff);  if (caseless)
2088      {
2089      oc = TABLE_GET(req_char, common->fcc, req_char);
2090    #if defined SUPPORT_UCP && !(defined COMPILE_PCRE8)
2091      if (req_char > 127 && common->utf)
2092        oc = UCD_OTHERCASE(req_char);
2093    #endif
2094      }
2095    if (req_char == oc)
2096      found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, req_char);
2097  else  else
2098    {    {
2099    reqbyte &= 0xff;    bit = req_char ^ oc;
   oc = common->fcc[reqbyte];  
   bit = reqbyte ^ oc;  
2100    if (ispowerof2(bit))    if (ispowerof2(bit))
2101      {      {
2102      OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, bit);      OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, bit);
2103      found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, reqbyte | bit);      found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, req_char | bit);
2104      }      }
2105    else    else
2106      {      {
2107      found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, reqbyte);      found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, req_char);
2108      foundoc = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, oc);      foundoc = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, oc);
2109      }      }
2110    }    }
2111  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
2112  JUMPTO(SLJIT_JUMP, loop);  JUMPTO(SLJIT_JUMP, loop);
2113    
2114  JUMPHERE(found);  JUMPHERE(found);
2115  if (foundoc)  if (foundoc)
2116    JUMPHERE(foundoc);    JUMPHERE(foundoc);
2117  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), REQ_BYTE_PTR, TMP1, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), REQ_CHAR_PTR, TMP1, 0);
2118  JUMPHERE(alreadyfound);  JUMPHERE(alreadyfound);
2119  JUMPHERE(toolong);  JUMPHERE(toolong);
2120  return notfound;  return notfound;
# Line 1985  static void check_wordboundary(compiler_ Line 2162  static void check_wordboundary(compiler_
2162  {  {
2163  DEFINE_COMPILER;  DEFINE_COMPILER;
2164  struct sljit_jump *beginend;  struct sljit_jump *beginend;
2165  #ifdef SUPPORT_UTF8  #if !(defined COMPILE_PCRE8) || defined SUPPORT_UTF
2166  struct sljit_jump *jump;  struct sljit_jump *jump;
2167  #endif  #endif
2168    
# Line 2002  read_char(common); Line 2179  read_char(common);
2179    
2180  /* Testing char type. */  /* Testing char type. */
2181  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2182  if (common->useucp)  if (common->use_ucp)
2183    {    {
2184    OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1);    OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1);
2185    jump = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);    jump = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
# Line 2019  if (common->useucp) Line 2196  if (common->useucp)
2196  else  else
2197  #endif  #endif
2198    {    {
2199  #ifdef SUPPORT_UTF8  #ifndef COMPILE_PCRE8
2200      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
2201    #elif defined SUPPORT_UTF
2202    /* Here LOCALS1 has already been zeroed. */    /* Here LOCALS1 has already been zeroed. */
2203    jump = NULL;    jump = NULL;
2204    if (common->utf8)    if (common->utf)
2205      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
2206  #endif  #endif /* COMPILE_PCRE8 */
2207    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), common->ctypes);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), common->ctypes);
2208    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 4 /* ctype_word */);    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 4 /* ctype_word */);
2209    OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);    OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
2210    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, TMP1, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, TMP1, 0);
2211  #ifdef SUPPORT_UTF8  #ifndef COMPILE_PCRE8
2212      JUMPHERE(jump);
2213    #elif defined SUPPORT_UTF
2214    if (jump != NULL)    if (jump != NULL)
2215      JUMPHERE(jump);      JUMPHERE(jump);
2216  #endif  #endif /* COMPILE_PCRE8 */
2217    }    }
2218  JUMPHERE(beginend);  JUMPHERE(beginend);
2219    
# Line 2042  peek_char(common); Line 2223  peek_char(common);
2223    
2224  /* Testing char type. This is a code duplication. */  /* Testing char type. This is a code duplication. */
2225  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2226  if (common->useucp)  if (common->use_ucp)
2227    {    {
2228    OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1);    OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1);
2229    jump = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);    jump = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
# Line 2058  if (common->useucp) Line 2239  if (common->useucp)
2239  else  else
2240  #endif  #endif
2241    {    {
2242  #ifdef SUPPORT_UTF8  #ifndef COMPILE_PCRE8
2243      /* TMP2 may be destroyed by peek_char. */
2244      OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);
2245      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
2246    #elif defined SUPPORT_UTF
2247    OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);    OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);
2248    jump = NULL;    jump = NULL;
2249    if (common->utf8)    if (common->utf)
2250      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
2251  #endif  #endif
2252    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), common->ctypes);    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), common->ctypes);
2253    OP2(SLJIT_LSHR, TMP2, 0, TMP2, 0, SLJIT_IMM, 4 /* ctype_word */);    OP2(SLJIT_LSHR, TMP2, 0, TMP2, 0, SLJIT_IMM, 4 /* ctype_word */);
2254    OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);    OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
2255  #ifdef SUPPORT_UTF8  #ifndef COMPILE_PCRE8
2256      JUMPHERE(jump);
2257    #elif defined SUPPORT_UTF
2258    if (jump != NULL)    if (jump != NULL)
2259      JUMPHERE(jump);      JUMPHERE(jump);
2260  #endif  #endif /* COMPILE_PCRE8 */
2261    }    }
2262  JUMPHERE(beginend);  JUMPHERE(beginend);
2263    
# Line 2089  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_I Line 2276  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_I
2276  OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);  OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
2277  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_LESS_EQUAL);  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_LESS_EQUAL);
2278  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
2279  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || defined COMPILE_PCRE16
2280  if (common->utf8)  #ifdef COMPILE_PCRE8
2281    if (common->utf)
2282    {    {
2283    #endif
2284    COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);    COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);
2285    OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);    OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);
2286    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
2287    #ifdef COMPILE_PCRE8
2288    }    }
2289  #endif  #endif
2290    #endif /* SUPPORT_UTF || COMPILE_PCRE16 */
2291  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);
2292  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
2293  }  }
# Line 2113  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_E Line 2304  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_E
2304  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);
2305  COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);  COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);
2306  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xa0);  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xa0);
2307  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || defined COMPILE_PCRE16
2308  if (common->utf8)  #ifdef COMPILE_PCRE8
2309    if (common->utf)
2310    {    {
2311    #endif
2312    COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);    COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);
2313    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x1680);    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x1680);
2314    COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);    COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);
# Line 2129  if (common->utf8) Line 2322  if (common->utf8)
2322    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x205f - 0x2000);    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x205f - 0x2000);
2323    COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);    COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);
2324    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x3000 - 0x2000);    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x3000 - 0x2000);
2325    #ifdef COMPILE_PCRE8
2326    }    }
2327  #endif  #endif
2328    #endif /* SUPPORT_UTF || COMPILE_PCRE16 */
2329  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);
2330    
2331  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
# Line 2147  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_I Line 2342  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_I
2342  OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);  OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
2343  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_LESS_EQUAL);  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_LESS_EQUAL);
2344  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);  OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
2345  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || defined COMPILE_PCRE16
2346  if (common->utf8)  #ifdef COMPILE_PCRE8
2347    if (common->utf)
2348    {    {
2349    #endif
2350    COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);    COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);
2351    OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);    OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);
2352    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);    OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
2353    #ifdef COMPILE_PCRE8
2354    }    }
2355  #endif  #endif
2356    #endif /* SUPPORT_UTF || COMPILE_PCRE16 */
2357  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);
2358    
2359  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
# Line 2173  sljit_emit_fast_enter(compiler, RETURN_A Line 2372  sljit_emit_fast_enter(compiler, RETURN_A
2372  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
2373  OP1(SLJIT_MOV, TMP3, 0, CHAR1, 0);  OP1(SLJIT_MOV, TMP3, 0, CHAR1, 0);
2374  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, CHAR2, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, CHAR2, 0);
2375  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
2376  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2377    
2378  label = LABEL();  label = LABEL();
2379  OP1(SLJIT_MOVU_UB, CHAR1, 0, SLJIT_MEM1(TMP1), 1);  OP1(MOVU_UCHAR, CHAR1, 0, SLJIT_MEM1(TMP1), IN_UCHARS(1));
2380  OP1(SLJIT_MOVU_UB, CHAR2, 0, SLJIT_MEM1(STR_PTR), 1);  OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
2381  jump = CMP(SLJIT_C_NOT_EQUAL, CHAR1, 0, CHAR2, 0);  jump = CMP(SLJIT_C_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
2382  OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);  OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
2383  JUMPTO(SLJIT_C_NOT_ZERO, label);  JUMPTO(SLJIT_C_NOT_ZERO, label);
2384    
2385  JUMPHERE(jump);  JUMPHERE(jump);
2386  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));
2387  OP1(SLJIT_MOV, CHAR1, 0, TMP3, 0);  OP1(SLJIT_MOV, CHAR1, 0, TMP3, 0);
2388  OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);  OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);
2389  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
# Line 2205  OP1(SLJIT_MOV, TMP3, 0, LCC_TABLE, 0); Line 2404  OP1(SLJIT_MOV, TMP3, 0, LCC_TABLE, 0);
2404  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, CHAR1, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, CHAR1, 0);
2405  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, CHAR2, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, CHAR2, 0);
2406  OP1(SLJIT_MOV, LCC_TABLE, 0, SLJIT_IMM, common->lcc);  OP1(SLJIT_MOV, LCC_TABLE, 0, SLJIT_IMM, common->lcc);
2407  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1));
2408  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2409    
2410  label = LABEL();  label = LABEL();
2411  OP1(SLJIT_MOVU_UB, CHAR1, 0, SLJIT_MEM1(TMP1), 1);  OP1(MOVU_UCHAR, CHAR1, 0, SLJIT_MEM1(TMP1), IN_UCHARS(1));
2412  OP1(SLJIT_MOVU_UB, CHAR2, 0, SLJIT_MEM1(STR_PTR), 1);  OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
2413    #ifndef COMPILE_PCRE8
2414    jump = CMP(SLJIT_C_GREATER, CHAR1, 0, SLJIT_IMM, 255);
2415    #endif
2416  OP1(SLJIT_MOV_UB, CHAR1, 0, SLJIT_MEM2(LCC_TABLE, CHAR1), 0);  OP1(SLJIT_MOV_UB, CHAR1, 0, SLJIT_MEM2(LCC_TABLE, CHAR1), 0);
2417    #ifndef COMPILE_PCRE8
2418    JUMPHERE(jump);
2419    jump = CMP(SLJIT_C_GREATER, CHAR2, 0, SLJIT_IMM, 255);
2420    #endif
2421  OP1(SLJIT_MOV_UB, CHAR2, 0, SLJIT_MEM2(LCC_TABLE, CHAR2), 0);  OP1(SLJIT_MOV_UB, CHAR2, 0, SLJIT_MEM2(LCC_TABLE, CHAR2), 0);
2422    #ifndef COMPILE_PCRE8
2423    JUMPHERE(jump);
2424    #endif
2425  jump = CMP(SLJIT_C_NOT_EQUAL, CHAR1, 0, CHAR2, 0);  jump = CMP(SLJIT_C_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
2426  OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);  OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
2427  JUMPTO(SLJIT_C_NOT_ZERO, label);  JUMPTO(SLJIT_C_NOT_ZERO, label);
2428    
2429  JUMPHERE(jump);  JUMPHERE(jump);
2430  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));
2431  OP1(SLJIT_MOV, LCC_TABLE, 0, TMP3, 0);  OP1(SLJIT_MOV, LCC_TABLE, 0, TMP3, 0);
2432  OP1(SLJIT_MOV, CHAR1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);  OP1(SLJIT_MOV, CHAR1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);
2433  OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1);  OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1);
# Line 2229  sljit_emit_fast_return(compiler, RETURN_ Line 2438  sljit_emit_fast_return(compiler, RETURN_
2438  #undef CHAR1  #undef CHAR1
2439  #undef CHAR2  #undef CHAR2
2440    
2441  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF && defined SUPPORT_UCP
 #ifdef SUPPORT_UCP  
2442    
2443  static uschar * SLJIT_CALL do_utf8caselesscmp(uschar *src1, jit_arguments *args, uschar *end1)  static const pcre_uchar *SLJIT_CALL do_utf_caselesscmp(pcre_uchar *src1, jit_arguments *args, pcre_uchar *end1)
2444  {  {
2445  /* This function would be ineffective to do in JIT level. */  /* This function would be ineffective to do in JIT level. */
2446  int c1, c2;  int c1, c2;
2447  uschar *src2 = args->ptr;  const pcre_uchar *src2 = args->ptr;
2448  uschar *end2 = (uschar*)args->end;  const pcre_uchar *end2 = args->end;
2449    
2450  while (src1 < end1)  while (src1 < end1)
2451    {    {
# Line 2250  while (src1 < end1) Line 2458  while (src1 < end1)
2458  return src2;  return src2;
2459  }  }
2460    
2461  #endif  #endif /* SUPPORT_UTF && SUPPORT_UCP */
 #endif  
2462    
2463  static uschar *byte_sequence_compare(compiler_common *common, BOOL caseless, uschar *cc,  static pcre_uchar *byte_sequence_compare(compiler_common *common, BOOL caseless, pcre_uchar *cc,
2464      compare_context* context, jump_list **fallbacks)      compare_context* context, jump_list **fallbacks)
2465  {  {
2466  DEFINE_COMPILER;  DEFINE_COMPILER;
2467  unsigned int othercasebit = 0;  unsigned int othercasebit = 0;
2468  uschar *othercasebyte = NULL;  pcre_uchar *othercasechar = NULL;
2469  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2470  int utf8length;  int utflength;
2471  #endif  #endif
2472    
2473  if (caseless && char_has_othercase(common, cc))  if (caseless && char_has_othercase(common, cc))
# Line 2268  if (caseless && char_has_othercase(commo Line 2475  if (caseless && char_has_othercase(commo
2475    othercasebit = char_get_othercase_bit(common, cc);    othercasebit = char_get_othercase_bit(common, cc);
2476    SLJIT_ASSERT(othercasebit);    SLJIT_ASSERT(othercasebit);
2477    /* Extracting bit difference info. */    /* Extracting bit difference info. */
2478    othercasebyte = cc + (othercasebit >> 8);  #ifdef COMPILE_PCRE8
2479      othercasechar = cc + (othercasebit >> 8);
2480    othercasebit &= 0xff;    othercasebit &= 0xff;
2481    #else
2482    #ifdef COMPILE_PCRE16
2483      othercasechar = cc + (othercasebit >> 9);
2484      if ((othercasebit & 0x100) != 0)
2485        othercasebit = (othercasebit & 0xff) << 8;
2486      else
2487        othercasebit &= 0xff;
2488    #endif
2489    #endif
2490    }    }
2491    
2492  if (context->sourcereg == -1)  if (context->sourcereg == -1)
2493    {    {
2494    #ifdef COMPILE_PCRE8
2495  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
2496    if (context->length >= 4)    if (context->length >= 4)
2497      OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
2498    else if (context->length >= 2)    else if (context->length >= 2)
2499      OP1(SLJIT_MOV_SH, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_UH, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
2500    else    else
2501  #endif  #endif
2502      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
2503    #else
2504    #ifdef COMPILE_PCRE16
2505    #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
2506      if (context->length >= 4)
2507        OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
2508      else
2509    #endif
2510        OP1(SLJIT_MOV_UH, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
2511    #endif
2512    #endif /* COMPILE_PCRE8 */
2513    context->sourcereg = TMP2;    context->sourcereg = TMP2;
2514    }    }
2515    
2516  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2517  utf8length = 1;  utflength = 1;
2518  if (common->utf8 && *cc >= 0xc0)  if (common->utf && HAS_EXTRALEN(*cc))
2519    utf8length += _pcre_utf8_table4[*cc & 0x3f];    utflength += GET_EXTRALEN(*cc);
2520    
2521  do  do
2522    {    {
2523  #endif  #endif
2524    
2525    context->length--;    context->length -= IN_UCHARS(1);
2526  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
2527    
2528    /* Unaligned read is supported. */    /* Unaligned read is supported. */
2529    if (othercasebit != 0 && othercasebyte == cc)    if (othercasebit != 0 && othercasechar == cc)
2530      {      {
2531      context->c.asbytes[context->byteptr] = *cc | othercasebit;      context->c.asuchars[context->ucharptr] = *cc | othercasebit;
2532      context->oc.asbytes[context->byteptr] = othercasebit;      context->oc.asuchars[context->ucharptr] = othercasebit;
2533      }      }
2534    else    else
2535      {      {
2536      context->c.asbytes[context->byteptr] = *cc;      context->c.asuchars[context->ucharptr] = *cc;
2537      context->oc.asbytes[context->byteptr] = 0;      context->oc.asuchars[context->ucharptr] = 0;
2538      }      }
2539    context->byteptr++;    context->ucharptr++;
2540    
2541    if (context->byteptr >= 4 || context->length == 0 || (context->byteptr == 2 && context->length == 1))  #ifdef COMPILE_PCRE8
2542      if (context->ucharptr >= 4 || context->length == 0 || (context->ucharptr == 2 && context->length == 1))
2543    #else
2544      if (context->ucharptr >= 2 || context->length == 0)
2545    #endif
2546      {      {
2547      if (context->length >= 4)      if (context->length >= 4)
2548        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);
2549    #ifdef COMPILE_PCRE8
2550      else if (context->length >= 2)      else if (context->length >= 2)
2551        OP1(SLJIT_MOV_SH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);        OP1(SLJIT_MOV_UH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
2552      else if (context->length >= 1)      else if (context->length >= 1)
2553        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);
2554    #else
2555        else if (context->length >= 2)
2556          OP1(SLJIT_MOV_UH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
2557    #endif
2558      context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;      context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;
2559    
2560      switch(context->byteptr)      switch(context->ucharptr)
2561        {        {
2562        case 4:        case 4 / sizeof(pcre_uchar):
2563        if (context->oc.asint != 0)        if (context->oc.asint != 0)
2564          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);
2565        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));
2566        break;        break;
2567    
2568        case 2:        case 2 / sizeof(pcre_uchar):
2569        if (context->oc.asshort != 0)        if (context->oc.asushort != 0)
2570          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.asushort);
2571        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.asushort | context->oc.asushort));
2572        break;        break;
2573    
2574    #ifdef COMPILE_PCRE8
2575        case 1:        case 1:
2576        if (context->oc.asbyte != 0)        if (context->oc.asbyte != 0)
2577          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);
2578        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));
2579        break;        break;
2580    #endif
2581    
2582        default:        default:
2583        SLJIT_ASSERT_STOP();        SLJIT_ASSERT_STOP();
2584        break;        break;
2585        }        }
2586      context->byteptr = 0;      context->ucharptr = 0;
2587      }      }
2588    
2589  #else  #else
2590    
2591    /* Unaligned read is unsupported. */    /* Unaligned read is unsupported. */
2592    #ifdef COMPILE_PCRE8
2593    if (context->length > 0)    if (context->length > 0)
2594      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);
2595    #else
2596      if (context->length > 0)
2597        OP1(SLJIT_MOV_UH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
2598    #endif
2599    context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;    context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;
2600    
2601    if (othercasebit != 0 && othercasebyte == cc)    if (othercasebit != 0 && othercasechar == cc)
2602      {      {
2603      OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, othercasebit);      OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, othercasebit);
2604      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 2365  do Line 2609  do
2609  #endif  #endif
2610    
2611    cc++;    cc++;
2612  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2613    utf8length--;    utflength--;
2614    }    }
2615  while (utf8length > 0);  while (utflength > 0);
2616  #endif  #endif
2617    
2618  return cc;  return cc;
2619  }  }
2620    
2621  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
2622    
2623  #define SET_TYPE_OFFSET(value) \  #define SET_TYPE_OFFSET(value) \
2624    if ((value) != typeoffset) \    if ((value) != typeoffset) \
# Line 2396  return cc; Line 2640  return cc;
2640      } \      } \
2641    charoffset = (value);    charoffset = (value);
2642    
2643  static void compile_xclass_hotpath(compiler_common *common, uschar *cc, jump_list **fallbacks)  static void compile_xclass_hotpath(compiler_common *common, pcre_uchar *cc, jump_list **fallbacks)
2644  {  {
2645  DEFINE_COMPILER;  DEFINE_COMPILER;
2646  jump_list *found = NULL;  jump_list *found = NULL;
# Line 2404  jump_list **list = (*cc & XCL_NOT) == 0 Line 2648  jump_list **list = (*cc & XCL_NOT) == 0
2648  unsigned int c;  unsigned int c;
2649  int compares;  int compares;
2650  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
2651  uschar *ccbegin;  pcre_uchar *ccbegin;
2652  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2653  BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;  BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;
2654  BOOL charsaved = FALSE;  BOOL charsaved = FALSE;
# Line 2414  unsigned int typeoffset; Line 2658  unsigned int typeoffset;
2658  int invertcmp, numberofcmps;  int invertcmp, numberofcmps;
2659  unsigned int charoffset;  unsigned int charoffset;
2660    
2661  /* Although SUPPORT_UTF8 must be defined, we are not necessary in utf8 mode. */  /* Although SUPPORT_UTF must be defined, we are not necessary in utf mode. */
2662  check_input_end(common, fallbacks);  check_input_end(common, fallbacks);
2663  read_char(common);  read_char(common);
2664    
2665  if ((*cc++ & XCL_MAP) != 0)  if ((*cc++ & XCL_MAP) != 0)
2666    {    {
2667    OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);    OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);
2668    if (common->utf8)  #ifndef COMPILE_PCRE8
2669      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
2670    #elif defined SUPPORT_UTF
2671      if (common->utf)
2672      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);      jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
2673    #endif
2674    
2675    OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);    OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
2676    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
# Line 2431  if ((*cc++ & XCL_MAP) != 0) Line 2679  if ((*cc++ & XCL_MAP) != 0)
2679    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);
2680    add_jump(compiler, list, JUMP(SLJIT_C_NOT_ZERO));    add_jump(compiler, list, JUMP(SLJIT_C_NOT_ZERO));
2681    
2682    if (common->utf8)  #ifndef COMPILE_PCRE8
2683      JUMPHERE(jump);
2684    #elif defined SUPPORT_UTF
2685      if (common->utf)
2686      JUMPHERE(jump);      JUMPHERE(jump);
2687    #endif
2688    OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);    OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
2689  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2690    charsaved = TRUE;    charsaved = TRUE;
2691  #endif  #endif
2692    cc += 32;    cc += 32 / sizeof(pcre_uchar);
2693    }    }
2694    
2695  /* Scanning the necessary info. */  /* Scanning the necessary info. */
# Line 2449  while (*cc != XCL_END) Line 2701  while (*cc != XCL_END)
2701    if (*cc == XCL_SINGLE)    if (*cc == XCL_SINGLE)
2702      {      {
2703      cc += 2;      cc += 2;
2704  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2705      if (common->utf8 && cc[-1] >= 0xc0) cc += _pcre_utf8_table4[cc[-1] & 0x3f];      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
2706  #endif  #endif
2707  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2708      needschar = TRUE;      needschar = TRUE;
# Line 2459  while (*cc != XCL_END) Line 2711  while (*cc != XCL_END)
2711    else if (*cc == XCL_RANGE)    else if (*cc == XCL_RANGE)
2712      {      {
2713      cc += 2;      cc += 2;
2714  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2715      if (common->utf8 && cc[-1] >= 0xc0) cc += _pcre_utf8_table4[cc[-1] & 0x3f];      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
2716  #endif  #endif
2717      cc++;      cc++;
2718  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2719      if (common->utf8 && cc[-1] >= 0xc0) cc += _pcre_utf8_table4[cc[-1] & 0x3f];      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
2720  #endif  #endif
2721  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2722      needschar = TRUE;      needschar = TRUE;
# Line 2534  if (needstype || needsscript) Line 2786  if (needstype || needsscript)
2786      {      {
2787      if (scriptreg == TMP1)      if (scriptreg == TMP1)
2788        {        {
2789        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));
2790        OP1(SLJIT_MOV_UB, scriptreg, 0, SLJIT_MEM2(scriptreg, TMP2), 3);        OP1(SLJIT_MOV_UB, scriptreg, 0, SLJIT_MEM2(scriptreg, TMP2), 3);
2791        }        }
2792      else      else
2793        {        {
2794        OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3);        OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3);
2795        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));
2796        OP1(SLJIT_MOV_UB, scriptreg, 0, SLJIT_MEM1(TMP2), 0);        OP1(SLJIT_MOV_UB, scriptreg, 0, SLJIT_MEM1(TMP2), 0);
2797        }        }
2798      }      }
# Line 2564  while (*cc != XCL_END) Line 2816  while (*cc != XCL_END)
2816    if (*cc == XCL_SINGLE)    if (*cc == XCL_SINGLE)
2817      {      {
2818      cc ++;      cc ++;
2819  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2820      if (common->utf8)      if (common->utf)
2821        {        {
2822        GETCHARINC(c, cc);        GETCHARINC(c, cc);
2823        }        }
# Line 2595  while (*cc != XCL_END) Line 2847  while (*cc != XCL_END)
2847    else if (*cc == XCL_RANGE)    else if (*cc == XCL_RANGE)
2848      {      {
2849      cc ++;      cc ++;
2850  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2851      if (common->utf8)      if (common->utf)
2852        {        {
2853        GETCHARINC(c, cc);        GETCHARINC(c, cc);
2854        }        }
# Line 2604  while (*cc != XCL_END) Line 2856  while (*cc != XCL_END)
2856  #endif  #endif
2857        c = *cc++;        c = *cc++;
2858      SET_CHAR_OFFSET(c);      SET_CHAR_OFFSET(c);
2859  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2860      if (common->utf8)      if (common->utf)
2861        {        {
2862        GETCHARINC(c, cc);        GETCHARINC(c, cc);
2863        }        }
# Line 2661  while (*cc != XCL_END) Line 2913  while (*cc != XCL_END)
2913        break;        break;
2914    
2915        case PT_GC:        case PT_GC:
2916        c = _pcre_ucp_typerange[(int)cc[1] * 2];        c = PRIV(ucp_typerange)[(int)cc[1] * 2];
2917        SET_TYPE_OFFSET(c);        SET_TYPE_OFFSET(c);
2918        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);
2919        break;        break;
2920    
2921        case PT_PC:        case PT_PC:
# Line 2725  if (found != NULL) Line 2977  if (found != NULL)
2977    
2978  #endif  #endif
2979    
2980  static uschar *compile_char1_hotpath(compiler_common *common, uschar type, uschar *cc, jump_list **fallbacks)  static pcre_uchar *compile_char1_hotpath(compiler_common *common, pcre_uchar type, pcre_uchar *cc, jump_list **fallbacks)
2981  {  {
2982  DEFINE_COMPILER;  DEFINE_COMPILER;
2983  int length;  int length;
2984  unsigned int c, oc, bit;  unsigned int c, oc, bit;
2985  compare_context context;  compare_context context;
2986  struct sljit_jump *jump[4];  struct sljit_jump *jump[4];
2987  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
2988  struct sljit_label *label;  struct sljit_label *label;
2989  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2990  uschar propdata[5];  pcre_uchar propdata[5];
2991  #endif  #endif
2992  #endif  #endif
2993    
# Line 2790  switch(type) Line 3042  switch(type)
3042      {      {
3043      jump[0] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);      jump[0] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
3044      jump[1] = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);      jump[1] = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
3045      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
3046      add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, common->newline & 0xff));      add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, common->newline & 0xff));
3047      JUMPHERE(jump[1]);      JUMPHERE(jump[1]);
3048      JUMPHERE(jump[0]);      JUMPHERE(jump[0]);
# Line 2801  switch(type) Line 3053  switch(type)
3053    
3054    case OP_ALLANY:    case OP_ALLANY:
3055    check_input_end(common, fallbacks);    check_input_end(common, fallbacks);
3056  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3057    if (common->utf8)    if (common->utf)
3058      {      {
3059      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
3060      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));
3061    #ifdef COMPILE_PCRE8
3062      jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);      jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
3063      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0);      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
3064        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
3065    #else /* COMPILE_PCRE8 */
3066    #ifdef COMPILE_PCRE16
3067        jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
3068        OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
3069        OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
3070        COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);
3071        OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
3072      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
3073    #endif /* COMPILE_PCRE16 */
3074    #endif /* COMPILE_PCRE8 */
3075      JUMPHERE(jump[0]);      JUMPHERE(jump[0]);
3076      return cc;      return cc;
3077      }      }
3078  #endif  #endif
3079    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));
3080    return cc;    return cc;
3081    
3082    case OP_ANYBYTE:    case OP_ANYBYTE:
3083    check_input_end(common, fallbacks);    check_input_end(common, fallbacks);
3084    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));
3085    return cc;    return cc;
3086    
3087  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3088  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
3089    case OP_NOTPROP:    case OP_NOTPROP:
3090    case OP_PROP:    case OP_PROP:
# Line 2840  switch(type) Line 3103  switch(type)
3103    read_char(common);    read_char(common);
3104    jump[0] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);    jump[0] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
3105    jump[1] = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);    jump[1] = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
3106    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
3107    jump[2] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL);    jump[2] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL);
3108    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));
3109    jump[3] = JUMP(SLJIT_JUMP);    jump[3] = JUMP(SLJIT_JUMP);
3110    JUMPHERE(jump[0]);    JUMPHERE(jump[0]);
3111    check_newlinechar(common, common->bsr_nltype, fallbacks, FALSE);    check_newlinechar(common, common->bsr_nltype, fallbacks, FALSE);
# Line 2892  switch(type) Line 3155  switch(type)
3155    jump[0] = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);    jump[0] = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
3156    if (common->nltype == NLTYPE_FIXED && common->newline > 255)    if (common->nltype == NLTYPE_FIXED && common->newline > 255)
3157      {      {
3158      OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, 2);      OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
3159      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
3160      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_END, 0));      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_END, 0));
3161      OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 1);      OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
3162      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
3163      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
3164      }      }
3165    else if (common->nltype == NLTYPE_FIXED)    else if (common->nltype == NLTYPE_FIXED)
3166      {      {
3167      OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, 1);      OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
3168      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
3169      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_END, 0));      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, STR_END, 0));
3170      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline));      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline));
3171      }      }
3172    else    else
3173      {      {
3174      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
3175      jump[1] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);      jump[1] = CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
3176      OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, 2);      OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
3177      OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);      OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
3178      jump[2] = JUMP(SLJIT_C_GREATER);      jump[2] = JUMP(SLJIT_C_GREATER);
3179      add_jump(compiler, fallbacks, JUMP(SLJIT_C_LESS));      add_jump(compiler, fallbacks, JUMP(SLJIT_C_LESS));
3180      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 1);      /* Equal. */
3181        OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
3182      jump[3] = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL);      jump[3] = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL);
3183      add_jump(compiler, fallbacks, JUMP(SLJIT_JUMP));      add_jump(compiler, fallbacks, JUMP(SLJIT_JUMP));
3184    
3185      JUMPHERE(jump[1]);      JUMPHERE(jump[1]);
3186      if (common->nltype == NLTYPE_ANYCRLF)      if (common->nltype == NLTYPE_ANYCRLF)
3187        {        {
3188        OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, 1);        OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
3189        add_jump(compiler, fallbacks, CMP(SLJIT_C_LESS, TMP2, 0, STR_END, 0));        add_jump(compiler, fallbacks, CMP(SLJIT_C_LESS, TMP2, 0, STR_END, 0));
3190        add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL));        add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL));
3191        }        }
# Line 2961  switch(type) Line 3225  switch(type)
3225    jump[0] = JUMP(SLJIT_JUMP);    jump[0] = JUMP(SLJIT_JUMP);
3226    JUMPHERE(jump[1]);    JUMPHERE(jump[1]);
3227    
3228    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, end));    add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, STR_PTR, 0, STR_END, 0));
   add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, TMP2, 0, STR_PTR, 0));  
   
3229    if (common->nltype == NLTYPE_FIXED && common->newline > 255)    if (common->nltype == NLTYPE_FIXED && common->newline > 255)
3230      {      {
3231      OP2(SLJIT_SUB, TMP2, 0, STR_PTR, 0, SLJIT_IMM, 2);      OP2(SLJIT_SUB, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
3232      add_jump(compiler, fallbacks, CMP(SLJIT_C_LESS, TMP2, 0, TMP1, 0));      add_jump(compiler, fallbacks, CMP(SLJIT_C_LESS, TMP2, 0, TMP1, 0));
3233      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -2);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-2));
3234      OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), -1);      OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1));
3235      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
3236      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
3237      }      }
# Line 3003  switch(type) Line 3265  switch(type)
3265    
3266    if (common->nltype == NLTYPE_FIXED && common->newline > 255)    if (common->nltype == NLTYPE_FIXED && common->newline > 255)
3267      {      {
3268      OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, 2);      OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
3269      add_jump(compiler, fallbacks, CMP(SLJIT_C_GREATER, TMP2, 0, STR_END, 0));      add_jump(compiler, fallbacks, CMP(SLJIT_C_GREATER, TMP2, 0, STR_END, 0));
3270      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
3271      OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(STR_PTR), 1);      OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
3272      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff));
3273      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));      add_jump(compiler, fallbacks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff));
3274      }      }
# Line 3021  switch(type) Line 3283  switch(type)
3283    case OP_CHAR:    case OP_CHAR:
3284    case OP_CHARI:    case OP_CHARI:
3285    length = 1;    length = 1;
3286  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3287    if (common->utf8 && *cc >= 0xc0) length += _pcre_utf8_table4[*cc & 0x3f];    if (common->utf && HAS_EXTRALEN(*cc)) length += GET_EXTRALEN(*cc);
3288  #endif  #endif
3289    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)
3290      {      {
3291      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, length);      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(length));
3292      add_jump(compiler, fallbacks, CMP(SLJIT_C_GREATER, STR_PTR, 0, STR_END, 0));      add_jump(compiler, fallbacks, CMP(SLJIT_C_GREATER, STR_PTR, 0, STR_END, 0));
3293    
3294      context.length = length;      context.length = IN_UCHARS(length);
3295      context.sourcereg = -1;      context.sourcereg = -1;
3296  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
3297      context.byteptr = 0;      context.ucharptr = 0;
3298  #endif  #endif
3299      return byte_sequence_compare(common, type == OP_CHARI, cc, &context, fallbacks);      return byte_sequence_compare(common, type == OP_CHARI, cc, &context, fallbacks);
3300      }      }
3301    add_jump(compiler, fallbacks, CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));    check_input_end(common, fallbacks);
3302    read_char(common);    read_char(common);
3303  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3304    if (common->utf8)    if (common->utf)
3305      {      {
3306      GETCHAR(c, cc);      GETCHAR(c, cc);
3307      }      }
# Line 3055  switch(type) Line 3317  switch(type)
3317    
3318    case OP_NOT:    case OP_NOT:
3319    case OP_NOTI:    case OP_NOTI:
3320      check_input_end(common, fallbacks);
3321    length = 1;    length = 1;
3322  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3323    if (common->utf8)    if (common->utf)
3324      {      {
3325      if (*cc >= 0xc0) length += _pcre_utf8_table4[*cc & 0x3f];  #ifdef COMPILE_PCRE8
3326        c = *cc;
3327      check_input_end(common, fallbacks);      if (c < 128)
     GETCHAR(c, cc);  
   
     if (c <= 127)  
3328        {        {
3329        OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);        OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
3330        if (type == OP_NOT || !char_has_othercase(common, cc))        if (type == OP_NOT || !char_has_othercase(common, cc))
# Line 3076  switch(type) Line 3336  switch(type)
3336          add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, c | 0x20));          add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, c | 0x20));
3337          }          }
3338        /* Skip the variable-length character. */        /* Skip the variable-length character. */
3339        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));
3340        jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);        jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
3341        OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0);        OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
3342        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
3343        JUMPHERE(jump[0]);        JUMPHERE(jump[0]);
3344        return cc + length;        return cc + 1;
3345        }        }
3346      else      else
3347    #endif /* COMPILE_PCRE8 */
3348          {
3349          GETCHARLEN(c, cc, length);
3350        read_char(common);        read_char(common);
3351          }
3352      }      }
3353    else    else
3354  #endif  #endif /* SUPPORT_UTF */
3355      {      {
3356      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);      read_char(common);
     add_jump(compiler, fallbacks, CMP(SLJIT_C_GREATER, STR_PTR, 0, STR_END, 0));  
     OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -1);  
3357      c = *cc;      c = *cc;
3358      }      }
3359    
# Line 3112  switch(type) Line 3374  switch(type)
3374        add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, oc));        add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, oc));
3375        }        }
3376      }      }
3377    return cc + length;    return cc + 1;
3378    
3379    case OP_CLASS:    case OP_CLASS:
3380    case OP_NCLASS:    case OP_NCLASS:
3381    check_input_end(common, fallbacks);    check_input_end(common, fallbacks);
3382    read_char(common);    read_char(common);
3383  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
3384    jump[0] = NULL;    jump[0] = NULL;
3385    if (common->utf8)  #ifdef COMPILE_PCRE8
3386      /* This check only affects 8 bit mode. In other modes, we
3387      always need to compare the value with 255. */
3388      if (common->utf)
3389    #endif /* COMPILE_PCRE8 */
3390      {      {
3391      jump[0] = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);      jump[0] = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);
3392      if (type == OP_CLASS)      if (type == OP_CLASS)
# Line 3129  switch(type) Line 3395  switch(type)
3395        jump[0] = NULL;        jump[0] = NULL;
3396        }        }
3397      }      }
3398  #endif  #endif /* SUPPORT_UTF || !COMPILE_PCRE8 */
3399    OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);    OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
3400    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);    OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
3401    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)cc);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)cc);
3402    OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);    OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
3403    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);
3404    add_jump(compiler, fallbacks, JUMP(SLJIT_C_ZERO));    add_jump(compiler, fallbacks, JUMP(SLJIT_C_ZERO));
3405  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
3406    if (jump[0] != NULL)    if (jump[0] != NULL)
3407      JUMPHERE(jump[0]);      JUMPHERE(jump[0]);
3408  #endif  #endif /* SUPPORT_UTF || !COMPILE_PCRE8 */
3409    return cc + 32;    return cc + 32 / sizeof(pcre_uchar);
3410    
3411  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || defined COMPILE_PCRE16
3412    case OP_XCLASS:    case OP_XCLASS:
3413    compile_xclass_hotpath(common, cc + LINK_SIZE, fallbacks);    compile_xclass_hotpath(common, cc + LINK_SIZE, fallbacks);
3414    return cc + GET(cc, 0) - 1;    return cc + GET(cc, 0) - 1;
# Line 3152  switch(type) Line 3418  switch(type)
3418    length = GET(cc, 0);    length = GET(cc, 0);
3419    SLJIT_ASSERT(length > 0);    SLJIT_ASSERT(length > 0);
3420    OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);    OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
3421    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));  #ifdef SUPPORT_UTF
3422  #ifdef SUPPORT_UTF8    if (common->utf)
   if (common->utf8)  
3423      {      {
3424        OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
3425      OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, length);      OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, length);
3426      label = LABEL();      label = LABEL();
3427      add_jump(compiler, fallbacks, CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP1, 0));      add_jump(compiler, fallbacks, CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP3, 0));
3428      skip_char_back(common);      skip_char_back(common);
3429      OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);      OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
3430      JUMPTO(SLJIT_C_NOT_ZERO, label);      JUMPTO(SLJIT_C_NOT_ZERO, label);
3431      return cc + LINK_SIZE;      return cc + LINK_SIZE;
3432      }      }
3433  #endif  #endif
3434    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, length);    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
3435      OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(length));
3436    add_jump(compiler, fallbacks, CMP(SLJIT_C_LESS, STR_PTR, 0, TMP1, 0));    add_jump(compiler, fallbacks, CMP(SLJIT_C_LESS, STR_PTR, 0, TMP1, 0));
3437    return cc + LINK_SIZE;    return cc + LINK_SIZE;
3438    }    }
# Line 3173  SLJIT_ASSERT_STOP(); Line 3440  SLJIT_ASSERT_STOP();
3440  return cc;  return cc;
3441  }  }
3442    
3443  static SLJIT_INLINE uschar *compile_charn_hotpath(compiler_common *common, uschar *cc, uschar *ccend, jump_list **fallbacks)  static SLJIT_INLINE pcre_uchar *compile_charn_hotpath(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, jump_list **fallbacks)
3444  {  {
3445  /* This function consumes at least one input character. */  /* This function consumes at least one input character. */
3446  /* To decrease the number of length checks, we try to concatenate the fixed length character sequences. */  /* To decrease the number of length checks, we try to concatenate the fixed length character sequences. */
3447  DEFINE_COMPILER;  DEFINE_COMPILER;
3448  uschar *ccbegin = cc;  pcre_uchar *ccbegin = cc;
3449  compare_context context;  compare_context context;
3450  int size;  int size;
3451    
# Line 3191  do Line 3458  do
3458    if (*cc == OP_CHAR)    if (*cc == OP_CHAR)
3459      {      {
3460      size = 1;      size = 1;
3461  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3462      if (common->utf8 && cc[1] >= 0xc0)      if (common->utf && HAS_EXTRALEN(cc[1]))
3463        size += _pcre_utf8_table4[cc[1] & 0x3f];        size += GET_EXTRALEN(cc[1]);
3464  #endif  #endif
3465      }      }
3466    else if (*cc == OP_CHARI)    else if (*cc == OP_CHARI)
3467      {      {
3468      size = 1;      size = 1;
3469  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
3470      if (common->utf8)      if (common->utf)
3471        {        {
3472        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)
3473          size = 0;          size = 0;
3474        else if (cc[1] >= 0xc0)        else if (HAS_EXTRALEN(cc[1]))
3475          size += _pcre_utf8_table4[cc[1] & 0x3f];          size += GET_EXTRALEN(cc[1]);
3476        }        }
3477      else      else
3478  #endif  #endif
# Line 3216  do Line 3483  do
3483      size = 0;      size = 0;
3484    
3485    cc += 1 + size;    cc += 1 + size;
3486    context.length += size;    context.length += IN_UCHARS(size);
3487    }    }
3488  while (size > 0 && context.length <= 128);  while (size > 0 && context.length <= 128);
3489    
# Line 3229  if (context.length > 0) Line 3496  if (context.length > 0)
3496    
3497    context.sourcereg = -1;    context.sourcereg = -1;
3498  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
3499    context.byteptr = 0;    context.ucharptr = 0;
3500  #endif  #endif
3501    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);
3502    return cc;    return cc;
# Line 3239  if (context.length > 0) Line 3506  if (context.length > 0)
3506  return compile_char1_hotpath(common, *cc, cc + 1, fallbacks);  return compile_char1_hotpath(common, *cc, cc + 1, fallbacks);
3507  }  }
3508    
3509  static struct sljit_jump *compile_ref_checks(compiler_common *common, uschar *cc, jump_list **fallbacks)  static struct sljit_jump *compile_ref_checks(compiler_common *common, pcre_uchar *cc, jump_list **fallbacks)
3510  {  {
3511  DEFINE_COMPILER;  DEFINE_COMPILER;
3512  int offset = GET2(cc, 1) << 1;  int offset = GET2(cc, 1) << 1;
# Line 3261  return CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT Line 3528  return CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT
3528  }  }
3529    
3530  /* Forward definitions. */  /* Forward definitions. */
3531  static void compile_hotpath(compiler_common *, uschar *, uschar *, fallback_common *);  static void compile_hotpath(compiler_common *, pcre_uchar *, pcre_uchar *, fallback_common *);
3532  static void compile_fallbackpath(compiler_common *, struct fallback_common *);  static void compile_fallbackpath(compiler_common *, struct fallback_common *);
3533    
3534  #define PUSH_FALLBACK(size, ccstart, error) \  #define PUSH_FALLBACK(size, ccstart, error) \
# Line 3292  static void compile_fallbackpath(compile Line 3559  static void compile_fallbackpath(compile
3559    
3560  #define FALLBACK_AS(type) ((type*)fallback)  #define FALLBACK_AS(type) ((type*)fallback)
3561    
3562  static uschar *compile_ref_hotpath(compiler_common *common, uschar *cc, jump_list **fallbacks, BOOL withchecks, BOOL emptyfail)  static pcre_uchar *compile_ref_hotpath(compiler_common *common, pcre_uchar *cc, jump_list **fallbacks, BOOL withchecks, BOOL emptyfail)
3563  {  {
3564  DEFINE_COMPILER;  DEFINE_COMPILER;
3565  int offset = GET2(cc, 1) << 1;  int offset = GET2(cc, 1) << 1;
# Line 3302  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT Line 3569  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT
3569  if (withchecks && !common->jscript_compat)  if (withchecks && !common->jscript_compat)
3570    add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));    add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));
3571    
3572  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF && defined SUPPORT_UCP
3573  #ifdef SUPPORT_UCP  if (common->utf && *cc == OP_REFI)
 if (common->utf8 && *cc == OP_REFI)  
3574    {    {
3575    SLJIT_ASSERT(TMP1 == SLJIT_TEMPORARY_REG1 && STACK_TOP == SLJIT_TEMPORARY_REG2 && TMP2 == SLJIT_TEMPORARY_REG3);    SLJIT_ASSERT(TMP1 == SLJIT_TEMPORARY_REG1 && STACK_TOP == SLJIT_TEMPORARY_REG2 && TMP2 == SLJIT_TEMPORARY_REG3);
3576    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));
# Line 3315  if (common->utf8 && *cc == OP_REFI) Line 3581  if (common->utf8 && *cc == OP_REFI)
3581    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0);
3582    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, ARGUMENTS, 0);    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, ARGUMENTS, 0);
3583    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, ptr), STR_PTR, 0);
3584    sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf8caselesscmp));    sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf_caselesscmp));
3585    OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);    OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);
3586    add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0));    add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0));
3587    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);
3588    }    }
3589  else  else
3590  #endif  #endif /* SUPPORT_UTF && SUPPORT_UCP */
 #endif  
3591    {    {
3592    OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP1, 0);    OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP1, 0);
3593    if (withchecks)    if (withchecks)
# Line 3341  if (jump != NULL) Line 3606  if (jump != NULL)
3606    else    else
3607      JUMPHERE(jump);      JUMPHERE(jump);
3608    }    }
3609  return cc + 3;  return cc + 1 + IMM2_SIZE;
3610  }  }
3611    
3612  static SLJIT_INLINE uschar *compile_ref_iterator_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static SLJIT_INLINE pcre_uchar *compile_ref_iterator_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
3613  {  {
3614  DEFINE_COMPILER;  DEFINE_COMPILER;
3615  fallback_common *fallback;  fallback_common *fallback;
3616  uschar type;  pcre_uchar type;
3617  struct sljit_label *label;  struct sljit_label *label;
3618  struct sljit_jump *zerolength;  struct sljit_jump *zerolength;
3619  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
3620  uschar *ccbegin = cc;  pcre_uchar *ccbegin = cc;
3621  int min = 0, max = 0;  int min = 0, max = 0;
3622  BOOL minimize;  BOOL minimize;
3623    
3624  PUSH_FALLBACK(sizeof(iterator_fallback), cc, NULL);  PUSH_FALLBACK(sizeof(iterator_fallback), cc, NULL);
3625    
3626  type = cc[3];  type = cc[1 + IMM2_SIZE];
3627  minimize = (type & 0x1) != 0;  minimize = (type & 0x1) != 0;
3628  switch(type)  switch(type)
3629    {    {
# Line 3366  switch(type) Line 3631  switch(type)
3631    case OP_CRMINSTAR:    case OP_CRMINSTAR:
3632    min = 0;    min = 0;
3633    max = 0;    max = 0;
3634    cc += 4;    cc += 1 + IMM2_SIZE + 1;
3635    break;    break;
3636    case OP_CRPLUS:    case OP_CRPLUS:
3637    case OP_CRMINPLUS:    case OP_CRMINPLUS:
3638    min = 1;    min = 1;
3639    max = 0;    max = 0;
3640    cc += 4;    cc += 1 + IMM2_SIZE + 1;
3641    break;    break;
3642    case OP_CRQUERY:    case OP_CRQUERY:
3643    case OP_CRMINQUERY:    case OP_CRMINQUERY:
3644    min = 0;    min = 0;
3645    max = 1;    max = 1;
3646    cc += 4;    cc += 1 + IMM2_SIZE + 1;
3647    break;    break;
3648    case OP_CRRANGE:    case OP_CRRANGE:
3649    case OP_CRMINRANGE:    case OP_CRMINRANGE:
3650    min = GET2(cc, 3 + 1);    min = GET2(cc, 1 + IMM2_SIZE + 1);
3651    max = GET2(cc, 3 + 3);    max = GET2(cc, 1 + IMM2_SIZE + 1 + IMM2_SIZE);
3652    cc += 8;    cc += 1 + IMM2_SIZE + 1 + 2 * IMM2_SIZE;
3653    break;    break;
3654    default:    default:
3655    SLJIT_ASSERT_STOP();    SLJIT_ASSERT_STOP();
# Line 3488  decrease_call_count(common); Line 3753  decrease_call_count(common);
3753  return cc;  return cc;
3754  }  }
3755    
3756  static SLJIT_INLINE uschar *compile_recurse_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static SLJIT_INLINE pcre_uchar *compile_recurse_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
3757  {  {
3758  DEFINE_COMPILER;  DEFINE_COMPILER;
3759  fallback_common *fallback;  fallback_common *fallback;
# Line 3534  add_jump(compiler, &fallback->topfallbac Line 3799  add_jump(compiler, &fallback->topfallbac
3799  return cc + 1 + LINK_SIZE;  return cc + 1 + LINK_SIZE;
3800  }  }
3801    
3802  static uschar *compile_assert_hotpath(compiler_common *common, uschar *cc, assert_fallback *fallback, BOOL conditional)  static pcre_uchar *compile_assert_hotpath(compiler_common *common, pcre_uchar *cc, assert_fallback *fallback, BOOL conditional)
3803  {  {
3804  DEFINE_COMPILER;  DEFINE_COMPILER;
3805  int framesize;  int framesize;
3806  int localptr;  int localptr;
3807  fallback_common altfallback;  fallback_common altfallback;
3808  uschar *ccbegin;  pcre_uchar *ccbegin;
3809  uschar opcode;  pcre_uchar opcode;
3810  uschar bra = OP_BRA;  pcre_uchar bra = OP_BRA;
3811  jump_list *tmp = NULL;  jump_list *tmp = NULL;
3812  jump_list **target = (conditional) ? &fallback->condfailed : &fallback->common.topfallbacks;  jump_list **target = (conditional) ? &fallback->condfailed : &fallback->common.topfallbacks;
3813  jump_list **found;  jump_list **found;
# Line 3558  if (*cc == OP_BRAZERO || *cc == OP_BRAMI Line 3823  if (*cc == OP_BRAZERO || *cc == OP_BRAMI
3823    bra = *cc;    bra = *cc;
3824    cc++;    cc++;
3825    }    }
3826  localptr = PRIV(cc);  localptr = PRIV_DATA(cc);
3827  SLJIT_ASSERT(localptr != 0);  SLJIT_ASSERT(localptr != 0);
3828  framesize = get_framesize(common, cc, FALSE);  framesize = get_framesize(common, cc, FALSE);
3829  fallback->framesize = framesize;  fallback->framesize = framesize;
# Line 3804  common->accept = save_accept; Line 4069  common->accept = save_accept;
4069  return cc + 1 + LINK_SIZE;  return cc + 1 + LINK_SIZE;
4070  }  }
4071    
4072  static sljit_w SLJIT_CALL do_searchovector(sljit_w refno, sljit_w* locals, uschar *name_table)  static sljit_w SLJIT_CALL do_searchovector(sljit_w refno, sljit_w* locals, pcre_uchar *name_table)
4073  {  {
4074  int condition = FALSE;  int condition = FALSE;
4075  uschar *slotA = name_table;  pcre_uchar *slotA = name_table;
4076  uschar *slotB;  pcre_uchar *slotB;
4077  sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)];  sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)];
4078  sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];  sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];
4079  sljit_w no_capture;  sljit_w no_capture;
# Line 3833  if (i < name_count) Line 4098  if (i < name_count)
4098    while (slotB > name_table)    while (slotB > name_table)
4099      {      {
4100      slotB -= name_entry_size;      slotB -= name_entry_size;
4101      if (strcmp((char *)slotA + 2, (char *)slotB + 2) == 0)      if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
4102        {        {
4103        condition = locals[GET2(slotB, 0) << 1] != no_capture;        condition = locals[GET2(slotB, 0) << 1] != no_capture;
4104        if (condition) break;        if (condition) break;
# Line 3848  if (i < name_count) Line 4113  if (i < name_count)
4113      for (i++; i < name_count; i++)      for (i++; i < name_count; i++)
4114        {        {
4115        slotB += name_entry_size;        slotB += name_entry_size;
4116        if (strcmp((char *)slotA + 2, (char *)slotB + 2) == 0)        if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
4117          {          {
4118          condition = locals[GET2(slotB, 0) << 1] != no_capture;          condition = locals[GET2(slotB, 0) << 1] != no_capture;
4119          if (condition) break;          if (condition) break;
# Line 3860  if (i < name_count) Line 4125  if (i < name_count)
4125  return condition;  return condition;
4126  }  }
4127    
4128  static sljit_w SLJIT_CALL do_searchgroups(sljit_w recno, sljit_w* locals, uschar *name_table)  static sljit_w SLJIT_CALL do_searchgroups(sljit_w recno, sljit_w* locals, pcre_uchar *name_table)
4129  {  {
4130  int condition = FALSE;  int condition = FALSE;
4131  uschar *slotA = name_table;  pcre_uchar *slotA = name_table;
4132  uschar *slotB;  pcre_uchar *slotB;
4133  sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)];  sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)];
4134  sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];  sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];
4135  sljit_w group_num = locals[POSSESSIVE0 / sizeof(sljit_w)];  sljit_w group_num = locals[POSSESSIVE0 / sizeof(sljit_w)];
# Line 3886  if (i < name_count) Line 4151  if (i < name_count)
4151    while (slotB > name_table)    while (slotB > name_table)
4152      {      {
4153      slotB -= name_entry_size;      slotB -= name_entry_size;
4154      if (strcmp((char *)slotA + 2, (char *)slotB + 2) == 0)      if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
4155        {        {
4156        condition = GET2(slotB, 0) == group_num;        condition = GET2(slotB, 0) == group_num;
4157        if (condition) break;        if (condition) break;
# Line 3901  if (i < name_count) Line 4166  if (i < name_count)
4166      for (i++; i < name_count; i++)      for (i++; i < name_count; i++)
4167        {        {
4168        slotB += name_entry_size;        slotB += name_entry_size;
4169        if (strcmp((char *)slotA + 2, (char *)slotB + 2) == 0)        if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
4170          {          {
4171          condition = GET2(slotB, 0) == group_num;          condition = GET2(slotB, 0) == group_num;
4172          if (condition) break;          if (condition) break;
# Line 3967  return condition; Line 4232  return condition;
4232                                            Or nothing, if trace is unnecessary                                            Or nothing, if trace is unnecessary
4233  */  */
4234    
4235  static uschar *compile_bracket_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static pcre_uchar *compile_bracket_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
4236  {  {
4237  DEFINE_COMPILER;  DEFINE_COMPILER;
4238  fallback_common *fallback;  fallback_common *fallback;
4239  uschar opcode;  pcre_uchar opcode;
4240  int localptr = 0;  int localptr = 0;
4241  int offset = 0;  int offset = 0;
4242  int stacksize;  int stacksize;
4243  uschar *ccbegin;  pcre_uchar *ccbegin;
4244  uschar *hotpath;  pcre_uchar *hotpath;
4245  uschar bra = OP_BRA;  pcre_uchar bra = OP_BRA;
4246  uschar ket;  pcre_uchar ket;
4247  assert_fallback *assert;  assert_fallback *assert;
4248  BOOL has_alternatives;  BOOL has_alternatives;
4249  struct sljit_jump *jump;  struct sljit_jump *jump;
# Line 4039  if (opcode == OP_CBRA || opcode == OP_SC Line 4304  if (opcode == OP_CBRA || opcode == OP_SC
4304    localptr = OVECTOR_PRIV(offset);    localptr = OVECTOR_PRIV(offset);
4305    offset <<= 1;    offset <<= 1;
4306    FALLBACK_AS(bracket_fallback)->localptr = localptr;    FALLBACK_AS(bracket_fallback)->localptr = localptr;
4307    hotpath += 2;    hotpath += IMM2_SIZE;
4308    }    }
4309  else if (opcode == OP_ONCE || opcode == OP_SBRA || opcode == OP_SCOND)  else if (opcode == OP_ONCE || opcode == OP_SBRA || opcode == OP_SCOND)
4310    {    {
4311    /* Other brackets simply allocate the next entry. */    /* Other brackets simply allocate the next entry. */
4312    localptr = PRIV(ccbegin);    localptr = PRIV_DATA(ccbegin);
4313    SLJIT_ASSERT(localptr != 0);    SLJIT_ASSERT(localptr != 0);
4314    FALLBACK_AS(bracket_fallback)->localptr = localptr;    FALLBACK_AS(bracket_fallback)->localptr = localptr;
4315    if (opcode == OP_ONCE)    if (opcode == OP_ONCE)
# Line 4203  if (opcode == OP_COND || opcode == OP_SC Line 4468  if (opcode == OP_COND || opcode == OP_SC
4468      SLJIT_ASSERT(has_alternatives);      SLJIT_ASSERT(has_alternatives);
4469      add_jump(compiler, &(FALLBACK_AS(bracket_fallback)->u.condfailed),      add_jump(compiler, &(FALLBACK_AS(bracket_fallback)->u.condfailed),
4470        CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(GET2(hotpath, 1) << 1), SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));        CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(GET2(hotpath, 1) << 1), SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));
4471      hotpath += 3;      hotpath += 1 + IMM2_SIZE;
4472      }      }
4473    else if (*hotpath == OP_NCREF)    else if (*hotpath == OP_NCREF)
4474      {      {
# Line 4222  if (opcode == OP_COND || opcode == OP_SC Line 4487  if (opcode == OP_COND || opcode == OP_SC
4487      add_jump(compiler, &(FALLBACK_AS(bracket_fallback)->u.condfailed), CMP(SLJIT_C_EQUAL, SLJIT_TEMPORARY_REG1, 0, SLJIT_IMM, 0));      add_jump(compiler, &(FALLBACK_AS(bracket_fallback)->u.condfailed), CMP(SLJIT_C_EQUAL, SLJIT_TEMPORARY_REG1, 0, SLJIT_IMM, 0));
4488    
4489      JUMPHERE(jump);      JUMPHERE(jump);
4490      hotpath += 3;      hotpath += 1 + IMM2_SIZE;
4491      }      }
4492    else if (*hotpath == OP_RREF || *hotpath == OP_NRREF)    else if (*hotpath == OP_RREF || *hotpath == OP_NRREF)
4493      {      {
# Line 4243  if (opcode == OP_COND || opcode == OP_SC Line 4508  if (opcode == OP_COND || opcode == OP_SC
4508        {        {
4509        SLJIT_ASSERT(!has_alternatives);        SLJIT_ASSERT(!has_alternatives);
4510        if (stacksize != 0)        if (stacksize != 0)
4511          hotpath += 3;          hotpath += 1 + IMM2_SIZE;
4512        else        else
4513          {          {
4514          if (*cc == OP_ALT)          if (*cc == OP_ALT)
# Line 4270  if (opcode == OP_COND || opcode == OP_SC Line 4535  if (opcode == OP_COND || opcode == OP_SC
4535        sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_searchgroups));        sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_searchgroups));
4536        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1);        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1);
4537        add_jump(compiler, &(FALLBACK_AS(bracket_fallback)->u.condfailed), CMP(SLJIT_C_EQUAL, SLJIT_TEMPORARY_REG1, 0, SLJIT_IMM, 0));        add_jump(compiler, &(FALLBACK_AS(bracket_fallback)->u.condfailed), CMP(SLJIT_C_EQUAL, SLJIT_TEMPORARY_REG1, 0, SLJIT_IMM, 0));
4538        hotpath += 3;        hotpath += 1 + IMM2_SIZE;
4539        }        }
4540      }      }
4541    else    else
# Line 4406  cc += 1 + LINK_SIZE; Line 4671  cc += 1 + LINK_SIZE;
4671  return cc;  return cc;
4672  }  }
4673    
4674  static uschar *compile_bracketpos_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static pcre_uchar *compile_bracketpos_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
4675  {  {
4676  DEFINE_COMPILER;  DEFINE_COMPILER;
4677  fallback_common *fallback;  fallback_common *fallback;
4678  uschar opcode;  pcre_uchar opcode;
4679  int localptr;  int localptr;
4680  int cbraprivptr = 0;  int cbraprivptr = 0;
4681  int framesize;  int framesize;
4682  int stacksize;  int stacksize;
4683  int offset = 0;  int offset = 0;
4684  BOOL zero = FALSE;  BOOL zero = FALSE;
4685  uschar *ccbegin = NULL;  pcre_uchar *ccbegin = NULL;
4686  int stack;  int stack;
4687  struct sljit_label *loop = NULL;  struct sljit_label *loop = NULL;
4688  struct jump_list *emptymatch = NULL;  struct jump_list *emptymatch = NULL;
# Line 4430  if (*cc == OP_BRAPOSZERO) Line 4695  if (*cc == OP_BRAPOSZERO)
4695    }    }
4696    
4697  opcode = *cc;  opcode = *cc;
4698  localptr = PRIV(cc);  localptr = PRIV_DATA(cc);
4699  SLJIT_ASSERT(localptr != 0);  SLJIT_ASSERT(localptr != 0);
4700  FALLBACK_AS(bracketpos_fallback)->localptr = localptr;  FALLBACK_AS(bracketpos_fallback)->localptr = localptr;
4701  switch(opcode)  switch(opcode)
# Line 4445  switch(opcode) Line 4710  switch(opcode)
4710    offset = GET2(cc, 1 + LINK_SIZE);    offset = GET2(cc, 1 + LINK_SIZE);
4711    cbraprivptr = OVECTOR_PRIV(offset);    cbraprivptr = OVECTOR_PRIV(offset);
4712    offset <<= 1;    offset <<= 1;
4713    ccbegin = cc + 1 + LINK_SIZE + 2;    ccbegin = cc + 1 + LINK_SIZE + IMM2_SIZE;
4714    break;    break;
4715    
4716    default:    default:
# Line 4624  decrease_call_count(common); Line 4889  decrease_call_count(common);
4889  return cc + 1 + LINK_SIZE;  return cc + 1 + LINK_SIZE;
4890  }  }
4891    
4892  static SLJIT_INLINE uschar *get_iterator_parameters(compiler_common *common, uschar *cc, uschar *opcode, uschar *type, int *arg1, int *arg2, uschar **end)  static SLJIT_INLINE pcre_uchar *get_iterator_parameters(compiler_common *common, pcre_uchar *cc, pcre_uchar *opcode, pcre_uchar *type, int *arg1, int *arg2, pcre_uchar **end)
4893  {  {
4894  int class_len;  int class_len;
4895    
# Line 4663  else Line 4928  else
4928    SLJIT_ASSERT(*opcode >= OP_CLASS || *opcode <= OP_XCLASS);    SLJIT_ASSERT(*opcode >= OP_CLASS || *opcode <= OP_XCLASS);
4929    *type = *opcode;    *type = *opcode;
4930    cc++;    cc++;
4931    class_len = (*type < OP_XCLASS) ? 33 : GET(cc, 0);    class_len = (*type < OP_XCLASS) ? (1 + (32 / sizeof(pcre_uchar))) : GET(cc, 0);
4932    *opcode = cc[class_len - 1];    *opcode = cc[class_len - 1];
4933    if (*opcode >= OP_CRSTAR && *opcode <= OP_CRMINQUERY)    if (*opcode >= OP_CRSTAR && *opcode <= OP_CRMINQUERY)
4934      {      {
# Line 4674  else Line 4939  else
4939    else    else
4940      {      {
4941      SLJIT_ASSERT(*opcode == OP_CRRANGE || *opcode == OP_CRMINRANGE);      SLJIT_ASSERT(*opcode == OP_CRRANGE || *opcode == OP_CRMINRANGE);
4942      *arg1 = GET2(cc, (class_len + 2));      *arg1 = GET2(cc, (class_len + IMM2_SIZE));
4943      *arg2 = GET2(cc, class_len);      *arg2 = GET2(cc, class_len);
4944    
4945      if (*arg2 == 0)      if (*arg2 == 0)
# Line 4686  else Line 4951  else
4951        *opcode = OP_EXACT;        *opcode = OP_EXACT;
4952    
4953      if (end != NULL)      if (end != NULL)
4954        *end = cc + class_len + 4;        *end = cc + class_len + 2 * IMM2_SIZE;
4955      }      }
4956    return cc;    return cc;
4957    }    }
# Line 4694  else Line 4959  else
4959  if (*opcode == OP_UPTO || *opcode == OP_MINUPTO || *opcode == OP_EXACT || *opcode == OP_POSUPTO)  if (*opcode == OP_UPTO || *opcode == OP_MINUPTO || *opcode == OP_EXACT || *opcode == OP_POSUPTO)
4960    {    {
4961    *arg1 = GET2(cc, 0);    *arg1 = GET2(cc, 0);
4962    cc += 2;    cc += IMM2_SIZE;
4963    }    }
4964    
4965  if (*type == 0)  if (*type == 0)
# Line 4709  if (*type == 0) Line 4974  if (*type == 0)
4974  if (end != NULL)  if (end != NULL)
4975    {    {
4976    *end = cc + 1;    *end = cc + 1;
4977  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
4978    if (common->utf8 && *cc >= 0xc0) *end += _pcre_utf8_table4[*cc & 0x3f];    if (common->utf && HAS_EXTRALEN(*cc)) *end += GET_EXTRALEN(*cc);
4979  #endif  #endif
4980    }    }
4981  return cc;  return cc;
4982  }  }
4983    
4984  static uschar *compile_iterator_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static pcre_uchar *compile_iterator_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
4985  {  {
4986  DEFINE_COMPILER;  DEFINE_COMPILER;
4987  fallback_common *fallback;  fallback_common *fallback;
4988  uschar opcode;  pcre_uchar opcode;
4989  uschar type;  pcre_uchar type;
4990  int arg1 = -1, arg2 = -1;  int arg1 = -1, arg2 = -1;
4991  uschar* end;  pcre_uchar* end;
4992  jump_list *nomatch = NULL;  jump_list *nomatch = NULL;
4993  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
4994  struct sljit_label *label;  struct sljit_label *label;
# Line 4885  decrease_call_count(common); Line 5150  decrease_call_count(common);
5150  return end;  return end;
5151  }  }
5152    
5153  static SLJIT_INLINE uschar *compile_fail_accept_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static SLJIT_INLINE pcre_uchar *compile_fail_accept_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
5154  {  {
5155  DEFINE_COMPILER;  DEFINE_COMPILER;
5156  fallback_common *fallback;  fallback_common *fallback;
# Line 4929  add_jump(compiler, &fallback->topfallbac Line 5194  add_jump(compiler, &fallback->topfallbac
5194  return cc + 1;  return cc + 1;
5195  }  }
5196    
5197  static SLJIT_INLINE uschar *compile_close_hotpath(compiler_common *common, uschar *cc)  static SLJIT_INLINE pcre_uchar *compile_close_hotpath(compiler_common *common, pcre_uchar *cc)
5198  {  {
5199  DEFINE_COMPILER;  DEFINE_COMPILER;
5200  int offset = GET2(cc, 1);  int offset = GET2(cc, 1);
5201    
5202  /* Data will be discarded anyway... */  /* Data will be discarded anyway... */
5203  if (common->currententry != NULL)  if (common->currententry != NULL)
5204    return cc + 3;    return cc + 1 + IMM2_SIZE;
5205    
5206  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR_PRIV(offset));  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR_PRIV(offset));
5207  offset <<= 1;  offset <<= 1;
5208  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);
5209  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);
5210  return cc + 3;  return cc + 1 + IMM2_SIZE;
5211  }  }
5212    
5213  static void compile_hotpath(compiler_common *common, uschar *cc, uschar *ccend, fallback_common *parent)  static void compile_hotpath(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, fallback_common *parent)
5214  {  {
5215  DEFINE_COMPILER;  DEFINE_COMPILER;
5216  fallback_common *fallback;  fallback_common *fallback;
# Line 5071  while (cc < ccend) Line 5336  while (cc < ccend)
5336    
5337      case OP_CLASS:      case OP_CLASS:
5338      case OP_NCLASS:      case OP_NCLASS:
5339      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)
5340        cc = compile_iterator_hotpath(common, cc, parent);        cc = compile_iterator_hotpath(common, cc, parent);
5341      else      else
5342        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);
5343      break;      break;
5344    
5345  #ifdef SUPPORT_UTF8  #if defined SUPPORT_UTF || defined COMPILE_PCRE16
5346      case OP_XCLASS:      case OP_XCLASS:
5347      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)
5348        cc = compile_iterator_hotpath(common, cc, parent);        cc = compile_iterator_hotpath(common, cc, parent);
# Line 5088  while (cc < ccend) Line 5353  while (cc < ccend)
5353    
5354      case OP_REF:      case OP_REF:
5355      case OP_REFI:      case OP_REFI:
5356      if (cc[3] >= OP_CRSTAR && cc[3] <= OP_CRMINRANGE)      if (cc[1 + IMM2_SIZE] >= OP_CRSTAR && cc[1 + IMM2_SIZE] <= OP_CRMINRANGE)
5357        cc = compile_ref_iterator_hotpath(common, cc, parent);        cc = compile_ref_iterator_hotpath(common, cc, parent);
5358      else      else
5359        cc = compile_ref_hotpath(common, cc, parent->top != NULL ? &parent->top->nextfallbacks : &parent->topfallbacks, TRUE, FALSE);        cc = compile_ref_hotpath(common, cc, parent->top != NULL ? &parent->top->nextfallbacks : &parent->topfallbacks, TRUE, FALSE);
# Line 5196  SLJIT_ASSERT(cc == ccend); Line 5461  SLJIT_ASSERT(cc == ccend);
5461  static void compile_iterator_fallbackpath(compiler_common *common, struct fallback_common *current)  static void compile_iterator_fallbackpath(compiler_common *common, struct fallback_common *current)
5462  {  {
5463  DEFINE_COMPILER;  DEFINE_COMPILER;
5464  uschar *cc = current->cc;  pcre_uchar *cc = current->cc;
5465  uschar opcode;  pcre_uchar opcode;
5466  uschar type;  pcre_uchar type;
5467  int arg1 = -1, arg2 = -1;  int arg1 = -1, arg2 = -1;
5468  struct sljit_label *label = NULL;  struct sljit_label *label = NULL;
5469  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
# Line 5323  switch(opcode) Line 5588  switch(opcode)
5588  static void compile_ref_iterator_fallbackpath(compiler_common *common, struct fallback_common *current)  static void compile_ref_iterator_fallbackpath(compiler_common *common, struct fallback_common *current)
5589  {  {
5590  DEFINE_COMPILER;  DEFINE_COMPILER;
5591  uschar *cc = current->cc;  pcre_uchar *cc = current->cc;
5592  uschar type;  pcre_uchar type;
5593    
5594  type = cc[3];  type = cc[1 + IMM2_SIZE];
5595  if ((type & 0x1) == 0)  if ((type & 0x1) == 0)
5596    {    {
5597    set_jumps(current->topfallbacks, LABEL());    set_jumps(current->topfallbacks, LABEL());
# Line 5355  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_R Line 5620  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_R
5620  static void compile_assert_fallbackpath(compiler_common *common, struct fallback_common *current)  static void compile_assert_fallbackpath(compiler_common *common, struct fallback_common *current)
5621  {  {
5622  DEFINE_COMPILER;  DEFINE_COMPILER;
5623  uschar *cc = current->cc;  pcre_uchar *cc = current->cc;
5624  uschar bra = OP_BRA;  pcre_uchar bra = OP_BRA;
5625  struct sljit_jump *brajump = NULL;  struct sljit_jump *brajump = NULL;
5626    
5627  SLJIT_ASSERT(*cc != OP_BRAMINZERO);  SLJIT_ASSERT(*cc != OP_BRAMINZERO);
# Line 5427  int offset = 0; Line 5692  int offset = 0;
5692  int localptr = CURRENT_AS(bracket_fallback)->localptr;  int localptr = CURRENT_AS(bracket_fallback)->localptr;
5693  int stacksize;  int stacksize;
5694  int count;  int count;
5695  uschar *cc = current->cc;  pcre_uchar *cc = current->cc;
5696  uschar *ccbegin;  pcre_uchar *ccbegin;
5697  uschar *ccprev;  pcre_uchar *ccprev;
5698  jump_list *jumplist = NULL;  jump_list *jumplist = NULL;
5699  jump_list *jumplistitem = NULL;  jump_list *jumplistitem = NULL;
5700  uschar bra = OP_BRA;  pcre_uchar bra = OP_BRA;
5701  uschar ket;  pcre_uchar ket;
5702  assert_fallback *assert;  assert_fallback *assert;
5703  BOOL has_alternatives;  BOOL has_alternatives;
5704  struct sljit_jump *brazero = NULL;  struct sljit_jump *brazero = NULL;
# Line 5698  if (has_alternatives) Line 5963  if (has_alternatives)
5963      {      {
5964      SLJIT_ASSERT(opcode == OP_COND || opcode == OP_SCOND);      SLJIT_ASSERT(opcode == OP_COND || opcode == OP_SCOND);
5965      assert = CURRENT_AS(bracket_fallback)->u.assert;      assert = CURRENT_AS(bracket_fallback)->u.assert;
5966      if (assert->framesize >= 0 && (ccbegin[1 + LINK_SIZE] == OP_ASSERT_NOT || ccbegin[1 + LINK_SIZE] == OP_ASSERTBACK_NOT))      if ((ccbegin[1 + LINK_SIZE] == OP_ASSERT_NOT || ccbegin[1 + LINK_SIZE] == OP_ASSERTBACK_NOT) && assert->framesize >= 0)
5967    
5968        {        {
5969        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), assert->localptr);        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), assert->localptr);
5970        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
# Line 5932  while (current) Line 6198  while (current)
6198      case OP_TYPEPOSUPTO:      case OP_TYPEPOSUPTO:
6199      case OP_CLASS:      case OP_CLASS:
6200      case OP_NCLASS:      case OP_NCLASS:
6201    #if defined SUPPORT_UTF || !defined COMPILE_PCRE8
6202      case OP_XCLASS:      case OP_XCLASS:
6203    #endif
6204      compile_iterator_fallbackpath(common, current);      compile_iterator_fallbackpath(common, current);
6205      break;      break;
6206    
# Line 5999  while (current) Line 6267  while (current)
6267  static SLJIT_INLINE void compile_recurse(compiler_common *common)  static SLJIT_INLINE void compile_recurse(compiler_common *common)
6268  {  {
6269  DEFINE_COMPILER;  DEFINE_COMPILER;
6270  uschar *cc = common->start + common->currententry->start;  pcre_uchar *cc = common->start + common->currententry->start;
6271  uschar *ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : 2);  pcre_uchar *ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : IMM2_SIZE);
6272  uschar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
6273  int localsize = get_localsize(common, ccbegin, ccend);  int localsize = get_localsize(common, ccbegin, ccend);
6274  int framesize = get_framesize(common, cc, TRUE);  int framesize = get_framesize(common, cc, TRUE);
6275  int alternativesize;  int alternativesize;
# Line 6089  sljit_emit_fast_return(compiler, SLJIT_M Line 6357  sljit_emit_fast_return(compiler, SLJIT_M
6357  #undef CURRENT_AS  #undef CURRENT_AS
6358    
6359  void  void
6360  _pcre_jit_compile(const real_pcre *re, pcre_extra *extra)  PRIV(jit_compile)(const REAL_PCRE *re, PUBL(extra) *extra)
6361  {  {
6362  struct sljit_compiler *compiler;  struct sljit_compiler *compiler;
6363  fallback_common rootfallback;  fallback_common rootfallback;
6364  compiler_common common_data;  compiler_common common_data;
6365  compiler_common *common = &common_data;  compiler_common *common = &common_data;
6366  const uschar *tables = re->tables;  const pcre_uint8 *tables = re->tables;
6367  pcre_study_data *study;  pcre_study_data *study;
6368  uschar *ccend;  pcre_uchar *ccend;
6369  executable_function *function;  executable_function *function;
6370  void *executable_func;  void *executable_func;
6371  sljit_uw executable_size;  sljit_uw executable_size;
# Line 6113  SLJIT_ASSERT((extra->flags & PCRE_EXTRA_ Line 6381  SLJIT_ASSERT((extra->flags & PCRE_EXTRA_
6381  study = extra->study_data;  study = extra->study_data;
6382    
6383  if (!tables)  if (!tables)
6384    tables = _pcre_default_tables;    tables = PRIV(default_tables);
6385    
6386  memset(&rootfallback, 0, sizeof(fallback_common));  memset(&rootfallback, 0, sizeof(fallback_common));
6387  rootfallback.cc = (uschar *)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;
6388    
6389  common->compiler = NULL;  common->compiler = NULL;
6390  common->start = rootfallback.cc;  common->start = rootfallback.cc;
# Line 6157  else Line 6425  else
6425    }    }
6426  common->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;  common->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
6427  common->ctypes = (sljit_w)(tables + ctypes_offset);  common->ctypes = (sljit_w)(tables + ctypes_offset);
6428  common->name_table = (sljit_w)re + re->name_table_offset;  common->name_table = (sljit_w)((pcre_uchar *)re + re->name_table_offset);
6429  common->name_count = re->name_count;  common->name_count = re->name_count;
6430  common->name_entry_size = re->name_entry_size;  common->name_entry_size = re->name_entry_size;
6431  common->acceptlabel = NULL;  common->acceptlabel = NULL;
# Line 6175  common->vspace = NULL; Line 6443  common->vspace = NULL;
6443  common->casefulcmp = NULL;  common->casefulcmp = NULL;
6444  common->caselesscmp = NULL;  common->caselesscmp = NULL;
6445  common->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;  common->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;
6446  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
6447  common->utf8 = (re->options & PCRE_UTF8) != 0;  /* PCRE_UTF16 has the same value as PCRE_UTF8. */
6448    common->utf = (re->options & PCRE_UTF8) != 0;
6449  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
6450  common->useucp = (re->options & PCRE_UCP) != 0;  common->use_ucp = (re->options & PCRE_UCP) != 0;
6451  #endif  #endif
6452  common->utf8readchar = NULL;  common->utfreadchar = NULL;
6453  common->utf8readtype8 = NULL;  #ifdef COMPILE_PCRE8
6454    common->utfreadtype8 = NULL;
6455  #endif  #endif
6456    #endif /* SUPPORT_UTF */
6457  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
6458  common->getucd = NULL;  common->getucd = NULL;
6459  #endif  #endif
# Line 6214  sljit_emit_enter(compiler, 1, 5, 5, comm Line 6485  sljit_emit_enter(compiler, 1, 5, 5, comm
6485  /* Register init. */  /* Register init. */
6486  reset_ovector(common, (re->top_bracket + 1) * 2);  reset_ovector(common, (re->top_bracket + 1) * 2);
6487  if ((re->flags & PCRE_REQCHSET) != 0)  if ((re->flags & PCRE_REQCHSET) != 0)
6488    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), REQ_BYTE_PTR, SLJIT_TEMPORARY_REG1, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), REQ_CHAR_PTR, SLJIT_TEMPORARY_REG1, 0);
6489    
6490  OP1(SLJIT_MOV, ARGUMENTS, 0, SLJIT_GENERAL_REG1, 0);  OP1(SLJIT_MOV, ARGUMENTS, 0, SLJIT_SAVED_REG1, 0);
6491  OP1(SLJIT_MOV, TMP1, 0, SLJIT_GENERAL_REG1, 0);  OP1(SLJIT_MOV, TMP1, 0, SLJIT_SAVED_REG1, 0);
6492  OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));  OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
6493  OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, end));  OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, end));
6494  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
# Line 6232  if ((re->options & PCRE_ANCHORED) == 0) Line 6503  if ((re->options & PCRE_ANCHORED) == 0)
6503    mainloop = mainloop_entry(common, (re->flags & PCRE_HASCRORLF) != 0, (re->options & PCRE_FIRSTLINE) != 0);    mainloop = mainloop_entry(common, (re->flags & PCRE_HASCRORLF) != 0, (re->options & PCRE_FIRSTLINE) != 0);
6504    /* Forward search if possible. */    /* Forward search if possible. */
6505    if ((re->flags & PCRE_FIRSTSET) != 0)    if ((re->flags & PCRE_FIRSTSET) != 0)
6506      fast_forward_first_byte(common, re->first_byte, (re->options & PCRE_FIRSTLINE) != 0);      fast_forward_first_char(common, re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);
6507    else if ((re->flags & PCRE_STARTLINE) != 0)    else if ((re->flags & PCRE_STARTLINE) != 0)
6508      fast_forward_newline(common, (re->options & PCRE_FIRSTLINE) != 0);      fast_forward_newline(common, (re->options & PCRE_FIRSTLINE) != 0);
6509    else if ((re->flags & PCRE_STARTLINE) == 0 && study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)    else if ((re->flags & PCRE_STARTLINE) == 0 && study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)
6510      fast_forward_start_bits(common, (sljit_uw)study->start_bits, (re->options & PCRE_FIRSTLINE) != 0);      fast_forward_start_bits(common, (sljit_uw)study->start_bits, (re->options & PCRE_FIRSTLINE) != 0);
6511    }    }
6512  if ((re->flags & PCRE_REQCHSET) != 0)  if ((re->flags & PCRE_REQCHSET) != 0)
6513    reqbyte_notfound = search_requested_char(common, re->req_byte, (re->flags & PCRE_FIRSTSET) != 0);    reqbyte_notfound = search_requested_char(common, re->req_char, (re->flags & PCRE_RCH_CASELESS) != 0, (re->flags & PCRE_FIRSTSET) != 0);
6514    
6515  /* Store the current STR_PTR in OVECTOR(0). */  /* Store the current STR_PTR in OVECTOR(0). */
6516  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);
# Line 6264  if (common->accept != NULL) Line 6535  if (common->accept != NULL)
6535  /* This means we have a match. Update the ovector. */  /* This means we have a match. Update the ovector. */
6536  copy_ovector(common, re->top_bracket + 1);  copy_ovector(common, re->top_bracket + 1);
6537  leave = LABEL();  leave = LABEL();
6538  sljit_emit_return(compiler, SLJIT_UNUSED, 0);  sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
6539    
6540  empty_match_fallback = LABEL();  empty_match_fallback = LABEL();
6541  compile_fallbackpath(common, rootfallback.top);  compile_fallbackpath(common, rootfallback.top);
# Line 6286  if ((re->options & PCRE_ANCHORED) == 0) Line 6557  if ((re->options & PCRE_ANCHORED) == 0)
6557      {      {
6558      if (study != NULL && study->minlength > 1)      if (study != NULL && study->minlength > 1)
6559        {        {
6560        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));
6561        CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, STR_END, 0, mainloop);        CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, STR_END, 0, mainloop);
6562        }        }
6563      else      else
# Line 6296  if ((re->options & PCRE_ANCHORED) == 0) Line 6567  if ((re->options & PCRE_ANCHORED) == 0)
6567      {      {
6568      if (study != NULL && study->minlength > 1)      if (study != NULL && study->minlength > 1)
6569        {        {
6570        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));
6571        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);
6572        COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_GREATER);        COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_GREATER);
6573        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 6408  if (common->caselesscmp != NULL) Line 6679  if (common->caselesscmp != NULL)
6679    set_jumps(common->caselesscmp, LABEL());    set_jumps(common->caselesscmp, LABEL());
6680    do_caselesscmp(common);    do_caselesscmp(common);
6681    }    }
6682  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF
6683  if (common->utf8readchar != NULL)  if (common->utfreadchar != NULL)
6684    {    {
6685    set_jumps(common->utf8readchar, LABEL());    set_jumps(common->utfreadchar, LABEL());
6686    do_utf8readchar(common);    do_utfreadchar(common);
6687    }    }
6688  if (common->utf8readtype8 != NULL)  #ifdef COMPILE_PCRE8
6689    if (common->utfreadtype8 != NULL)
6690    {    {
6691    set_jumps(common->utf8readtype8, LABEL());    set_jumps(common->utfreadtype8, LABEL());
6692    do_utf8readtype8(common);    do_utfreadtype8(common);
6693    }    }
6694  #endif  #endif
6695    #endif /* COMPILE_PCRE8 */
6696  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
6697  if (common->getucd != NULL)  if (common->getucd != NULL)
6698    {    {
# Line 6458  union { Line 6731  union {
6731     void* executable_func;     void* executable_func;
6732     jit_function call_executable_func;     jit_function call_executable_func;
6733  } convert_executable_func;  } convert_executable_func;
6734  uschar local_area[LOCAL_SPACE_SIZE];  pcre_uint8 local_area[LOCAL_SPACE_SIZE];
6735  struct sljit_stack local_stack;  struct sljit_stack local_stack;
6736    
6737  local_stack.top = (sljit_w)&local_area;  local_stack.top = (sljit_w)&local_area;
# Line 6471  return convert_executable_func.call_exec Line 6744  return convert_executable_func.call_exec
6744  }  }
6745    
6746  int  int
6747  _pcre_jit_exec(const real_pcre *re, void *executable_func,  PRIV(jit_exec)(const REAL_PCRE *re, void *executable_func,
6748    PCRE_SPTR subject, int length, int start_offset, int options,    const pcre_uchar *subject, int length, int start_offset, int options,
6749    int match_limit, int *offsets, int offsetcount)    int match_limit, int *offsets, int offsetcount)
6750  {  {
6751  executable_function *function = (executable_function*)executable_func;  executable_function *function = (executable_function*)executable_func;
# Line 6502  workspace. We don't need the workspace h Line 6775  workspace. We don't need the workspace h
6775  number of captured strings in the same way as pcre_exec(), so that the user  number of captured strings in the same way as pcre_exec(), so that the user
6776  gets the same result with and without JIT. */  gets the same result with and without JIT. */
6777    
6778  offsetcount = ((offsetcount - (offsetcount % 3)) * 2)/3;  if (offsetcount != 2)
6779      offsetcount = ((offsetcount - (offsetcount % 3)) * 2) / 3;
6780  maxoffsetcount = (re->top_bracket + 1) * 2;  maxoffsetcount = (re->top_bracket + 1) * 2;
6781  if (offsetcount > maxoffsetcount)  if (offsetcount > maxoffsetcount)
6782    offsetcount = maxoffsetcount;    offsetcount = maxoffsetcount;
# Line 6527  return retval; Line 6801  return retval;
6801  }  }
6802    
6803  void  void
6804  _pcre_jit_free(void *executable_func)  PRIV(jit_free)(void *executable_func)
6805  {  {
6806  executable_function *function = (executable_function*)executable_func;  executable_function *function = (executable_function*)executable_func;
6807  sljit_free_code(function->executable_func);  sljit_free_code(function->executable_func);
# Line 6535  SLJIT_FREE(function); Line 6809  SLJIT_FREE(function);
6809  }  }
6810    
6811  int  int
6812  _pcre_jit_get_size(void *executable_func)  PRIV(jit_get_size)(void *executable_func)
6813  {  {
6814  return ((executable_function*)executable_func)->executable_size;  return ((executable_function*)executable_func)->executable_size;
6815  }  }
6816    
6817    #ifdef COMPILE_PCRE8
6818  PCRE_EXP_DECL pcre_jit_stack *  PCRE_EXP_DECL pcre_jit_stack *
6819  pcre_jit_stack_alloc(int startsize, int maxsize)  pcre_jit_stack_alloc(int startsize, int maxsize)
6820    #else
6821    PCRE_EXP_DECL pcre16_jit_stack *
6822    pcre16_jit_stack_alloc(int startsize, int maxsize)
6823    #endif
6824  {  {
6825  if (startsize < 1 || maxsize < 1)  if (startsize < 1 || maxsize < 1)
6826    return NULL;    return NULL;
# Line 6549  if (startsize > maxsize) Line 6828  if (startsize > maxsize)
6828    startsize = maxsize;    startsize = maxsize;
6829  startsize = (startsize + STACK_GROWTH_RATE - 1) & ~(STACK_GROWTH_RATE - 1);  startsize = (startsize + STACK_GROWTH_RATE - 1) & ~(STACK_GROWTH_RATE - 1);
6830  maxsize = (maxsize + STACK_GROWTH_RATE - 1) & ~(STACK_GROWTH_RATE - 1);  maxsize = (maxsize + STACK_GROWTH_RATE - 1) & ~(STACK_GROWTH_RATE - 1);
6831  return (pcre_jit_stack*)sljit_allocate_stack(startsize, maxsize);  return (PUBL(jit_stack)*)sljit_allocate_stack(startsize, maxsize);
6832  }  }
6833    
6834    #ifdef COMPILE_PCRE8
6835  PCRE_EXP_DECL void  PCRE_EXP_DECL void
6836  pcre_jit_stack_free(pcre_jit_stack *stack)  pcre_jit_stack_free(pcre_jit_stack *stack)
6837    #else
6838    PCRE_EXP_DECL void
6839    pcre16_jit_stack_free(pcre16_jit_stack *stack)
6840    #endif
6841  {  {
6842  sljit_free_stack((struct sljit_stack*)stack);  sljit_free_stack((struct sljit_stack*)stack);
6843  }  }
6844    
6845    #ifdef COMPILE_PCRE8
6846  PCRE_EXP_DECL void  PCRE_EXP_DECL void
6847  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)
6848    #else
6849    PCRE_EXP_DECL void
6850    pcre16_assign_jit_stack(pcre16_extra *extra, pcre16_jit_callback callback, void *userdata)
6851    #endif
6852  {  {
6853  executable_function *function;  executable_function *function;
6854  if (extra != NULL &&  if (extra != NULL &&
# Line 6577  if (extra != NULL && Line 6866  if (extra != NULL &&
6866  /* 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
6867  being compiled. */  being compiled. */
6868    
6869    #ifdef COMPILE_PCRE8
6870  PCRE_EXP_DECL pcre_jit_stack *  PCRE_EXP_DECL pcre_jit_stack *
6871  pcre_jit_stack_alloc(int startsize, int maxsize)  pcre_jit_stack_alloc(int startsize, int maxsize)
6872    #else
6873    PCRE_EXP_DECL pcre16_jit_stack *
6874    pcre16_jit_stack_alloc(int startsize, int maxsize)
6875    #endif
6876  {  {
6877  (void)startsize;  (void)startsize;
6878  (void)maxsize;  (void)maxsize;
6879  return NULL;  return NULL;
6880  }  }
6881    
6882    #ifdef COMPILE_PCRE8
6883  PCRE_EXP_DECL void  PCRE_EXP_DECL void
6884  pcre_jit_stack_free(pcre_jit_stack *stack)  pcre_jit_stack_free(pcre_jit_stack *stack)
6885    #else
6886    PCRE_EXP_DECL void
6887    pcre16_jit_stack_free(pcre16_jit_stack *stack)
6888    #endif
6889  {  {
6890  (void)stack;  (void)stack;
6891  }  }
6892    
6893    #ifdef COMPILE_PCRE8
6894  PCRE_EXP_DECL void  PCRE_EXP_DECL void
6895  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)
6896    #else
6897    PCRE_EXP_DECL void
6898    pcre16_assign_jit_stack(pcre16_extra *extra, pcre16_jit_callback callback, void *userdata)
6899    #endif
6900  {  {
6901  (void)extra;  (void)extra;
6902  (void)callback;  (void)callback;

Legend:
Removed from v.788  
changed lines
  Added in v.883

  ViewVC Help
Powered by ViewVC 1.1.5