/[pcre]/code/tags/pcre-8.37/pcre_jit_compile.c
ViewVC logotype

Diff of /code/tags/pcre-8.37/pcre_jit_compile.c

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

revision 999 by zherczeg, Mon Aug 6 07:36:49 2012 UTC revision 1176 by ph10, Sat Oct 27 15:46:35 2012 UTC
# Line 46  POSSIBILITY OF SUCH DAMAGE. Line 46  POSSIBILITY OF SUCH DAMAGE.
46    
47  #include "pcre_internal.h"  #include "pcre_internal.h"
48    
49  #ifdef SUPPORT_JIT  #if defined SUPPORT_JIT
50    
51  /* All-in-one: Since we use the JIT compiler only from here,  /* All-in-one: Since we use the JIT compiler only from here,
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
# Line 65  system files. */ Line 65  system files. */
65  #error Unsupported architecture  #error Unsupported architecture
66  #endif  #endif
67    
68  /* Allocate memory on the stack. Fast, but limited size. */  /* Allocate memory for the regex stack on the real machine stack.
69  #define LOCAL_SPACE_SIZE 32768  Fast, but limited size. */
70    #define MACHINE_STACK_SIZE 32768
71    
72    /* Growth rate for stack allocated by the OS. Should be the multiply
73    of page size. */
74  #define STACK_GROWTH_RATE 8192  #define STACK_GROWTH_RATE 8192
75    
76  /* Enable to check that the allocation could destroy temporaries. */  /* Enable to check that the allocation could destroy temporaries. */
# Line 134  The generated code will be the following Line 137  The generated code will be the following
137  /*  /*
138  Saved stack frames:  Saved stack frames:
139    
140  Atomic blocks and asserts require reloading the values of local variables  Atomic blocks and asserts require reloading the values of private data
141  when the backtrack mechanism performed. Because of OP_RECURSE, the locals  when the backtrack mechanism performed. Because of OP_RECURSE, the data
142  are not necessarly known in compile time, thus we need a dynamic restore  are not necessarly known in compile time, thus we need a dynamic restore
143  mechanism.  mechanism.
144    
145  The stack frames are stored in a chain list, and have the following format:  The stack frames are stored in a chain list, and have the following format:
146  ([ capturing bracket offset ][ start value ][ end value ])+ ... [ 0 ] [ previous head ]  ([ capturing bracket offset ][ start value ][ end value ])+ ... [ 0 ] [ previous head ]
147    
148  Thus we can restore the locals to a particular point in the stack.  Thus we can restore the private data to a particular point in the stack.
149  */  */
150    
151  typedef struct jit_arguments {  typedef struct jit_arguments {
# Line 208  typedef struct assert_backtrack { Line 211  typedef struct assert_backtrack {
211    /* Less than 0 (-1) if a frame is not needed. */    /* Less than 0 (-1) if a frame is not needed. */
212    int framesize;    int framesize;
213    /* Points to our private memory word on the stack. */    /* Points to our private memory word on the stack. */
214    int localptr;    int private_data_ptr;
215    /* For iterators. */    /* For iterators. */
216    struct sljit_label *matchingpath;    struct sljit_label *matchingpath;
217  } assert_backtrack;  } assert_backtrack;
# Line 230  typedef struct bracket_backtrack { Line 233  typedef struct bracket_backtrack {
233      int framesize;      int framesize;
234    } u;    } u;
235    /* Points to our private memory word on the stack. */    /* Points to our private memory word on the stack. */
236    int localptr;    int private_data_ptr;
237  } bracket_backtrack;  } bracket_backtrack;
238    
239  typedef struct bracketpos_backtrack {  typedef struct bracketpos_backtrack {
240    backtrack_common common;    backtrack_common common;
241    /* Points to our private memory word on the stack. */    /* Points to our private memory word on the stack. */
242    int localptr;    int private_data_ptr;
243    /* Reverting stack is needed. */    /* Reverting stack is needed. */
244    int framesize;    int framesize;
245    /* Allocated stack size. */    /* Allocated stack size. */
# Line 274  typedef struct compiler_common { Line 277  typedef struct compiler_common {
277    struct sljit_compiler *compiler;    struct sljit_compiler *compiler;
278    pcre_uchar *start;    pcre_uchar *start;
279    
280    /* Opcode local area direct map. */    /* Maps private data offset to each opcode. */
281    int *localptrs;    int *private_data_ptrs;
282      /* Tells whether the capturing bracket is optimized. */
283      pcre_uint8 *optimized_cbracket;
284      /* Starting offset of private data for capturing brackets. */
285    int cbraptr;    int cbraptr;
286    /* OVector starting point. Must be divisible by 2. */    /* OVector starting point. Must be divisible by 2. */
287    int ovector_start;    int ovector_start;
# Line 337  typedef struct compiler_common { Line 343  typedef struct compiler_common {
343  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
344    BOOL use_ucp;    BOOL use_ucp;
345  #endif  #endif
346    #ifndef COMPILE_PCRE32
347    jump_list *utfreadchar;    jump_list *utfreadchar;
348    #endif
349  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
350    jump_list *utfreadtype8;    jump_list *utfreadtype8;
351  #endif  #endif
# Line 357  typedef struct compare_context { Line 365  typedef struct compare_context {
365    union {    union {
366      sljit_i asint;      sljit_i asint;
367      sljit_uh asushort;      sljit_uh asushort;
368  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
369      sljit_ub asbyte;      sljit_ub asbyte;
370      sljit_ub asuchars[4];      sljit_ub asuchars[4];
371  #else  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
372      sljit_uh asuchars[2];      sljit_uh asuchars[2];
373  #endif  #elif defined COMPILE_PCRE32
374        sljit_ui asuchars[1];
375  #endif  #endif
376    } c;    } c;
377    union {    union {
378      sljit_i asint;      sljit_i asint;
379      sljit_uh asushort;      sljit_uh asushort;
380  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
381      sljit_ub asbyte;      sljit_ub asbyte;
382      sljit_ub asuchars[4];      sljit_ub asuchars[4];
383  #else  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
384      sljit_uh asuchars[2];      sljit_uh asuchars[2];
385  #endif  #elif defined COMPILE_PCRE32
386        sljit_ui asuchars[1];
387  #endif  #endif
388    } oc;    } oc;
389  #endif  #endif
# Line 404  enum { Line 412  enum {
412  #define CALL_COUNT    SLJIT_SAVED_EREG2  #define CALL_COUNT    SLJIT_SAVED_EREG2
413  #define RETURN_ADDR   SLJIT_TEMPORARY_EREG1  #define RETURN_ADDR   SLJIT_TEMPORARY_EREG1
414    
415  /* Locals layout. */  /* Local space layout. */
416  /* These two locals can be used by the current opcode. */  /* These two locals can be used by the current opcode. */
417  #define LOCALS0          (0 * sizeof(sljit_w))  #define LOCALS0          (0 * sizeof(sljit_w))
418  #define LOCALS1          (1 * sizeof(sljit_w))  #define LOCALS1          (1 * sizeof(sljit_w))
# Line 420  the start pointers when the end of the c Line 428  the start pointers when the end of the c
428  #define OVECTOR_START    (common->ovector_start)  #define OVECTOR_START    (common->ovector_start)
429  #define OVECTOR(i)       (OVECTOR_START + (i) * sizeof(sljit_w))  #define OVECTOR(i)       (OVECTOR_START + (i) * sizeof(sljit_w))
430  #define OVECTOR_PRIV(i)  (common->cbraptr + (i) * sizeof(sljit_w))  #define OVECTOR_PRIV(i)  (common->cbraptr + (i) * sizeof(sljit_w))
431  #define PRIV_DATA(cc)    (common->localptrs[(cc) - common->start])  #define PRIVATE_DATA(cc) (common->private_data_ptrs[(cc) - common->start])
432    
433  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
434  #define MOV_UCHAR  SLJIT_MOV_UB  #define MOV_UCHAR  SLJIT_MOV_UB
435  #define MOVU_UCHAR SLJIT_MOVU_UB  #define MOVU_UCHAR SLJIT_MOVU_UB
436  #else  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
437  #define MOV_UCHAR  SLJIT_MOV_UH  #define MOV_UCHAR  SLJIT_MOV_UH
438  #define MOVU_UCHAR SLJIT_MOVU_UH  #define MOVU_UCHAR SLJIT_MOVU_UH
439    #elif defined COMPILE_PCRE32
440    #define MOV_UCHAR  SLJIT_MOV_UI
441    #define MOVU_UCHAR SLJIT_MOVU_UI
442  #else  #else
443  #error Unsupported compiling mode  #error Unsupported compiling mode
444  #endif  #endif
 #endif  
445    
446  /* Shortcuts. */  /* Shortcuts. */
447  #define DEFINE_COMPILER \  #define DEFINE_COMPILER \
# Line 469  return cc; Line 478  return cc;
478    
479  /* Functions whose might need modification for all new supported opcodes:  /* Functions whose might need modification for all new supported opcodes:
480   next_opcode   next_opcode
481   get_localspace   get_private_data_length
482   set_localptrs   set_private_data_ptrs
483   get_framesize   get_framesize
484   init_frame   init_frame
485   get_localsize   get_private_data_length_for_copy
486   copy_locals   copy_private_data
487   compile_matchingpath   compile_matchingpath
488   compile_backtrackingpath   compile_backtrackingpath
489  */  */
# Line 675  switch(*cc) Line 684  switch(*cc)
684    }    }
685  }  }
686    
687  #define CASE_ITERATOR_LOCAL1 \  #define CASE_ITERATOR_PRIVATE_DATA_1 \
688      case OP_MINSTAR: \      case OP_MINSTAR: \
689      case OP_MINPLUS: \      case OP_MINPLUS: \
690      case OP_QUERY: \      case OP_QUERY: \
# Line 693  switch(*cc) Line 702  switch(*cc)
702      case OP_NOTQUERYI: \      case OP_NOTQUERYI: \
703      case OP_NOTMINQUERYI:      case OP_NOTMINQUERYI:
704    
705  #define CASE_ITERATOR_LOCAL2A \  #define CASE_ITERATOR_PRIVATE_DATA_2A \
706      case OP_STAR: \      case OP_STAR: \
707      case OP_PLUS: \      case OP_PLUS: \
708      case OP_STARI: \      case OP_STARI: \
# Line 703  switch(*cc) Line 712  switch(*cc)
712      case OP_NOTSTARI: \      case OP_NOTSTARI: \
713      case OP_NOTPLUSI:      case OP_NOTPLUSI:
714    
715  #define CASE_ITERATOR_LOCAL2B \  #define CASE_ITERATOR_PRIVATE_DATA_2B \
716      case OP_UPTO: \      case OP_UPTO: \
717      case OP_MINUPTO: \      case OP_MINUPTO: \
718      case OP_UPTOI: \      case OP_UPTOI: \
# Line 713  switch(*cc) Line 722  switch(*cc)
722      case OP_NOTUPTOI: \      case OP_NOTUPTOI: \
723      case OP_NOTMINUPTOI:      case OP_NOTMINUPTOI:
724    
725  #define CASE_ITERATOR_TYPE_LOCAL1 \  #define CASE_ITERATOR_TYPE_PRIVATE_DATA_1 \
726      case OP_TYPEMINSTAR: \      case OP_TYPEMINSTAR: \
727      case OP_TYPEMINPLUS: \      case OP_TYPEMINPLUS: \
728      case OP_TYPEQUERY: \      case OP_TYPEQUERY: \
729      case OP_TYPEMINQUERY:      case OP_TYPEMINQUERY:
730    
731  #define CASE_ITERATOR_TYPE_LOCAL2A \  #define CASE_ITERATOR_TYPE_PRIVATE_DATA_2A \
732      case OP_TYPESTAR: \      case OP_TYPESTAR: \
733      case OP_TYPEPLUS:      case OP_TYPEPLUS:
734    
735  #define CASE_ITERATOR_TYPE_LOCAL2B \  #define CASE_ITERATOR_TYPE_PRIVATE_DATA_2B \
736      case OP_TYPEUPTO: \      case OP_TYPEUPTO: \
737      case OP_TYPEMINUPTO:      case OP_TYPEMINUPTO:
738    
# Line 752  switch(*cc) Line 761  switch(*cc)
761    }    }
762  }  }
763    
764  static int get_localspace(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)  static int get_private_data_length(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
765  {  {
766  int localspace = 0;  int private_data_length = 0;
767  pcre_uchar *alternative;  pcre_uchar *alternative;
768    pcre_uchar *name;
769  pcre_uchar *end = NULL;  pcre_uchar *end = NULL;
770  int space, size, bracketlen;  int space, size, i;
771    pcre_uint32 bracketlen;
772    
773  /* 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. */
774  while (cc < ccend)  while (cc < ccend)
# Line 772  while (cc < ccend) Line 783  while (cc < ccend)
783      cc += 1;      cc += 1;
784      break;      break;
785    
786        case OP_REF:
787        case OP_REFI:
788        common->optimized_cbracket[GET2(cc, 1)] = 0;
789        cc += 1 + IMM2_SIZE;
790        break;
791    
792      case OP_ASSERT:      case OP_ASSERT:
793      case OP_ASSERT_NOT:      case OP_ASSERT_NOT:
794      case OP_ASSERTBACK:      case OP_ASSERTBACK:
# Line 781  while (cc < ccend) Line 798  while (cc < ccend)
798      case OP_BRAPOS:      case OP_BRAPOS:
799      case OP_SBRA:      case OP_SBRA:
800      case OP_SBRAPOS:      case OP_SBRAPOS:
801      case OP_SCOND:      private_data_length += sizeof(sljit_w);
     localspace += sizeof(sljit_w);  
802      bracketlen = 1 + LINK_SIZE;      bracketlen = 1 + LINK_SIZE;
803      break;      break;
804    
805      case OP_CBRAPOS:      case OP_CBRAPOS:
806      case OP_SCBRAPOS:      case OP_SCBRAPOS:
807      localspace += sizeof(sljit_w);      private_data_length += sizeof(sljit_w);
808        common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] = 0;
809      bracketlen = 1 + LINK_SIZE + IMM2_SIZE;      bracketlen = 1 + LINK_SIZE + IMM2_SIZE;
810      break;      break;
811    
812      case OP_COND:      case OP_COND:
813      /* Might be a hidden SCOND. */      case OP_SCOND:
814      alternative = cc + GET(cc, 1);      bracketlen = cc[1 + LINK_SIZE];
815      if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)      if (bracketlen == OP_CREF)
816        localspace += sizeof(sljit_w);        {
817          bracketlen = GET2(cc, 1 + LINK_SIZE + 1);
818          common->optimized_cbracket[bracketlen] = 0;
819          }
820        else if (bracketlen == OP_NCREF)
821          {
822          bracketlen = GET2(cc, 1 + LINK_SIZE + 1);
823          name = (pcre_uchar *)common->name_table;
824          alternative = name;
825          for (i = 0; i < common->name_count; i++)
826            {
827            if (GET2(name, 0) == bracketlen) break;
828            name += common->name_entry_size;
829            }
830          SLJIT_ASSERT(i != common->name_count);
831    
832          for (i = 0; i < common->name_count; i++)
833            {
834            if (STRCMP_UC_UC(alternative + IMM2_SIZE, name + IMM2_SIZE) == 0)
835              common->optimized_cbracket[GET2(alternative, 0)] = 0;
836            alternative += common->name_entry_size;
837            }
838          }
839    
840        if (*cc == OP_COND)
841          {
842          /* Might be a hidden SCOND. */
843          alternative = cc + GET(cc, 1);
844          if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
845            private_data_length += sizeof(sljit_w);
846          }
847        else
848          private_data_length += sizeof(sljit_w);
849      bracketlen = 1 + LINK_SIZE;      bracketlen = 1 + LINK_SIZE;
850      break;      break;
851    
# Line 809  while (cc < ccend) Line 858  while (cc < ccend)
858      bracketlen = 1 + LINK_SIZE + IMM2_SIZE;      bracketlen = 1 + LINK_SIZE + IMM2_SIZE;
859      break;      break;
860    
861      CASE_ITERATOR_LOCAL1      CASE_ITERATOR_PRIVATE_DATA_1
862      space = 1;      space = 1;
863      size = -2;      size = -2;
864      break;      break;
865    
866      CASE_ITERATOR_LOCAL2A      CASE_ITERATOR_PRIVATE_DATA_2A
867      space = 2;      space = 2;
868      size = -2;      size = -2;
869      break;      break;
870    
871      CASE_ITERATOR_LOCAL2B      CASE_ITERATOR_PRIVATE_DATA_2B
872      space = 2;      space = 2;
873      size = -(2 + IMM2_SIZE);      size = -(2 + IMM2_SIZE);
874      break;      break;
875    
876      CASE_ITERATOR_TYPE_LOCAL1      CASE_ITERATOR_TYPE_PRIVATE_DATA_1
877      space = 1;      space = 1;
878      size = 1;      size = 1;
879      break;      break;
880    
881      CASE_ITERATOR_TYPE_LOCAL2A      CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
882      if (cc[1] != OP_ANYNL && cc[1] != OP_EXTUNI)      if (cc[1] != OP_ANYNL && cc[1] != OP_EXTUNI)
883        space = 2;        space = 2;
884      size = 1;      size = 1;
885      break;      break;
886    
887      CASE_ITERATOR_TYPE_LOCAL2B      CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
888      if (cc[1 + IMM2_SIZE] != OP_ANYNL && cc[1 + IMM2_SIZE] != OP_EXTUNI)      if (cc[1 + IMM2_SIZE] != OP_ANYNL && cc[1 + IMM2_SIZE] != OP_EXTUNI)
889        space = 2;        space = 2;
890      size = 1 + IMM2_SIZE;      size = 1 + IMM2_SIZE;
# Line 881  while (cc < ccend) Line 930  while (cc < ccend)
930      }      }
931    
932    if (space > 0 && cc >= end)    if (space > 0 && cc >= end)
933      localspace += sizeof(sljit_w) * space;      private_data_length += sizeof(sljit_w) * space;
934    
935    if (size != 0)    if (size != 0)
936      {      {
# Line 896  while (cc < ccend) Line 945  while (cc < ccend)
945        cc += size;        cc += size;
946      }      }
947    
948    if (bracketlen > 0)    if (bracketlen != 0)
949      {      {
950      if (cc >= end)      if (cc >= end)
951        {        {
# Line 907  while (cc < ccend) Line 956  while (cc < ccend)
956      cc += bracketlen;      cc += bracketlen;
957      }      }
958    }    }
959  return localspace;  return private_data_length;
960  }  }
961    
962  static void set_localptrs(compiler_common *common, int localptr, pcre_uchar *ccend)  static void set_private_data_ptrs(compiler_common *common, int private_data_ptr, pcre_uchar *ccend)
963  {  {
964  pcre_uchar *cc = common->start;  pcre_uchar *cc = common->start;
965  pcre_uchar *alternative;  pcre_uchar *alternative;
# Line 934  while (cc < ccend) Line 983  while (cc < ccend)
983      case OP_SBRA:      case OP_SBRA:
984      case OP_SBRAPOS:      case OP_SBRAPOS:
985      case OP_SCOND:      case OP_SCOND:
986      common->localptrs[cc - common->start] = localptr;      common->private_data_ptrs[cc - common->start] = private_data_ptr;
987      localptr += sizeof(sljit_w);      private_data_ptr += sizeof(sljit_w);
988      bracketlen = 1 + LINK_SIZE;      bracketlen = 1 + LINK_SIZE;
989      break;      break;
990    
991      case OP_CBRAPOS:      case OP_CBRAPOS:
992      case OP_SCBRAPOS:      case OP_SCBRAPOS:
993      common->localptrs[cc - common->start] = localptr;      common->private_data_ptrs[cc - common->start] = private_data_ptr;
994      localptr += sizeof(sljit_w);      private_data_ptr += sizeof(sljit_w);
995      bracketlen = 1 + LINK_SIZE + IMM2_SIZE;      bracketlen = 1 + LINK_SIZE + IMM2_SIZE;
996      break;      break;
997    
# Line 951  while (cc < ccend) Line 1000  while (cc < ccend)
1000      alternative = cc + GET(cc, 1);      alternative = cc + GET(cc, 1);
1001      if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)      if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
1002        {        {
1003        common->localptrs[cc - common->start] = localptr;        common->private_data_ptrs[cc - common->start] = private_data_ptr;
1004        localptr += sizeof(sljit_w);        private_data_ptr += sizeof(sljit_w);
1005        }        }
1006      bracketlen = 1 + LINK_SIZE;      bracketlen = 1 + LINK_SIZE;
1007      break;      break;
# Line 966  while (cc < ccend) Line 1015  while (cc < ccend)
1015      bracketlen = 1 + LINK_SIZE + IMM2_SIZE;      bracketlen = 1 + LINK_SIZE + IMM2_SIZE;
1016      break;      break;
1017    
1018      CASE_ITERATOR_LOCAL1      CASE_ITERATOR_PRIVATE_DATA_1
1019      space = 1;      space = 1;
1020      size = -2;      size = -2;
1021      break;      break;
1022    
1023      CASE_ITERATOR_LOCAL2A      CASE_ITERATOR_PRIVATE_DATA_2A
1024      space = 2;      space = 2;
1025      size = -2;      size = -2;
1026      break;      break;
1027    
1028      CASE_ITERATOR_LOCAL2B      CASE_ITERATOR_PRIVATE_DATA_2B
1029      space = 2;      space = 2;
1030      size = -(2 + IMM2_SIZE);      size = -(2 + IMM2_SIZE);
1031      break;      break;
1032    
1033      CASE_ITERATOR_TYPE_LOCAL1      CASE_ITERATOR_TYPE_PRIVATE_DATA_1
1034      space = 1;      space = 1;
1035      size = 1;      size = 1;
1036      break;      break;
1037    
1038      CASE_ITERATOR_TYPE_LOCAL2A      CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
1039      if (cc[1] != OP_ANYNL && cc[1] != OP_EXTUNI)      if (cc[1] != OP_ANYNL && cc[1] != OP_EXTUNI)
1040        space = 2;        space = 2;
1041      size = 1;      size = 1;
1042      break;      break;
1043    
1044      CASE_ITERATOR_TYPE_LOCAL2B      CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
1045      if (cc[1 + IMM2_SIZE] != OP_ANYNL && cc[1 + IMM2_SIZE] != OP_EXTUNI)      if (cc[1 + IMM2_SIZE] != OP_ANYNL && cc[1 + IMM2_SIZE] != OP_EXTUNI)
1046        space = 2;        space = 2;
1047      size = 1 + IMM2_SIZE;      size = 1 + IMM2_SIZE;
# Line 1019  while (cc < ccend) Line 1068  while (cc < ccend)
1068    
1069    if (space > 0 && cc >= end)    if (space > 0 && cc >= end)
1070      {      {
1071      common->localptrs[cc - common->start] = localptr;      common->private_data_ptrs[cc - common->start] = private_data_ptr;
1072      localptr += sizeof(sljit_w) * space;      private_data_ptr += sizeof(sljit_w) * space;
1073      }      }
1074    
1075    if (size != 0)    if (size != 0)
# Line 1222  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), st Line 1271  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), st
1271  SLJIT_ASSERT(stackpos == STACK(stacktop));  SLJIT_ASSERT(stackpos == STACK(stacktop));
1272  }  }
1273    
1274  static SLJIT_INLINE int get_localsize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)  static SLJIT_INLINE int get_private_data_length_for_copy(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
1275  {  {
1276  int localsize = 2;  int private_data_length = 2;
1277  int size;  int size;
1278  pcre_uchar *alternative;  pcre_uchar *alternative;
1279  /* Calculate the sum of the local variables. */  /* Calculate the sum of the private machine words. */
1280  while (cc < ccend)  while (cc < ccend)
1281    {    {
1282    size = 0;    size = 0;
# Line 1243  while (cc < ccend) Line 1292  while (cc < ccend)
1292      case OP_SBRA:      case OP_SBRA:
1293      case OP_SBRAPOS:      case OP_SBRAPOS:
1294      case OP_SCOND:      case OP_SCOND:
1295      localsize++;      private_data_length++;
1296      cc += 1 + LINK_SIZE;      cc += 1 + LINK_SIZE;
1297      break;      break;
1298    
1299      case OP_CBRA:      case OP_CBRA:
1300      case OP_SCBRA:      case OP_SCBRA:
1301      localsize++;      if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
1302          private_data_length++;
1303      cc += 1 + LINK_SIZE + IMM2_SIZE;      cc += 1 + LINK_SIZE + IMM2_SIZE;
1304      break;      break;
1305    
1306      case OP_CBRAPOS:      case OP_CBRAPOS:
1307      case OP_SCBRAPOS:      case OP_SCBRAPOS:
1308      localsize += 2;      private_data_length += 2;
1309      cc += 1 + LINK_SIZE + IMM2_SIZE;      cc += 1 + LINK_SIZE + IMM2_SIZE;
1310      break;      break;
1311    
# Line 1263  while (cc < ccend) Line 1313  while (cc < ccend)
1313      /* Might be a hidden SCOND. */      /* Might be a hidden SCOND. */
1314      alternative = cc + GET(cc, 1);      alternative = cc + GET(cc, 1);
1315      if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)      if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
1316        localsize++;        private_data_length++;
1317      cc += 1 + LINK_SIZE;      cc += 1 + LINK_SIZE;
1318      break;      break;
1319    
1320      CASE_ITERATOR_LOCAL1      CASE_ITERATOR_PRIVATE_DATA_1
1321      if (PRIV_DATA(cc))      if (PRIVATE_DATA(cc))
1322        localsize++;        private_data_length++;
1323      cc += 2;      cc += 2;
1324  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
1325      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1326  #endif  #endif
1327      break;      break;
1328    
1329      CASE_ITERATOR_LOCAL2A      CASE_ITERATOR_PRIVATE_DATA_2A
1330      if (PRIV_DATA(cc))      if (PRIVATE_DATA(cc))
1331        localsize += 2;        private_data_length += 2;
1332      cc += 2;      cc += 2;
1333  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
1334      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1335  #endif  #endif
1336      break;      break;
1337    
1338      CASE_ITERATOR_LOCAL2B      CASE_ITERATOR_PRIVATE_DATA_2B
1339      if (PRIV_DATA(cc))      if (PRIVATE_DATA(cc))
1340        localsize += 2;        private_data_length += 2;
1341      cc += 2 + IMM2_SIZE;      cc += 2 + IMM2_SIZE;
1342  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
1343      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);      if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
1344  #endif  #endif
1345      break;      break;
1346    
1347      CASE_ITERATOR_TYPE_LOCAL1      CASE_ITERATOR_TYPE_PRIVATE_DATA_1
1348      if (PRIV_DATA(cc))      if (PRIVATE_DATA(cc))
1349        localsize++;        private_data_length++;
1350      cc += 1;      cc += 1;
1351      break;      break;
1352    
1353      CASE_ITERATOR_TYPE_LOCAL2A      CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
1354      if (PRIV_DATA(cc))      if (PRIVATE_DATA(cc))
1355        localsize += 2;        private_data_length += 2;
1356      cc += 1;      cc += 1;
1357      break;      break;
1358    
1359      CASE_ITERATOR_TYPE_LOCAL2B      CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
1360      if (PRIV_DATA(cc))      if (PRIVATE_DATA(cc))
1361        localsize += 2;        private_data_length += 2;
1362      cc += 1 + IMM2_SIZE;      cc += 1 + IMM2_SIZE;
1363      break;      break;
1364    
# Line 1320  while (cc < ccend) Line 1370  while (cc < ccend)
1370  #else  #else
1371      size = 1 + 32 / (int)sizeof(pcre_uchar);      size = 1 + 32 / (int)sizeof(pcre_uchar);
1372  #endif  #endif
1373      if (PRIV_DATA(cc))      if (PRIVATE_DATA(cc))
1374        localsize += get_class_iterator_size(cc + size);        private_data_length += get_class_iterator_size(cc + size);
1375      cc += size;      cc += size;
1376      break;      break;
1377    
# Line 1332  while (cc < ccend) Line 1382  while (cc < ccend)
1382      }      }
1383    }    }
1384  SLJIT_ASSERT(cc == ccend);  SLJIT_ASSERT(cc == ccend);
1385  return localsize;  return private_data_length;
1386  }  }
1387    
1388  static void copy_locals(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend,  static void copy_private_data(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend,
1389    BOOL save, int stackptr, int stacktop)    BOOL save, int stackptr, int stacktop)
1390  {  {
1391  DEFINE_COMPILER;  DEFINE_COMPILER;
# Line 1405  while (status != end) Line 1455  while (status != end)
1455        case OP_SBRAPOS:        case OP_SBRAPOS:
1456        case OP_SCOND:        case OP_SCOND:
1457        count = 1;        count = 1;
1458        srcw[0] = PRIV_DATA(cc);        srcw[0] = PRIVATE_DATA(cc);
1459        SLJIT_ASSERT(srcw[0] != 0);        SLJIT_ASSERT(srcw[0] != 0);
1460        cc += 1 + LINK_SIZE;        cc += 1 + LINK_SIZE;
1461        break;        break;
1462    
1463        case OP_CBRA:        case OP_CBRA:
1464        case OP_SCBRA:        case OP_SCBRA:
1465        count = 1;        if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
1466        srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));          {
1467            count = 1;
1468            srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
1469            }
1470        cc += 1 + LINK_SIZE + IMM2_SIZE;        cc += 1 + LINK_SIZE + IMM2_SIZE;
1471        break;        break;
1472    
1473        case OP_CBRAPOS:        case OP_CBRAPOS:
1474        case OP_SCBRAPOS:        case OP_SCBRAPOS:
1475        count = 2;        count = 2;
1476        srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));        srcw[0] = PRIVATE_DATA(cc);
1477        srcw[1] = PRIV_DATA(cc);        srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
1478        SLJIT_ASSERT(srcw[0] != 0);        SLJIT_ASSERT(srcw[0] != 0 && srcw[1] != 0);
1479        cc += 1 + LINK_SIZE + IMM2_SIZE;        cc += 1 + LINK_SIZE + IMM2_SIZE;
1480        break;        break;
1481    
# Line 1432  while (status != end) Line 1485  while (status != end)
1485        if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)        if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
1486          {          {
1487          count = 1;          count = 1;
1488          srcw[0] = PRIV_DATA(cc);          srcw[0] = PRIVATE_DATA(cc);
1489          SLJIT_ASSERT(srcw[0] != 0);          SLJIT_ASSERT(srcw[0] != 0);
1490          }          }
1491        cc += 1 + LINK_SIZE;        cc += 1 + LINK_SIZE;
1492        break;        break;
1493    
1494        CASE_ITERATOR_LOCAL1        CASE_ITERATOR_PRIVATE_DATA_1
1495        if (PRIV_DATA(cc))        if (PRIVATE_DATA(cc))
1496          {          {
1497          count = 1;          count = 1;
1498          srcw[0] = PRIV_DATA(cc);          srcw[0] = PRIVATE_DATA(cc);
1499          }          }
1500        cc += 2;        cc += 2;
1501  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
# Line 1450  while (status != end) Line 1503  while (status != end)
1503  #endif  #endif
1504        break;        break;
1505    
1506        CASE_ITERATOR_LOCAL2A        CASE_ITERATOR_PRIVATE_DATA_2A
1507        if (PRIV_DATA(cc))        if (PRIVATE_DATA(cc))
1508          {          {
1509          count = 2;          count = 2;
1510          srcw[0] = PRIV_DATA(cc);          srcw[0] = PRIVATE_DATA(cc);
1511          srcw[1] = PRIV_DATA(cc) + sizeof(sljit_w);          srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_w);
1512          }          }
1513        cc += 2;        cc += 2;
1514  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
# Line 1463  while (status != end) Line 1516  while (status != end)
1516  #endif  #endif
1517        break;        break;
1518    
1519        CASE_ITERATOR_LOCAL2B        CASE_ITERATOR_PRIVATE_DATA_2B
1520        if (PRIV_DATA(cc))        if (PRIVATE_DATA(cc))
1521          {          {
1522          count = 2;          count = 2;
1523          srcw[0] = PRIV_DATA(cc);          srcw[0] = PRIVATE_DATA(cc);
1524          srcw[1] = PRIV_DATA(cc) + sizeof(sljit_w);          srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_w);
1525          }          }
1526        cc += 2 + IMM2_SIZE;        cc += 2 + IMM2_SIZE;
1527  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
# Line 1476  while (status != end) Line 1529  while (status != end)
1529  #endif  #endif
1530        break;        break;
1531    
1532        CASE_ITERATOR_TYPE_LOCAL1        CASE_ITERATOR_TYPE_PRIVATE_DATA_1
1533        if (PRIV_DATA(cc))        if (PRIVATE_DATA(cc))
1534          {          {
1535          count = 1;          count = 1;
1536          srcw[0] = PRIV_DATA(cc);          srcw[0] = PRIVATE_DATA(cc);
1537          }          }
1538        cc += 1;        cc += 1;
1539        break;        break;
1540    
1541        CASE_ITERATOR_TYPE_LOCAL2A        CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
1542        if (PRIV_DATA(cc))        if (PRIVATE_DATA(cc))
1543          {          {
1544          count = 2;          count = 2;
1545          srcw[0] = PRIV_DATA(cc);          srcw[0] = PRIVATE_DATA(cc);
1546          srcw[1] = srcw[0] + sizeof(sljit_w);          srcw[1] = srcw[0] + sizeof(sljit_w);
1547          }          }
1548        cc += 1;        cc += 1;
1549        break;        break;
1550    
1551        CASE_ITERATOR_TYPE_LOCAL2B        CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
1552        if (PRIV_DATA(cc))        if (PRIVATE_DATA(cc))
1553          {          {
1554          count = 2;          count = 2;
1555          srcw[0] = PRIV_DATA(cc);          srcw[0] = PRIVATE_DATA(cc);
1556          srcw[1] = srcw[0] + sizeof(sljit_w);          srcw[1] = srcw[0] + sizeof(sljit_w);
1557          }          }
1558        cc += 1 + IMM2_SIZE;        cc += 1 + IMM2_SIZE;
# Line 1513  while (status != end) Line 1566  while (status != end)
1566  #else  #else
1567        size = 1 + 32 / (int)sizeof(pcre_uchar);        size = 1 + 32 / (int)sizeof(pcre_uchar);
1568  #endif  #endif
1569        if (PRIV_DATA(cc))        if (PRIVATE_DATA(cc))
1570          switch(get_class_iterator_size(cc + size))          switch(get_class_iterator_size(cc + size))
1571            {            {
1572            case 1:            case 1:
1573            count = 1;            count = 1;
1574            srcw[0] = PRIV_DATA(cc);            srcw[0] = PRIVATE_DATA(cc);
1575            break;            break;
1576    
1577            case 2:            case 2:
1578            count = 2;            count = 2;
1579            srcw[0] = PRIV_DATA(cc);            srcw[0] = PRIVATE_DATA(cc);
1580            srcw[1] = srcw[0] + sizeof(sljit_w);            srcw[1] = srcw[0] + sizeof(sljit_w);
1581            break;            break;
1582    
# Line 1636  if (save) Line 1689  if (save)
1689  SLJIT_ASSERT(cc == ccend && stackptr == stacktop && (save || (tmp1empty && tmp2empty)));  SLJIT_ASSERT(cc == ccend && stackptr == stacktop && (save || (tmp1empty && tmp2empty)));
1690  }  }
1691    
1692  #undef CASE_ITERATOR_LOCAL1  #undef CASE_ITERATOR_PRIVATE_DATA_1
1693  #undef CASE_ITERATOR_LOCAL2A  #undef CASE_ITERATOR_PRIVATE_DATA_2A
1694  #undef CASE_ITERATOR_LOCAL2B  #undef CASE_ITERATOR_PRIVATE_DATA_2B
1695  #undef CASE_ITERATOR_TYPE_LOCAL1  #undef CASE_ITERATOR_TYPE_PRIVATE_DATA_1
1696  #undef CASE_ITERATOR_TYPE_LOCAL2A  #undef CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
1697  #undef CASE_ITERATOR_TYPE_LOCAL2B  #undef CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
1698    
1699  static SLJIT_INLINE BOOL ispowerof2(unsigned int value)  static SLJIT_INLINE BOOL is_powerof2(unsigned int value)
1700  {  {
1701  return (value & (value - 1)) == 0;  return (value & (value - 1)) == 0;
1702  }  }
# Line 1785  loop = LABEL(); Line 1838  loop = LABEL();
1838  OP2(SLJIT_SUB, SLJIT_SAVED_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_TEMPORARY_REG1, 0);  OP2(SLJIT_SUB, SLJIT_SAVED_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_TEMPORARY_REG1, 0);
1839  OP2(SLJIT_ADD, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, sizeof(sljit_w));  OP2(SLJIT_ADD, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, sizeof(sljit_w));
1840  /* Copy the integer value to the output buffer */  /* Copy the integer value to the output buffer */
1841  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
1842  OP2(SLJIT_ASHR, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 1);  OP2(SLJIT_ASHR, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, UCHAR_SHIFT);
1843  #endif  #endif
1844  OP1(SLJIT_MOVU_SI, SLJIT_MEM1(SLJIT_TEMPORARY_REG3), sizeof(int), SLJIT_SAVED_REG2, 0);  OP1(SLJIT_MOVU_SI, SLJIT_MEM1(SLJIT_TEMPORARY_REG3), sizeof(int), SLJIT_SAVED_REG2, 0);
1845  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);
# Line 1827  OP1(SLJIT_MOV, SLJIT_SAVED_REG1, 0, SLJI Line 1880  OP1(SLJIT_MOV, SLJIT_SAVED_REG1, 0, SLJI
1880  OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), SLJIT_OFFSETOF(jit_arguments, offsets));  OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), SLJIT_OFFSETOF(jit_arguments, offsets));
1881  OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG3, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mode == JIT_PARTIAL_HARD_COMPILE ? common->start_used_ptr : common->hit_start);  OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG3, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mode == JIT_PARTIAL_HARD_COMPILE ? common->start_used_ptr : common->hit_start);
1882  OP2(SLJIT_SUB, SLJIT_SAVED_REG2, 0, STR_END, 0, SLJIT_SAVED_REG1, 0);  OP2(SLJIT_SUB, SLJIT_SAVED_REG2, 0, STR_END, 0, SLJIT_SAVED_REG1, 0);
1883  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
1884  OP2(SLJIT_ASHR, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, 1);  OP2(SLJIT_ASHR, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, UCHAR_SHIFT);
1885  #endif  #endif
1886  OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), sizeof(int), SLJIT_SAVED_REG2, 0);  OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), sizeof(int), SLJIT_SAVED_REG2, 0);
1887    
1888  OP2(SLJIT_SUB, SLJIT_TEMPORARY_REG3, 0, SLJIT_TEMPORARY_REG3, 0, SLJIT_SAVED_REG1, 0);  OP2(SLJIT_SUB, SLJIT_TEMPORARY_REG3, 0, SLJIT_TEMPORARY_REG3, 0, SLJIT_SAVED_REG1, 0);
1889  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
1890  OP2(SLJIT_ASHR, SLJIT_TEMPORARY_REG3, 0, SLJIT_TEMPORARY_REG3, 0, SLJIT_IMM, 1);  OP2(SLJIT_ASHR, SLJIT_TEMPORARY_REG3, 0, SLJIT_TEMPORARY_REG3, 0, SLJIT_IMM, UCHAR_SHIFT);
1891  #endif  #endif
1892  OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), 0, SLJIT_TEMPORARY_REG3, 0);  OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), 0, SLJIT_TEMPORARY_REG3, 0);
1893    
# Line 1949  if (c <= 127 && bit == 0x20) Line 2002  if (c <= 127 && bit == 0x20)
2002    return (0 << 8) | 0x20;    return (0 << 8) | 0x20;
2003    
2004  /* Since c != oc, they must have at least 1 bit difference. */  /* Since c != oc, they must have at least 1 bit difference. */
2005  if (!ispowerof2(bit))  if (!is_powerof2(bit))
2006    return 0;    return 0;
2007    
2008  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
2009    
2010  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
2011  if (common->utf && c > 127)  if (common->utf && c > 127)
# Line 1968  if (common->utf && c > 127) Line 2021  if (common->utf && c > 127)
2021  #endif /* SUPPORT_UTF */  #endif /* SUPPORT_UTF */
2022  return (0 << 8) | bit;  return (0 << 8) | bit;
2023    
2024  #else /* COMPILE_PCRE8 */  #elif defined COMPILE_PCRE16 || defined COMPILE_PCRE32
2025    
 #ifdef COMPILE_PCRE16  
2026  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
2027  if (common->utf && c > 65535)  if (common->utf && c > 65535)
2028    {    {
# Line 1981  if (common->utf && c > 65535) Line 2033  if (common->utf && c > 65535)
2033    }    }
2034  #endif /* SUPPORT_UTF */  #endif /* SUPPORT_UTF */
2035  return (bit < 256) ? ((0 << 8) | bit) : ((1 << 8) | (bit >> 8));  return (bit < 256) ? ((0 << 8) | bit) : ((1 << 8) | (bit >> 8));
 #endif /* COMPILE_PCRE16 */  
2036    
2037  #endif /* COMPILE_PCRE8 */  #endif /* COMPILE_PCRE[8|16|32] */
2038  }  }
2039    
2040  static void check_partial(compiler_common *common, BOOL force)  static void check_partial(compiler_common *common, BOOL force)
# Line 2081  static void read_char(compiler_common *c Line 2132  static void read_char(compiler_common *c
2132  /* Reads the character into TMP1, updates STR_PTR.  /* Reads the character into TMP1, updates STR_PTR.
2133  Does not check STR_END. TMP2 Destroyed. */  Does not check STR_END. TMP2 Destroyed. */
2134  DEFINE_COMPILER;  DEFINE_COMPILER;
2135  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2136  struct sljit_jump *jump;  struct sljit_jump *jump;
2137  #endif  #endif
2138    
2139  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2140  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2141  if (common->utf)  if (common->utf)
2142    {    {
2143  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
2144    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
2145  #else  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
2146    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
2147  #endif  #endif /* COMPILE_PCRE[8|16] */
 #endif /* COMPILE_PCRE8 */  
2148    add_jump(compiler, &common->utfreadchar, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->utfreadchar, JUMP(SLJIT_FAST_CALL));
2149    JUMPHERE(jump);    JUMPHERE(jump);
2150    }    }
2151  #endif  #endif /* SUPPORT_UTF && !COMPILE_PCRE32 */
2152  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2153  }  }
2154    
# Line 2108  static void peek_char(compiler_common *c Line 2157  static void peek_char(compiler_common *c
2157  /* Reads the character into TMP1, keeps STR_PTR.  /* Reads the character into TMP1, keeps STR_PTR.
2158  Does not check STR_END. TMP2 Destroyed. */  Does not check STR_END. TMP2 Destroyed. */
2159  DEFINE_COMPILER;  DEFINE_COMPILER;
2160  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2161  struct sljit_jump *jump;  struct sljit_jump *jump;
2162  #endif  #endif
2163    
2164  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2165  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2166  if (common->utf)  if (common->utf)
2167    {    {
2168  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
2169    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
2170  #else  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
2171    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);    jump = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
2172  #endif  #endif /* COMPILE_PCRE[8|16] */
 #endif /* COMPILE_PCRE8 */  
2173    add_jump(compiler, &common->utfreadchar, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->utfreadchar, JUMP(SLJIT_FAST_CALL));
2174    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
2175    JUMPHERE(jump);    JUMPHERE(jump);
2176    }    }
2177  #endif  #endif /* SUPPORT_UTF && !COMPILE_PCRE32 */
2178  }  }
2179    
2180  static void read_char8_type(compiler_common *common)  static void read_char8_type(compiler_common *common)
2181  {  {
2182  /* 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. */
2183  DEFINE_COMPILER;  DEFINE_COMPILER;
2184  #if defined SUPPORT_UTF || defined COMPILE_PCRE16  #if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
2185  struct sljit_jump *jump;  struct sljit_jump *jump;
2186  #endif  #endif
2187    
# Line 2143  if (common->utf) Line 2190  if (common->utf)
2190    {    {
2191    OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);    OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);
2192    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2193  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
2194    /* This can be an extra read in some situations, but hopefully    /* This can be an extra read in some situations, but hopefully
2195    it is needed in most cases. */    it is needed in most cases. */
2196    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
2197    jump = CMP(SLJIT_C_LESS, TMP2, 0, SLJIT_IMM, 0xc0);    jump = CMP(SLJIT_C_LESS, TMP2, 0, SLJIT_IMM, 0xc0);
2198    add_jump(compiler, &common->utfreadtype8, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->utfreadtype8, JUMP(SLJIT_FAST_CALL));
2199    JUMPHERE(jump);    JUMPHERE(jump);
2200  #else  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
2201    OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);    OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
2202    jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 255);    jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 255);
2203    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
# Line 2162  if (common->utf) Line 2208  if (common->utf)
2208    COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_EQUAL);    COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_EQUAL);
2209    OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);    OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
2210    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
2211  #endif  #elif defined COMPILE_PCRE32
2212  #endif /* COMPILE_PCRE8 */    OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
2213      jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 255);
2214      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
2215      JUMPHERE(jump);
2216    #endif /* COMPILE_PCRE[8|16|32] */
2217    return;    return;
2218    }    }
2219  #endif  #endif /* SUPPORT_UTF */
2220  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);
2221  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2222  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
2223  /* The ctypes array contains only 256 values. */  /* The ctypes array contains only 256 values. */
2224  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
2225  jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 255);  jump = CMP(SLJIT_C_GREATER, TMP2, 0, SLJIT_IMM, 255);
2226  #endif  #endif
2227  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), common->ctypes);
2228  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
2229  JUMPHERE(jump);  JUMPHERE(jump);
2230  #endif  #endif
2231  }  }
# Line 2184  static void skip_char_back(compiler_comm Line 2234  static void skip_char_back(compiler_comm
2234  {  {
2235  /* Goes one character back. Affects STR_PTR and TMP1. Does not check begin. */  /* Goes one character back. Affects STR_PTR and TMP1. Does not check begin. */
2236  DEFINE_COMPILER;  DEFINE_COMPILER;
2237  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2238    #if defined COMPILE_PCRE8
2239  struct sljit_label *label;  struct sljit_label *label;
2240    
2241  if (common->utf)  if (common->utf)
# Line 2196  if (common->utf) Line 2247  if (common->utf)
2247    CMPTO(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, 0x80, label);    CMPTO(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, 0x80, label);
2248    return;    return;
2249    }    }
2250  #endif  #elif defined COMPILE_PCRE16
 #if defined SUPPORT_UTF && defined COMPILE_PCRE16  
2251  if (common->utf)  if (common->utf)
2252    {    {
2253    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), -IN_UCHARS(1));    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), -IN_UCHARS(1));
# Line 2210  if (common->utf) Line 2260  if (common->utf)
2260    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
2261    return;    return;
2262    }    }
2263  #endif  #endif /* COMPILE_PCRE[8|16] */
2264    #endif /* SUPPORT_UTF && !COMPILE_PCRE32 */
2265  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));  OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2266  }  }
2267    
# Line 2241  else Line 2292  else
2292    
2293  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
2294    
2295  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
2296  static void do_utfreadchar(compiler_common *common)  static void do_utfreadchar(compiler_common *common)
2297  {  {
2298  /* Fast decoding a UTF-8 character. TMP1 contains the first byte  /* Fast decoding a UTF-8 character. TMP1 contains the first byte
# Line 2335  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0); Line 2386  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
2386  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
2387  }  }
2388    
2389  #else /* COMPILE_PCRE8 */  #elif defined COMPILE_PCRE16
2390    
 #ifdef COMPILE_PCRE16  
2391  static void do_utfreadchar(compiler_common *common)  static void do_utfreadchar(compiler_common *common)
2392  {  {
2393  /* Fast decoding a UTF-16 character. TMP1 contains the first 16 bit char  /* Fast decoding a UTF-16 character. TMP1 contains the first 16 bit char
# Line 2362  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, IN_UC Line 2412  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, IN_UC
2412  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x10000);  OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x10000);
2413  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
2414  }  }
 #endif /* COMPILE_PCRE16 */  
2415    
2416  #endif /* COMPILE_PCRE8 */  #endif /* COMPILE_PCRE[8|16] */
2417    
2418  #endif /* SUPPORT_UTF */  #endif /* SUPPORT_UTF */
2419    
# Line 2404  struct sljit_label *newlinelabel = NULL; Line 2453  struct sljit_label *newlinelabel = NULL;
2453  struct sljit_jump *start;  struct sljit_jump *start;
2454  struct sljit_jump *end = NULL;  struct sljit_jump *end = NULL;
2455  struct sljit_jump *nl = NULL;  struct sljit_jump *nl = NULL;
2456  #ifdef SUPPORT_UTF  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2457  struct sljit_jump *singlechar;  struct sljit_jump *singlechar;
2458  #endif  #endif
2459  jump_list *newline = NULL;  jump_list *newline = NULL;
# Line 2460  if (newlinecheck) Line 2509  if (newlinecheck)
2509    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2510    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);
2511    COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);    COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);
2512  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
2513    OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);    OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT);
2514  #endif  #endif
2515    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
2516    nl = JUMP(SLJIT_JUMP);    nl = JUMP(SLJIT_JUMP);
# Line 2482  if (newlinecheck) Line 2531  if (newlinecheck)
2531    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);
2532    
2533  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2534  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #if defined SUPPORT_UTF && !defined COMPILE_PCRE32
2535    #if defined COMPILE_PCRE8
2536  if (common->utf)  if (common->utf)
2537    {    {
2538    singlechar = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    singlechar = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
# Line 2490  if (common->utf) Line 2540  if (common->utf)
2540    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
2541    JUMPHERE(singlechar);    JUMPHERE(singlechar);
2542    }    }
2543  #endif  #elif defined COMPILE_PCRE16
 #if defined SUPPORT_UTF && defined COMPILE_PCRE16  
2544  if (common->utf)  if (common->utf)
2545    {    {
2546    singlechar = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);    singlechar = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
# Line 2502  if (common->utf) Line 2551  if (common->utf)
2551    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
2552    JUMPHERE(singlechar);    JUMPHERE(singlechar);
2553    }    }
2554  #endif  #endif /* COMPILE_PCRE[8|16] */
2555    #endif /* SUPPORT_UTF && !COMPILE_PCRE32 */
2556  JUMPHERE(start);  JUMPHERE(start);
2557    
2558  if (newlinecheck)  if (newlinecheck)
# Line 2514  if (newlinecheck) Line 2564  if (newlinecheck)
2564  return mainloop;  return mainloop;
2565  }  }
2566    
2567  static SLJIT_INLINE BOOL fast_forward_first_two_chars(compiler_common *common, BOOL firstline)  #define MAX_N_CHARS 3
2568    
2569    static SLJIT_INLINE BOOL fast_forward_first_n_chars(compiler_common *common, BOOL firstline)
2570  {  {
2571  DEFINE_COMPILER;  DEFINE_COMPILER;
2572  struct sljit_label *start;  struct sljit_label *start;
2573  struct sljit_jump *quit;  struct sljit_jump *quit;
2574  struct sljit_jump *found;  pcre_uint32 chars[MAX_N_CHARS * 2];
 pcre_int32 chars[4];  
2575  pcre_uchar *cc = common->start + 1 + IMM2_SIZE;  pcre_uchar *cc = common->start + 1 + IMM2_SIZE;
2576  int location = 0;  int location = 0;
2577  pcre_int32 len, c, bit, caseless;  pcre_int32 len, c, bit, caseless;
2578  BOOL must_end;  int must_stop;
   
 #ifdef COMPILE_PCRE8  
 union {  
     sljit_uh ascombined;  
     sljit_ub asuchars[2];  
 } pair;  
 #else  
 union {  
     sljit_ui ascombined;  
     sljit_uh asuchars[2];  
 } pair;  
 #endif  
2579    
2580    /* We do not support alternatives now. */
2581  if (*(common->start + GET(common->start, 1)) == OP_ALT)  if (*(common->start + GET(common->start, 1)) == OP_ALT)
2582    return FALSE;    return FALSE;
2583    
2584  while (TRUE)  while (TRUE)
2585    {    {
2586    caseless = 0;    caseless = 0;
2587    must_end = TRUE;    must_stop = 1;
2588    switch(*cc)    switch(*cc)
2589      {      {
2590      case OP_CHAR:      case OP_CHAR:
2591      must_end = FALSE;      must_stop = 0;
2592      cc++;      cc++;
2593      break;      break;
2594    
2595      case OP_CHARI:      case OP_CHARI:
2596      caseless = 1;      caseless = 1;
2597      must_end = FALSE;      must_stop = 0;
2598      cc++;      cc++;
2599      break;      break;
2600    
# Line 2596  while (TRUE) Line 2636  while (TRUE)
2636      break;      break;
2637    
2638      default:      default:
2639      return FALSE;      must_stop = 2;
2640        break;
2641      }      }
2642    
2643      if (must_stop == 2)
2644          break;
2645    
2646    len = 1;    len = 1;
2647  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
2648    if (common->utf && HAS_EXTRALEN(cc[0])) len += GET_EXTRALEN(cc[0]);    if (common->utf && HAS_EXTRALEN(cc[0])) len += GET_EXTRALEN(cc[0]);
# Line 2621  while (TRUE) Line 2665  while (TRUE)
2665    else    else
2666      caseless = 0;      caseless = 0;
2667    
2668    while (len > 0 && location < 2 * 2)    while (len > 0 && location < MAX_N_CHARS * 2)
2669      {      {
2670      c = *cc;      c = *cc;
2671      bit = 0;      bit = 0;
# Line 2639  while (TRUE) Line 2683  while (TRUE)
2683      cc++;      cc++;
2684      }      }
2685    
2686    if (location == 2 * 2)    if (location >= MAX_N_CHARS * 2 || must_stop != 0)
2687      break;      break;
   else if (must_end)  
     return FALSE;  
2688    }    }
2689    
2690    /* At least two characters are required. */
2691    if (location < 2 * 2)
2692        return FALSE;
2693    
2694  if (firstline)  if (firstline)
2695    {    {
2696    SLJIT_ASSERT(common->first_line_end != 0);    SLJIT_ASSERT(common->first_line_end != 0);
2697    OP1(SLJIT_MOV, TMP3, 0, STR_END, 0);    OP1(SLJIT_MOV, TMP3, 0, STR_END, 0);
2698    OP2(SLJIT_SUB, STR_END, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end, SLJIT_IMM, 1);    OP2(SLJIT_SUB, STR_END, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end, SLJIT_IMM, (location >> 1) - 1);
2699    }    }
2700  else  else
2701    OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, 1);    OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, (location >> 1) - 1);
2702    
2703  start = LABEL();  start = LABEL();
2704  quit = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);  quit = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
 #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  
 #ifdef COMPILE_PCRE8  
 OP1(SLJIT_MOV_UH, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  
 #else /* COMPILE_PCRE8 */  
 OP1(SLJIT_MOV_UI, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  
 #endif  
2705    
2706  #else /* SLJIT_UNALIGNED */  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
   
 #if defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN  
 OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), 0);  
 OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));  
 #else /* SLJIT_BIG_ENDIAN */  
2707  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));  OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
2708  OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2709  #endif /* SLJIT_BIG_ENDIAN */  if (chars[1] != 0)
2710      OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, chars[1]);
2711  #ifdef COMPILE_PCRE8  CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[0], start);
2712  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 8);  if (location > 2 * 2)
2713  #else /* COMPILE_PCRE8 */    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
2714  OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 16);  if (chars[3] != 0)
2715  #endif    OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, chars[3]);
2716  OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);  CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, chars[2], start);
2717    if (location > 2 * 2)
2718  #endif    {
2719      if (chars[5] != 0)
2720  if (chars[1] != 0 || chars[3] != 0)      OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, chars[5]);
2721    {    CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, chars[4], start);
   pair.asuchars[0] = chars[1];  
   pair.asuchars[1] = chars[3];  
   OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, pair.ascombined);  
2722    }    }
2723    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2724    
 pair.asuchars[0] = chars[0];  
 pair.asuchars[1] = chars[2];  
 found = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, pair.ascombined);  
   
 OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));  
 JUMPTO(SLJIT_JUMP, start);  
 JUMPHERE(found);  
2725  JUMPHERE(quit);  JUMPHERE(quit);
2726    
2727  if (firstline)  if (firstline)
2728    OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);    OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
2729  else  else
2730    OP2(SLJIT_ADD, STR_END, 0, STR_END, 0, SLJIT_IMM, 1);    OP2(SLJIT_ADD, STR_END, 0, STR_END, 0, SLJIT_IMM, (location >> 1) - 1);
2731  return TRUE;  return TRUE;
2732  }  }
2733    
2734    #undef MAX_N_CHARS
2735    
2736  static SLJIT_INLINE void fast_forward_first_char(compiler_common *common, pcre_uchar first_char, BOOL caseless, BOOL firstline)  static SLJIT_INLINE void fast_forward_first_char(compiler_common *common, pcre_uchar first_char, BOOL caseless, BOOL firstline)
2737  {  {
2738  DEFINE_COMPILER;  DEFINE_COMPILER;
# Line 2738  if (first_char == oc) Line 2766  if (first_char == oc)
2766  else  else
2767    {    {
2768    bit = first_char ^ oc;    bit = first_char ^ oc;
2769    if (ispowerof2(bit))    if (is_powerof2(bit))
2770      {      {
2771      OP2(SLJIT_OR, TMP2, 0, TMP1, 0, SLJIT_IMM, bit);      OP2(SLJIT_OR, TMP2, 0, TMP1, 0, SLJIT_IMM, bit);
2772      found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, first_char | bit);      found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, first_char | bit);
# Line 2791  if (common->nltype == NLTYPE_FIXED && co Line 2819  if (common->nltype == NLTYPE_FIXED && co
2819    OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(2));    OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(2));
2820    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);
2821    COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_GREATER_EQUAL);    COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_GREATER_EQUAL);
2822  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
2823    OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);    OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCHAR_SHIFT);
2824  #endif  #endif
2825    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);    OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
2826    
# Line 2834  if (common->nltype == NLTYPE_ANY || comm Line 2862  if (common->nltype == NLTYPE_ANY || comm
2862    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2863    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);
2864    COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);    COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);
2865  #ifdef COMPILE_PCRE16  #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
2866    OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);    OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT);
2867  #endif  #endif
2868    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
2869    JUMPHERE(notfoundnl);    JUMPHERE(notfoundnl);
# Line 2889  if (common->utf) Line 2917  if (common->utf)
2917    OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);    OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
2918  #endif  #endif
2919  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
2920  #if defined SUPPORT_UTF && defined COMPILE_PCRE8  #ifdef SUPPORT_UTF
2921    #if defined COMPILE_PCRE8
2922  if (common->utf)  if (common->utf)
2923    {    {
2924    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
2925    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
2926    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
2927    }    }
2928  #endif  #elif defined COMPILE_PCRE16
 #if defined SUPPORT_UTF && defined COMPILE_PCRE16  
2929  if (common->utf)  if (common->utf)
2930    {    {
2931    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800, start);    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800, start);
# Line 2907  if (common->utf) Line 2935  if (common->utf)
2935    OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);    OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
2936    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
2937    }    }
2938  #endif  #endif /* COMPILE_PCRE[8|16] */
2939    #endif /* SUPPORT_UTF */
2940  JUMPTO(SLJIT_JUMP, start);  JUMPTO(SLJIT_JUMP, start);
2941  JUMPHERE(found);  JUMPHERE(found);
2942  JUMPHERE(quit);  JUMPHERE(quit);
# Line 2925  struct sljit_jump *alreadyfound; Line 2954  struct sljit_jump *alreadyfound;
2954  struct sljit_jump *found;  struct sljit_jump *found;
2955  struct sljit_jump *foundoc = NULL;  struct sljit_jump *foundoc = NULL;
2956  struct sljit_jump *notfound;  struct sljit_jump *notfound;
2957  pcre_uchar oc, bit;  pcre_uint32 oc, bit;
2958    
2959  SLJIT_ASSERT(common->req_char_ptr != 0);  SLJIT_ASSERT(common->req_char_ptr != 0);
2960  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->req_char_ptr);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->req_char_ptr);
# Line 2956  if (req_char == oc) Line 2985  if (req_char == oc)
2985  else  else
2986    {    {
2987    bit = req_char ^ oc;    bit = req_char ^ oc;
2988    if (ispowerof2(bit))    if (is_powerof2(bit))
2989      {      {
2990      OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, bit);      OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, bit);
2991      found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, req_char | bit);      found = CMP(SLJIT_C_EQUAL, TMP2, 0, SLJIT_IMM, req_char | bit);
# Line 3186  switch(ranges[0]) Line 3215  switch(ranges[0])
3215        }        }
3216      return TRUE;      return TRUE;
3217      }      }
3218    if ((ranges[3] - ranges[2]) == (ranges[5] - ranges[4]) && ispowerof2(ranges[4] - ranges[2]))    if ((ranges[3] - ranges[2]) == (ranges[5] - ranges[4]) && is_powerof2(ranges[4] - ranges[2]))
3219      {      {
3220      if (readch)      if (readch)
3221        read_char(common);        read_char(common);
# Line 3287  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_I Line 3316  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_I
3316  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);
3317  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_LESS_EQUAL);  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_LESS_EQUAL);
3318  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);
3319  #if defined SUPPORT_UTF || defined COMPILE_PCRE16  #if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
3320  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
3321  if (common->utf)  if (common->utf)
3322    {    {
# Line 3298  if (common->utf) Line 3327  if (common->utf)
3327  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
3328    }    }
3329  #endif  #endif
3330  #endif /* SUPPORT_UTF || COMPILE_PCRE16 */  #endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
3331  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);
3332  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
3333  }  }
# Line 3315  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_E Line 3344  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_E
3344  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);
3345  COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);  COND_VALUE(SLJIT_OR, TMP2, 0, SLJIT_C_EQUAL);
3346  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);
3347  #if defined SUPPORT_UTF || defined COMPILE_PCRE16  #if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
3348  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
3349  if (common->utf)  if (common->utf)
3350    {    {
# Line 3336  if (common->utf) Line 3365  if (common->utf)
3365  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
3366    }    }
3367  #endif  #endif
3368  #endif /* SUPPORT_UTF || COMPILE_PCRE16 */  #endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
3369  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);
3370    
3371  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
# Line 3353  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_I Line 3382  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_I
3382  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);
3383  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_LESS_EQUAL);  COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_LESS_EQUAL);
3384  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);
3385  #if defined SUPPORT_UTF || defined COMPILE_PCRE16  #if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
3386  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
3387  if (common->utf)  if (common->utf)
3388    {    {
# Line 3364  if (common->utf) Line 3393  if (common->utf)
3393  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
3394    }    }
3395  #endif  #endif
3396  #endif /* SUPPORT_UTF || COMPILE_PCRE16 */  #endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
3397  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);  COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_EQUAL);
3398    
3399  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
# Line 3454  sljit_emit_fast_return(compiler, RETURN_ Line 3483  sljit_emit_fast_return(compiler, RETURN_
3483  static const pcre_uchar *SLJIT_CALL do_utf_caselesscmp(pcre_uchar *src1, jit_arguments *args, pcre_uchar *end1)  static const pcre_uchar *SLJIT_CALL do_utf_caselesscmp(pcre_uchar *src1, jit_arguments *args, pcre_uchar *end1)
3484  {  {
3485  /* This function would be ineffective to do in JIT level. */  /* This function would be ineffective to do in JIT level. */
3486  int c1, c2;  pcre_uint32 c1, c2;
3487  const pcre_uchar *src2 = args->uchar_ptr;  const pcre_uchar *src2 = args->uchar_ptr;
3488  const pcre_uchar *end2 = args->end;  const pcre_uchar *end2 = args->end;
3489    const ucd_record *ur;
3490    const pcre_uint32 *pp;
3491    
3492  while (src1 < end1)  while (src1 < end1)
3493    {    {
# Line 3464  while (src1 < end1) Line 3495  while (src1 < end1)
3495      return (pcre_uchar*)1;      return (pcre_uchar*)1;
3496    GETCHARINC(c1, src1);    GETCHARINC(c1, src1);
3497    GETCHARINC(c2, src2);    GETCHARINC(c2, src2);
3498    if (c1 != c2 && c1 != UCD_OTHERCASE(c2)) return NULL;    ur = GET_UCD(c2);
3499      if (c1 != c2 && c1 != c2 + ur->other_case)
3500        {
3501        pp = PRIV(ucd_caseless_sets) + ur->caseset;
3502        for (;;)
3503          {
3504          if (c1 < *pp) return NULL;
3505          if (c1 == *pp++) break;
3506          }
3507        }
3508    }    }
3509  return src2;  return src2;
3510  }  }
# Line 3486  if (caseless && char_has_othercase(commo Line 3526  if (caseless && char_has_othercase(commo
3526    othercasebit = char_get_othercase_bit(common, cc);    othercasebit = char_get_othercase_bit(common, cc);
3527    SLJIT_ASSERT(othercasebit);    SLJIT_ASSERT(othercasebit);
3528    /* Extracting bit difference info. */    /* Extracting bit difference info. */
3529  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
3530    othercasechar = cc + (othercasebit >> 8);    othercasechar = cc + (othercasebit >> 8);
3531    othercasebit &= 0xff;    othercasebit &= 0xff;
3532  #else  #elif defined COMPILE_PCRE16 || defined COMPILE_PCRE32
3533  #ifdef COMPILE_PCRE16    /* Note that this code only handles characters in the BMP. If there
3534      ever are characters outside the BMP whose othercase differs in only one
3535      bit from itself (there currently are none), this code will need to be
3536      revised for COMPILE_PCRE32. */
3537    othercasechar = cc + (othercasebit >> 9);    othercasechar = cc + (othercasebit >> 9);
3538    if ((othercasebit & 0x100) != 0)    if ((othercasebit & 0x100) != 0)
3539      othercasebit = (othercasebit & 0xff) << 8;      othercasebit = (othercasebit & 0xff) << 8;
3540    else    else
3541      othercasebit &= 0xff;      othercasebit &= 0xff;
3542  #endif  #endif /* COMPILE_PCRE[8|16|32] */
 #endif  
3543    }    }
3544    
3545  if (context->sourcereg == -1)  if (context->sourcereg == -1)
3546    {    {
3547  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
3548  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
3549    if (context->length >= 4)    if (context->length >= 4)
3550      OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
# Line 3511  if (context->sourcereg == -1) Line 3553  if (context->sourcereg == -1)
3553    else    else
3554  #endif  #endif
3555      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
3556  #else  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
3557  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED  #if defined SLJIT_UNALIGNED && SLJIT_UNALIGNED
3558    if (context->length >= 4)    if (context->length >= 4)
3559      OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(SLJIT_MOV_SI, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
3560    else    else
3561  #endif  #endif
3562      OP1(SLJIT_MOV_UH, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
3563  #endif  #elif defined COMPILE_PCRE32
3564  #endif /* COMPILE_PCRE8 */    OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), -context->length);
3565    #endif /* COMPILE_PCRE[8|16|32] */
3566    context->sourcereg = TMP2;    context->sourcereg = TMP2;
3567    }    }
3568    
# Line 3549  do Line 3591  do
3591      }      }
3592    context->ucharptr++;    context->ucharptr++;
3593    
3594  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
3595    if (context->ucharptr >= 4 || context->length == 0 || (context->ucharptr == 2 && context->length == 1))    if (context->ucharptr >= 4 || context->length == 0 || (context->ucharptr == 2 && context->length == 1))
3596  #else  #elif defined COMPILE_PCRE16
3597    if (context->ucharptr >= 2 || context->length == 0)    if (context->ucharptr >= 2 || context->length == 0)
3598    #elif defined COMPILE_PCRE32
3599      if (1 /* context->ucharptr >= 1 || context->length == 0 */)
3600  #endif  #endif
3601      {      {
3602    #if defined COMPILE_PCRE8 || defined COMPILE_PCRE16
3603      if (context->length >= 4)      if (context->length >= 4)
3604        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);
3605  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
3606      else if (context->length >= 2)      else if (context->length >= 2)
3607        OP1(SLJIT_MOV_UH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);        OP1(SLJIT_MOV_UH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
3608      else if (context->length >= 1)      else if (context->length >= 1)
3609        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);
3610  #else  #elif defined COMPILE_PCRE16
3611      else if (context->length >= 2)      else if (context->length >= 2)
3612        OP1(SLJIT_MOV_UH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);        OP1(SLJIT_MOV_UH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
3613  #endif  #endif /* COMPILE_PCRE[8|16] */
3614    #elif defined COMPILE_PCRE32
3615        OP1(MOV_UCHAR, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
3616    #endif /* COMPILE_PCRE[8|16|32] */
3617      context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;      context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;
3618    
3619      switch(context->ucharptr)      switch(context->ucharptr)
# Line 3576  do Line 3624  do
3624        add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asint | context->oc.asint));        add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, context->sourcereg, 0, SLJIT_IMM, context->c.asint | context->oc.asint));
3625        break;        break;
3626    
3627    #if defined COMPILE_PCRE8 || defined COMPILE_PCRE16
3628        case 2 / sizeof(pcre_uchar):        case 2 / sizeof(pcre_uchar):
3629        if (context->oc.asushort != 0)        if (context->oc.asushort != 0)
3630          OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, context->oc.asushort);          OP2(SLJIT_OR, context->sourcereg, 0, context->sourcereg, 0, SLJIT_IMM, context->oc.asushort);
# Line 3590  do Line 3639  do
3639        break;        break;
3640  #endif  #endif
3641    
3642    #endif /* COMPILE_PCRE[8|16] */
3643    
3644        default:        default:
3645        SLJIT_ASSERT_STOP();        SLJIT_ASSERT_STOP();
3646        break;        break;
# Line 3600  do Line 3651  do
3651  #else  #else
3652    
3653    /* Unaligned read is unsupported. */    /* Unaligned read is unsupported. */
 #ifdef COMPILE_PCRE8  
3654    if (context->length > 0)    if (context->length > 0)
3655      OP1(SLJIT_MOV_UB, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);      OP1(MOV_UCHAR, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);
3656  #else  
   if (context->length > 0)  
     OP1(SLJIT_MOV_UH, context->sourcereg, 0, SLJIT_MEM1(STR_PTR), -context->length);  
 #endif  
3657    context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;    context->sourcereg = context->sourcereg == TMP1 ? TMP2 : TMP1;
3658    
3659    if (othercasebit != 0 && othercasechar == cc)    if (othercasebit != 0 && othercasechar == cc)
# Line 3656  static void compile_xclass_matchingpath( Line 3703  static void compile_xclass_matchingpath(
3703  DEFINE_COMPILER;  DEFINE_COMPILER;
3704  jump_list *found = NULL;  jump_list *found = NULL;
3705  jump_list **list = (*cc & XCL_NOT) == 0 ? &found : backtracks;  jump_list **list = (*cc & XCL_NOT) == 0 ? &found : backtracks;
3706  unsigned int c;  pcre_int32 c, charoffset;
3707  int compares;  const pcre_uint32 *other_cases;
3708  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
3709  pcre_uchar *ccbegin;  pcre_uchar *ccbegin;
3710    int compares, invertcmp, numberofcmps;
3711  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
3712  BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;  BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;
3713  BOOL charsaved = FALSE;  BOOL charsaved = FALSE;
3714  int typereg = TMP1, scriptreg = TMP1;  int typereg = TMP1, scriptreg = TMP1;
3715  unsigned int typeoffset;  pcre_int32 typeoffset;
3716  #endif  #endif
 int invertcmp, numberofcmps;  
 unsigned int charoffset;  
3717    
3718  /* Although SUPPORT_UTF must be defined, we are  /* Although SUPPORT_UTF must be defined, we are
3719     not necessary in utf mode even in 8 bit mode. */     not necessary in utf mode even in 8 bit mode. */
# Line 3765  while (*cc != XCL_END) Line 3811  while (*cc != XCL_END)
3811        needschar = TRUE;        needschar = TRUE;
3812        break;        break;
3813    
3814          case PT_CLIST:
3815          needschar = TRUE;
3816          break;
3817    
3818        default:        default:
3819        SLJIT_ASSERT_STOP();        SLJIT_ASSERT_STOP();
3820        break;        break;
# Line 3974  while (*cc != XCL_END) Line 4024  while (*cc != XCL_END)
4024        COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_LESS_EQUAL);        COND_VALUE(SLJIT_OR | SLJIT_SET_E, TMP2, 0, SLJIT_C_LESS_EQUAL);
4025        jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);        jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
4026        break;        break;
4027    
4028          case PT_CLIST:
4029          other_cases = PRIV(ucd_caseless_sets) + cc[1];
4030    
4031          /* At least three characters are required.
4032             Otherwise this case would be handled by the normal code path. */
4033          SLJIT_ASSERT(other_cases[0] != NOTACHAR && other_cases[1] != NOTACHAR && other_cases[2] != NOTACHAR);
4034          SLJIT_ASSERT(other_cases[0] < other_cases[1] && other_cases[1] < other_cases[2]);
4035    
4036          /* Optimizing character pairs, if their difference is power of 2. */
4037          if (is_powerof2(other_cases[1] ^ other_cases[0]))
4038            {
4039            if (charoffset == 0)
4040              OP2(SLJIT_OR, TMP2, 0, TMP1, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]);
4041            else
4042              {
4043              OP2(SLJIT_ADD, TMP2, 0, TMP1, 0, SLJIT_IMM, (sljit_w)charoffset);
4044              OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]);
4045              }
4046            OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[1]);
4047            COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_EQUAL);
4048            other_cases += 2;
4049            }
4050          else if (is_powerof2(other_cases[2] ^ other_cases[1]))
4051            {
4052            if (charoffset == 0)
4053              OP2(SLJIT_OR, TMP2, 0, TMP1, 0, SLJIT_IMM, other_cases[2] ^ other_cases[1]);
4054            else
4055              {
4056              OP2(SLJIT_ADD, TMP2, 0, TMP1, 0, SLJIT_IMM, (sljit_w)charoffset);
4057              OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]);
4058              }
4059            OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[2]);
4060            COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_EQUAL);
4061    
4062            OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, other_cases[0] - charoffset);
4063            COND_VALUE(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, SLJIT_C_EQUAL);
4064    
4065            other_cases += 3;
4066            }
4067          else
4068            {
4069            OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, *other_cases++ - charoffset);
4070            COND_VALUE(SLJIT_MOV, TMP2, 0, SLJIT_C_EQUAL);
4071            }
4072    
4073          while (*other_cases != NOTACHAR)
4074            {
4075            OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, *other_cases++ - charoffset);
4076            COND_VALUE(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, SLJIT_C_EQUAL);
4077            }
4078          jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
4079          break;
4080        }        }
4081      cc += 2;      cc += 2;
4082      }      }
# Line 4089  switch(type) Line 4192  switch(type)
4192      {      {
4193      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);      OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
4194      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
4195  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8 || defined COMPILE_PCRE16
4196    #if defined COMPILE_PCRE8
4197      jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);      jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
4198      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)PRIV(utf8_table4) - 0xc0);
4199      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
4200  #else /* COMPILE_PCRE8 */  #elif defined COMPILE_PCRE16
 #ifdef COMPILE_PCRE16  
4201      jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);      jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
4202      OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);      OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
4203      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);      OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
4204      COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);      COND_VALUE(SLJIT_MOV, TMP1, 0, SLJIT_C_EQUAL);
4205      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);      OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
4206      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
4207  #endif /* COMPILE_PCRE16 */  #endif
 #endif /* COMPILE_PCRE8 */  
4208      JUMPHERE(jump[0]);      JUMPHERE(jump[0]);
4209    #endif /* COMPILE_PCRE[8|16] */
4210      return cc;      return cc;
4211      }      }
4212  #endif  #endif
# Line 4170  switch(type) Line 4273  switch(type)
4273    detect_partial_match(common, backtracks);    detect_partial_match(common, backtracks);
4274    read_char(common);    read_char(common);
4275    add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
4276    OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Mc);    OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_w)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, gbprop));
4277    add_jump(compiler, backtracks, CMP(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, ucp_Mn - ucp_Mc));    /* Optimize register allocation: use a real register. */
4278      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0);
4279      OP1(SLJIT_MOV_UB, STACK_TOP, 0, SLJIT_MEM2(TMP1, TMP2), 3);
4280    
4281    label = LABEL();    label = LABEL();
4282    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);
4283    OP1(SLJIT_MOV, TMP3, 0, STR_PTR, 0);    OP1(SLJIT_MOV, TMP3, 0, STR_PTR, 0);
4284    read_char(common);    read_char(common);
4285    add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
4286    OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Mc);    OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_w)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, gbprop));
4287    CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, ucp_Mn - ucp_Mc, label);    OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM2(TMP1, TMP2), 3);
4288    
4289      OP2(SLJIT_SHL, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2);
4290      OP1(SLJIT_MOV_UI, TMP1, 0, SLJIT_MEM1(STACK_TOP), (sljit_w)PRIV(ucp_gbtable));
4291      OP1(SLJIT_MOV, STACK_TOP, 0, TMP2, 0);
4292      OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
4293      OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
4294      JUMPTO(SLJIT_C_NOT_ZERO, label);
4295    
4296    OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0);    OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0);
4297    JUMPHERE(jump[0]);    JUMPHERE(jump[0]);
4298      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);
4299    
4300    if (common->mode == JIT_PARTIAL_HARD_COMPILE)    if (common->mode == JIT_PARTIAL_HARD_COMPILE)
4301      {      {
4302      jump[0] = CMP(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0);      jump[0] = CMP(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0);
# Line 4388  switch(type) Line 4502  switch(type)
4502      }      }
4503    oc = char_othercase(common, c);    oc = char_othercase(common, c);
4504    bit = c ^ oc;    bit = c ^ oc;
4505    if (ispowerof2(bit))    if (is_powerof2(bit))
4506      {      {
4507      OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, bit);      OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, bit);
4508      add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, c | bit));      add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, c | bit));
# Line 4449  switch(type) Line 4563  switch(type)
4563      {      {
4564      oc = char_othercase(common, c);      oc = char_othercase(common, c);
4565      bit = c ^ oc;      bit = c ^ oc;
4566      if (ispowerof2(bit))      if (is_powerof2(bit))
4567        {        {
4568        OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, bit);        OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, bit);
4569        add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, c | bit));        add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, c | bit));
# Line 4497  switch(type) Line 4611  switch(type)
4611  #endif /* SUPPORT_UTF || !COMPILE_PCRE8 */  #endif /* SUPPORT_UTF || !COMPILE_PCRE8 */
4612    return cc + 32 / sizeof(pcre_uchar);    return cc + 32 / sizeof(pcre_uchar);
4613    
4614  #if defined SUPPORT_UTF || defined COMPILE_PCRE16  #if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
4615    case OP_XCLASS:    case OP_XCLASS:
4616    compile_xclass_matchingpath(common, cc + LINK_SIZE, backtracks);    compile_xclass_matchingpath(common, cc + LINK_SIZE, backtracks);
4617    return cc + GET(cc, 0) - 1;    return cc + GET(cc, 0) - 1;
# Line 4940  static pcre_uchar *compile_assert_matchi Line 5054  static pcre_uchar *compile_assert_matchi
5054  {  {
5055  DEFINE_COMPILER;  DEFINE_COMPILER;
5056  int framesize;  int framesize;
5057  int localptr;  int private_data_ptr;
5058  backtrack_common altbacktrack;  backtrack_common altbacktrack;
5059  pcre_uchar *ccbegin;  pcre_uchar *ccbegin;
5060  pcre_uchar opcode;  pcre_uchar opcode;
# Line 4962  if (*cc == OP_BRAZERO || *cc == OP_BRAMI Line 5076  if (*cc == OP_BRAZERO || *cc == OP_BRAMI
5076    bra = *cc;    bra = *cc;
5077    cc++;    cc++;
5078    }    }
5079  localptr = PRIV_DATA(cc);  private_data_ptr = PRIVATE_DATA(cc);
5080  SLJIT_ASSERT(localptr != 0);  SLJIT_ASSERT(private_data_ptr != 0);
5081  framesize = get_framesize(common, cc, FALSE);  framesize = get_framesize(common, cc, FALSE);
5082  backtrack->framesize = framesize;  backtrack->framesize = framesize;
5083  backtrack->localptr = localptr;  backtrack->private_data_ptr = private_data_ptr;
5084  opcode = *cc;  opcode = *cc;
5085  SLJIT_ASSERT(opcode >= OP_ASSERT && opcode <= OP_ASSERTBACK_NOT);  SLJIT_ASSERT(opcode >= OP_ASSERT && opcode <= OP_ASSERTBACK_NOT);
5086  found = (opcode == OP_ASSERT || opcode == OP_ASSERTBACK) ? &tmp : target;  found = (opcode == OP_ASSERT || opcode == OP_ASSERTBACK) ? &tmp : target;
# Line 4983  if (bra == OP_BRAMINZERO) Line 5097  if (bra == OP_BRAMINZERO)
5097    
5098  if (framesize < 0)  if (framesize < 0)
5099    {    {
5100    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, STACK_TOP, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0);
5101    allocate_stack(common, 1);    allocate_stack(common, 1);
5102    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
5103    }    }
5104  else  else
5105    {    {
5106    allocate_stack(common, framesize + 2);    allocate_stack(common, framesize + 2);
5107    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5108    OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, -STACK(framesize + 1));    OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, -STACK(framesize + 1));
5109    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, TMP2, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP2, 0);
5110    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
5111    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0);
5112    init_frame(common, ccbegin, framesize + 1, 2, FALSE);    init_frame(common, ccbegin, framesize + 1, 2, FALSE);
# Line 5027  while (1) Line 5141  while (1)
5141    
5142    /* Reset stack. */    /* Reset stack. */
5143    if (framesize < 0)    if (framesize < 0)
5144      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5145    else {    else {
5146      if ((opcode != OP_ASSERT_NOT && opcode != OP_ASSERTBACK_NOT) || conditional)      if ((opcode != OP_ASSERT_NOT && opcode != OP_ASSERTBACK_NOT) || conditional)
5147        {        {
5148        /* We don't need to keep the STR_PTR, only the previous localptr. */        /* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
5149        OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_w));        OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_w));
5150        }        }
5151      else      else
5152        {        {
5153        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5154        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
5155        }        }
5156    }    }
# Line 5054  while (1) Line 5168  while (1)
5168          {          {
5169          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_w));          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_w));
5170          OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (framesize + 1) * sizeof(sljit_w));          OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (framesize + 1) * sizeof(sljit_w));
5171          OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, TMP1, 0);          OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP1, 0);
5172          }          }
5173        OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_w));        OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_w));
5174        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
# Line 5062  while (1) Line 5176  while (1)
5176      else if (framesize >= 0)      else if (framesize >= 0)
5177        {        {
5178        /* For OP_BRA and OP_BRAMINZERO. */        /* For OP_BRA and OP_BRAMINZERO. */
5179        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_w));        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_w));
5180        }        }
5181      }      }
5182    add_jump(compiler, found, JUMP(SLJIT_JUMP));    add_jump(compiler, found, JUMP(SLJIT_JUMP));
# Line 5113  if (opcode == OP_ASSERT || opcode == OP_ Line 5227  if (opcode == OP_ASSERT || opcode == OP_
5227        }        }
5228      else      else
5229        free_stack(common, framesize + 2);        free_stack(common, framesize + 2);
5230      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, TMP1, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP1, 0);
5231      }      }
5232    jump = JUMP(SLJIT_JUMP);    jump = JUMP(SLJIT_JUMP);
5233    if (bra != OP_BRAZERO)    if (bra != OP_BRAZERO)
# Line 5138  if (opcode == OP_ASSERT || opcode == OP_ Line 5252  if (opcode == OP_ASSERT || opcode == OP_
5252      {      {
5253      if (bra == OP_BRA)      if (bra == OP_BRA)
5254        {        {
5255        /* We don't need to keep the STR_PTR, only the previous localptr. */        /* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
5256        OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_w));        OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_w));
5257        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), 0);        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), 0);
5258        }        }
5259      else      else
5260        {        {
5261        /* We don't need to keep the STR_PTR, only the previous localptr. */        /* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
5262        OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_IMM, (framesize + 2) * sizeof(sljit_w));        OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, (framesize + 2) * sizeof(sljit_w));
5263        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
5264        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), bra == OP_BRAZERO ? STR_PTR : SLJIT_IMM, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), bra == OP_BRAZERO ? STR_PTR : SLJIT_IMM, 0);
5265        }        }
# Line 5162  if (opcode == OP_ASSERT || opcode == OP_ Line 5276  if (opcode == OP_ASSERT || opcode == OP_
5276      JUMPHERE(brajump);      JUMPHERE(brajump);
5277      if (framesize >= 0)      if (framesize >= 0)
5278        {        {
5279        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5280        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
5281        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_w));        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_w));
5282        }        }
5283      set_jumps(backtrack->common.topbacktracks, LABEL());      set_jumps(backtrack->common.topbacktracks, LABEL());
5284      }      }
# Line 5192  else Line 5306  else
5306        }        }
5307      else      else
5308        free_stack(common, framesize + 2);        free_stack(common, framesize + 2);
5309      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, TMP1, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP1, 0);
5310      }      }
5311    
5312    if (bra == OP_BRAZERO)    if (bra == OP_BRAZERO)
# Line 5218  common->accept = save_accept; Line 5332  common->accept = save_accept;
5332  return cc + 1 + LINK_SIZE;  return cc + 1 + LINK_SIZE;
5333  }  }
5334    
5335  static sljit_w SLJIT_CALL do_searchovector(sljit_w refno, sljit_w* locals, pcre_uchar *name_table)  static sljit_w SLJIT_CALL do_searchovector(sljit_uw refno, sljit_w* locals, pcre_uchar *name_table)
5336  {  {
5337  int condition = FALSE;  int condition = FALSE;
5338  pcre_uchar *slotA = name_table;  pcre_uchar *slotA = name_table;
# Line 5275  if (i < name_count) Line 5389  if (i < name_count)
5389  return condition;  return condition;
5390  }  }
5391    
5392  static sljit_w SLJIT_CALL do_searchgroups(sljit_w recno, sljit_w* locals, pcre_uchar *name_table)  static sljit_w SLJIT_CALL do_searchgroups(sljit_uw recno, sljit_uw* locals, pcre_uchar *name_table)
5393  {  {
5394  int condition = FALSE;  int condition = FALSE;
5395  pcre_uchar *slotA = name_table;  pcre_uchar *slotA = name_table;
5396  pcre_uchar *slotB;  pcre_uchar *slotB;
5397  sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)];  sljit_uw name_count = locals[LOCALS0 / sizeof(sljit_w)];
5398  sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];  sljit_uw name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];
5399  sljit_w group_num = locals[POSSESSIVE0 / sizeof(sljit_w)];  sljit_uw group_num = locals[POSSESSIVE0 / sizeof(sljit_w)];
5400  int i;  sljit_uw i;
5401    
5402  for (i = 0; i < name_count; i++)  for (i = 0; i < name_count; i++)
5403    {    {
# Line 5387  static pcre_uchar *compile_bracket_match Line 5501  static pcre_uchar *compile_bracket_match
5501  DEFINE_COMPILER;  DEFINE_COMPILER;
5502  backtrack_common *backtrack;  backtrack_common *backtrack;
5503  pcre_uchar opcode;  pcre_uchar opcode;
5504  int localptr = 0;  int private_data_ptr = 0;
5505  int offset = 0;  int offset = 0;
5506  int stacksize;  int stacksize;
5507  pcre_uchar *ccbegin;  pcre_uchar *ccbegin;
# Line 5438  if (SLJIT_UNLIKELY(opcode == OP_COND) || Line 5552  if (SLJIT_UNLIKELY(opcode == OP_COND) ||
5552      else if (common->currententry->start == 0)      else if (common->currententry->start == 0)
5553        has_alternatives = stacksize != 0;        has_alternatives = stacksize != 0;
5554      else      else
5555        has_alternatives = stacksize != GET2(common->start, common->currententry->start + 1 + LINK_SIZE);        has_alternatives = stacksize != (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);
5556      }      }
5557    }    }
5558    
# Line 5451  if (opcode == OP_CBRA || opcode == OP_SC Line 5565  if (opcode == OP_CBRA || opcode == OP_SC
5565    {    {
5566    /* Capturing brackets has a pre-allocated space. */    /* Capturing brackets has a pre-allocated space. */
5567    offset = GET2(ccbegin, 1 + LINK_SIZE);    offset = GET2(ccbegin, 1 + LINK_SIZE);
5568    localptr = OVECTOR_PRIV(offset);    if (common->optimized_cbracket[offset] == 0)
5569    offset <<= 1;      {
5570    BACKTRACK_AS(bracket_backtrack)->localptr = localptr;      private_data_ptr = OVECTOR_PRIV(offset);
5571        offset <<= 1;
5572        }
5573      else
5574        {
5575        offset <<= 1;
5576        private_data_ptr = OVECTOR(offset);
5577        }
5578      BACKTRACK_AS(bracket_backtrack)->private_data_ptr = private_data_ptr;
5579    matchingpath += IMM2_SIZE;    matchingpath += IMM2_SIZE;
5580    }    }
5581  else if (opcode == OP_ONCE || opcode == OP_SBRA || opcode == OP_SCOND)  else if (opcode == OP_ONCE || opcode == OP_SBRA || opcode == OP_SCOND)
5582    {    {
5583    /* Other brackets simply allocate the next entry. */    /* Other brackets simply allocate the next entry. */
5584    localptr = PRIV_DATA(ccbegin);    private_data_ptr = PRIVATE_DATA(ccbegin);
5585    SLJIT_ASSERT(localptr != 0);    SLJIT_ASSERT(private_data_ptr != 0);
5586    BACKTRACK_AS(bracket_backtrack)->localptr = localptr;    BACKTRACK_AS(bracket_backtrack)->private_data_ptr = private_data_ptr;
5587    if (opcode == OP_ONCE)    if (opcode == OP_ONCE)
5588      BACKTRACK_AS(bracket_backtrack)->u.framesize = get_framesize(common, ccbegin, FALSE);      BACKTRACK_AS(bracket_backtrack)->u.framesize = get_framesize(common, ccbegin, FALSE);
5589    }    }
# Line 5507  if (bra == OP_BRAMINZERO) Line 5629  if (bra == OP_BRAMINZERO)
5629        /* Checking zero-length iteration. */        /* Checking zero-length iteration. */
5630        if (opcode != OP_ONCE || BACKTRACK_AS(bracket_backtrack)->u.framesize < 0)        if (opcode != OP_ONCE || BACKTRACK_AS(bracket_backtrack)->u.framesize < 0)
5631          {          {
5632          /* When we come from outside, localptr contains the previous STR_PTR. */          /* When we come from outside, private_data_ptr contains the previous STR_PTR. */
5633          braminzerojump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);          braminzerojump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5634          }          }
5635        else        else
5636          {          {
5637          /* Except when the whole stack frame must be saved. */          /* Except when the whole stack frame must be saved. */
5638          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5639          braminzerojump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (BACKTRACK_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_w));          braminzerojump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (BACKTRACK_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_w));
5640          }          }
5641        JUMPHERE(skip);        JUMPHERE(skip);
# Line 5545  if (opcode == OP_ONCE) Line 5667  if (opcode == OP_ONCE)
5667      /* Neither capturing brackets nor recursions are not found in the block. */      /* Neither capturing brackets nor recursions are not found in the block. */
5668      if (ket == OP_KETRMIN)      if (ket == OP_KETRMIN)
5669        {        {
5670        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5671        allocate_stack(common, 2);        allocate_stack(common, 2);
5672        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
5673        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP2, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP2, 0);
5674        OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_w));        OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_w));
5675        }        }
5676      else if (ket == OP_KETRMAX || has_alternatives)      else if (ket == OP_KETRMAX || has_alternatives)
5677        {        {
5678        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, STACK_TOP, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0);
5679        allocate_stack(common, 1);        allocate_stack(common, 1);
5680        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
5681        }        }
5682      else      else
5683        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, STACK_TOP, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0);
5684      }      }
5685    else    else
5686      {      {
5687      if (ket == OP_KETRMIN || ket == OP_KETRMAX || has_alternatives)      if (ket == OP_KETRMIN || ket == OP_KETRMAX || has_alternatives)
5688        {        {
5689        allocate_stack(common, BACKTRACK_AS(bracket_backtrack)->u.framesize + 2);        allocate_stack(common, BACKTRACK_AS(bracket_backtrack)->u.framesize + 2);
5690        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5691        OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, -STACK(BACKTRACK_AS(bracket_backtrack)->u.framesize + 1));        OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, -STACK(BACKTRACK_AS(bracket_backtrack)->u.framesize + 1));
5692        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
5693        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, TMP2, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP2, 0);
5694        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0);
5695        init_frame(common, ccbegin, BACKTRACK_AS(bracket_backtrack)->u.framesize + 1, 2, FALSE);        init_frame(common, ccbegin, BACKTRACK_AS(bracket_backtrack)->u.framesize + 1, 2, FALSE);
5696        }        }
5697      else      else
5698        {        {
5699        allocate_stack(common, BACKTRACK_AS(bracket_backtrack)->u.framesize + 1);        allocate_stack(common, BACKTRACK_AS(bracket_backtrack)->u.framesize + 1);
5700        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5701        OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, -STACK(BACKTRACK_AS(bracket_backtrack)->u.framesize));        OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, -STACK(BACKTRACK_AS(bracket_backtrack)->u.framesize));
5702        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, TMP2, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP2, 0);
5703        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0);
5704        init_frame(common, ccbegin, BACKTRACK_AS(bracket_backtrack)->u.framesize, 1, FALSE);        init_frame(common, ccbegin, BACKTRACK_AS(bracket_backtrack)->u.framesize, 1, FALSE);
5705        }        }
# Line 5586  if (opcode == OP_ONCE) Line 5708  if (opcode == OP_ONCE)
5708  else if (opcode == OP_CBRA || opcode == OP_SCBRA)  else if (opcode == OP_CBRA || opcode == OP_SCBRA)
5709    {    {
5710    /* Saving the previous values. */    /* Saving the previous values. */
5711    allocate_stack(common, 3);    if (common->optimized_cbracket[offset >> 1] == 0)
5712    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));      {
5713    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));      allocate_stack(common, 3);
5714    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0);      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
5715    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP2, 0);      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
5716    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0);
5717    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, STR_PTR, 0);      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5718    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), TMP1, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP2, 0);
5719        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STR_PTR, 0);
5720        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), TMP1, 0);
5721        }
5722      else
5723        {
5724        SLJIT_ASSERT(private_data_ptr == OVECTOR(offset));
5725        allocate_stack(common, 2);
5726        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5727        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr + sizeof(sljit_w));
5728        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STR_PTR, 0);
5729        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0);
5730        OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP2, 0);
5731        }
5732    }    }
5733  else if (opcode == OP_SBRA || opcode == OP_SCOND)  else if (opcode == OP_SBRA || opcode == OP_SCOND)
5734    {    {
5735    /* Saving the previous value. */    /* Saving the previous value. */
5736    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5737    allocate_stack(common, 1);    allocate_stack(common, 1);
5738    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STR_PTR, 0);
5739    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
5740    }    }
5741  else if (has_alternatives)  else if (has_alternatives)
# Line 5652  if (opcode == OP_COND || opcode == OP_SC Line 5787  if (opcode == OP_COND || opcode == OP_SC
5787      else if (common->currententry->start == 0)      else if (common->currententry->start == 0)
5788        stacksize = stacksize == 0;        stacksize = stacksize == 0;
5789      else      else
5790        stacksize = stacksize == GET2(common->start, common->currententry->start + 1 + LINK_SIZE);        stacksize = stacksize == (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);
5791    
5792      if (*matchingpath == OP_RREF || stacksize || common->currententry == NULL)      if (*matchingpath == OP_RREF || stacksize || common->currententry == NULL)
5793        {        {
# Line 5710  if (opcode == OP_ONCE) Line 5845  if (opcode == OP_ONCE)
5845    {    {
5846    if (BACKTRACK_AS(bracket_backtrack)->u.framesize < 0)    if (BACKTRACK_AS(bracket_backtrack)->u.framesize < 0)
5847      {      {
5848      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5849      /* TMP2 which is set here used by OP_KETRMAX below. */      /* TMP2 which is set here used by OP_KETRMAX below. */
5850      if (ket == OP_KETRMAX)      if (ket == OP_KETRMAX)
5851        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), 0);        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), 0);
5852      else if (ket == OP_KETRMIN)      else if (ket == OP_KETRMIN)
5853        {        {
5854        /* Move the STR_PTR to the localptr. */        /* Move the STR_PTR to the private_data_ptr. */
5855        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_MEM1(STACK_TOP), 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_MEM1(STACK_TOP), 0);
5856        }        }
5857      }      }
5858    else    else
5859      {      {
5860      stacksize = (ket == OP_KETRMIN || ket == OP_KETRMAX || has_alternatives) ? 2 : 1;      stacksize = (ket == OP_KETRMIN || ket == OP_KETRMAX || has_alternatives) ? 2 : 1;
5861      OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_IMM, (BACKTRACK_AS(bracket_backtrack)->u.framesize + stacksize) * sizeof(sljit_w));      OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, (BACKTRACK_AS(bracket_backtrack)->u.framesize + stacksize) * sizeof(sljit_w));
5862      if (ket == OP_KETRMAX)      if (ket == OP_KETRMAX)
5863        {        {
5864        /* TMP2 which is set here used by OP_KETRMAX below. */        /* TMP2 which is set here used by OP_KETRMAX below. */
# Line 5764  if (has_alternatives) Line 5899  if (has_alternatives)
5899  /* Must be after the matchingpath label. */  /* Must be after the matchingpath label. */
5900  if (offset != 0)  if (offset != 0)
5901    {    {
5902    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5903    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);
5904    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 0), TMP1, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 0), TMP1, 0);
5905    }    }
# Line 5778  if (ket == OP_KETRMAX) Line 5913  if (ket == OP_KETRMAX)
5913      /* Checking zero-length iteration. */      /* Checking zero-length iteration. */
5914      if (opcode != OP_ONCE)      if (opcode != OP_ONCE)
5915        {        {
5916        CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, STR_PTR, 0, rmaxlabel);        CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STR_PTR, 0, rmaxlabel);
5917        /* Drop STR_PTR for greedy plus quantifier. */        /* Drop STR_PTR for greedy plus quantifier. */
5918        if (bra != OP_BRAZERO)        if (bra != OP_BRAZERO)
5919          free_stack(common, 1);          free_stack(common, 1);
# Line 5807  if (bra == OP_BRAMINZERO) Line 5942  if (bra == OP_BRAMINZERO)
5942      framesize is < 0, OP_ONCE will do the release itself. */      framesize is < 0, OP_ONCE will do the release itself. */
5943      if (opcode == OP_ONCE && BACKTRACK_AS(bracket_backtrack)->u.framesize >= 0)      if (opcode == OP_ONCE && BACKTRACK_AS(bracket_backtrack)->u.framesize >= 0)
5944        {        {
5945        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);        OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
5946        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
5947        }        }
5948      else if (ket == OP_KETRMIN && opcode != OP_ONCE)      else if (ket == OP_KETRMIN && opcode != OP_ONCE)
# Line 5831  static pcre_uchar *compile_bracketpos_ma Line 5966  static pcre_uchar *compile_bracketpos_ma
5966  DEFINE_COMPILER;  DEFINE_COMPILER;
5967  backtrack_common *backtrack;  backtrack_common *backtrack;
5968  pcre_uchar opcode;  pcre_uchar opcode;
5969  int localptr;  int private_data_ptr;
5970  int cbraprivptr = 0;  int cbraprivptr = 0;
5971  int framesize;  int framesize;
5972  int stacksize;  int stacksize;
# Line 5850  if (*cc == OP_BRAPOSZERO) Line 5985  if (*cc == OP_BRAPOSZERO)
5985    }    }
5986    
5987  opcode = *cc;  opcode = *cc;
5988  localptr = PRIV_DATA(cc);  private_data_ptr = PRIVATE_DATA(cc);
5989  SLJIT_ASSERT(localptr != 0);  SLJIT_ASSERT(private_data_ptr != 0);
5990  BACKTRACK_AS(bracketpos_backtrack)->localptr = localptr;  BACKTRACK_AS(bracketpos_backtrack)->private_data_ptr = private_data_ptr;
5991  switch(opcode)  switch(opcode)
5992    {    {
5993    case OP_BRAPOS:    case OP_BRAPOS:
# Line 5863  switch(opcode) Line 5998  switch(opcode)
5998    case OP_CBRAPOS:    case OP_CBRAPOS:
5999    case OP_SCBRAPOS:    case OP_SCBRAPOS:
6000    offset = GET2(cc, 1 + LINK_SIZE);    offset = GET2(cc, 1 + LINK_SIZE);
6001      /* This case cannot be optimized in the same was as
6002      normal capturing brackets. */
6003      SLJIT_ASSERT(common->optimized_cbracket[offset] == 0);
6004    cbraprivptr = OVECTOR_PRIV(offset);    cbraprivptr = OVECTOR_PRIV(offset);
6005    offset <<= 1;    offset <<= 1;
6006    ccbegin = cc + 1 + LINK_SIZE + IMM2_SIZE;    ccbegin = cc + 1 + LINK_SIZE + IMM2_SIZE;
# Line 5882  if (framesize < 0) Line 6020  if (framesize < 0)
6020      stacksize++;      stacksize++;
6021    BACKTRACK_AS(bracketpos_backtrack)->stacksize = stacksize;    BACKTRACK_AS(bracketpos_backtrack)->stacksize = stacksize;
6022    allocate_stack(common, stacksize);    allocate_stack(common, stacksize);
6023    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, STACK_TOP, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0);
6024    
6025    if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)    if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)
6026      {      {
# Line 5907  else Line 6045  else
6045    BACKTRACK_AS(bracketpos_backtrack)->stacksize = stacksize;    BACKTRACK_AS(bracketpos_backtrack)->stacksize = stacksize;
6046    allocate_stack(common, stacksize);    allocate_stack(common, stacksize);
6047    
6048    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
6049    OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, -STACK(stacksize - 1));    OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, -STACK(stacksize - 1));
6050    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, TMP2, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP2, 0);
6051    stack = 0;    stack = 0;
6052    if (!zero)    if (!zero)
6053      {      {
# Line 5941  while (*cc != OP_KETRPOS) Line 6079  while (*cc != OP_KETRPOS)
6079    
6080    if (framesize < 0)    if (framesize < 0)
6081      {      {
6082      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
6083    
6084      if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)      if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)
6085        {        {
# Line 5967  while (*cc != OP_KETRPOS) Line 6105  while (*cc != OP_KETRPOS)
6105      {      {
6106      if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)      if (opcode == OP_CBRAPOS || opcode == OP_SCBRAPOS)
6107        {        {
6108        OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_IMM, stacksize * sizeof(sljit_w));        OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, stacksize * sizeof(sljit_w));
6109        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr);        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr);
6110        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);
6111        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr, STR_PTR, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr, STR_PTR, 0);
# Line 5975  while (*cc != OP_KETRPOS) Line 6113  while (*cc != OP_KETRPOS)
6113        }        }
6114      else      else
6115        {        {
6116        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
6117        OP2(SLJIT_ADD, STACK_TOP, 0, TMP2, 0, SLJIT_IMM, stacksize * sizeof(sljit_w));        OP2(SLJIT_ADD, STACK_TOP, 0, TMP2, 0, SLJIT_IMM, stacksize * sizeof(sljit_w));
6118        if (opcode == OP_SBRAPOS)        if (opcode == OP_SBRAPOS)
6119          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_w));          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_w));
# Line 6014  while (*cc != OP_KETRPOS) Line 6152  while (*cc != OP_KETRPOS)
6152        {        {
6153        /* Last alternative. */        /* Last alternative. */
6154        if (*cc == OP_KETRPOS)        if (*cc == OP_KETRPOS)
6155          OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);          OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
6156        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr);        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr);
6157        }        }
6158      else      else
6159        {        {
6160        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
6161        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_w));        OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_w));
6162        }        }
6163      }      }
# Line 6034  if (!zero) Line 6172  if (!zero)
6172    {    {
6173    if (framesize < 0)    if (framesize < 0)
6174      add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(stacksize - 1), SLJIT_IMM, 0));      add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(stacksize - 1), SLJIT_IMM, 0));
6175    else /* TMP2 is set to [localptr] above. */    else /* TMP2 is set to [private_data_ptr] above. */
6176      add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(TMP2), (stacksize - 1) * sizeof(sljit_w), SLJIT_IMM, 0));      add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(TMP2), (stacksize - 1) * sizeof(sljit_w), SLJIT_IMM, 0));
6177    }    }
6178    
# Line 6147  pcre_uchar* end; Line 6285  pcre_uchar* end;
6285  jump_list *nomatch = NULL;  jump_list *nomatch = NULL;
6286  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
6287  struct sljit_label *label;  struct sljit_label *label;
6288  int localptr = PRIV_DATA(cc);  int private_data_ptr = PRIVATE_DATA(cc);
6289  int base = (localptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_LOCALS_REG);  int base = (private_data_ptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_LOCALS_REG);
6290  int offset0 = (localptr == 0) ? STACK(0) : localptr;  int offset0 = (private_data_ptr == 0) ? STACK(0) : private_data_ptr;
6291  int offset1 = (localptr == 0) ? STACK(1) : localptr + (int)sizeof(sljit_w);  int offset1 = (private_data_ptr == 0) ? STACK(1) : private_data_ptr + (int)sizeof(sljit_w);
6292  int tmp_base, tmp_offset;  int tmp_base, tmp_offset;
6293    
6294  PUSH_BACKTRACK(sizeof(iterator_backtrack), cc, NULL);  PUSH_BACKTRACK(sizeof(iterator_backtrack), cc, NULL);
# Line 6204  switch(opcode) Line 6342  switch(opcode)
6342    case OP_CRRANGE:    case OP_CRRANGE:
6343    if (type == OP_ANYNL || type == OP_EXTUNI)    if (type == OP_ANYNL || type == OP_EXTUNI)
6344      {      {
6345      SLJIT_ASSERT(localptr == 0);      SLJIT_ASSERT(private_data_ptr == 0);
6346      if (opcode == OP_STAR || opcode == OP_UPTO)      if (opcode == OP_STAR || opcode == OP_UPTO)
6347        {        {
6348        allocate_stack(common, 2);        allocate_stack(common, 2);
# Line 6244  switch(opcode) Line 6382  switch(opcode)
6382      {      {
6383      if (opcode == OP_PLUS)      if (opcode == OP_PLUS)
6384        compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);        compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
6385      if (localptr == 0)      if (private_data_ptr == 0)
6386        allocate_stack(common, 2);        allocate_stack(common, 2);
6387      OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);      OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6388      if (opcode <= OP_PLUS)      if (opcode <= OP_PLUS)
# Line 6280  switch(opcode) Line 6418  switch(opcode)
6418    case OP_MINPLUS:    case OP_MINPLUS:
6419    if (opcode == OP_MINPLUS)    if (opcode == OP_MINPLUS)
6420      compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);      compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
6421    if (localptr == 0)    if (private_data_ptr == 0)
6422      allocate_stack(common, 1);      allocate_stack(common, 1);
6423    OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);    OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6424    BACKTRACK_AS(iterator_backtrack)->matchingpath = LABEL();    BACKTRACK_AS(iterator_backtrack)->matchingpath = LABEL();
# Line 6288  switch(opcode) Line 6426  switch(opcode)
6426    
6427    case OP_MINUPTO:    case OP_MINUPTO:
6428    case OP_CRMINRANGE:    case OP_CRMINRANGE:
6429    if (localptr == 0)    if (private_data_ptr == 0)
6430      allocate_stack(common, 2);      allocate_stack(common, 2);
6431    OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);    OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6432    OP1(SLJIT_MOV, base, offset1, SLJIT_IMM, 1);    OP1(SLJIT_MOV, base, offset1, SLJIT_IMM, 1);
# Line 6299  switch(opcode) Line 6437  switch(opcode)
6437    
6438    case OP_QUERY:    case OP_QUERY:
6439    case OP_MINQUERY:    case OP_MINQUERY:
6440    if (localptr == 0)    if (private_data_ptr == 0)
6441      allocate_stack(common, 1);      allocate_stack(common, 1);
6442    OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);    OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6443    if (opcode == OP_QUERY)    if (opcode == OP_QUERY)
# Line 6402  static SLJIT_INLINE pcre_uchar *compile_ Line 6540  static SLJIT_INLINE pcre_uchar *compile_
6540  {  {
6541  DEFINE_COMPILER;  DEFINE_COMPILER;
6542  int offset = GET2(cc, 1);  int offset = GET2(cc, 1);
6543    BOOL optimized_cbracket = common->optimized_cbracket[offset] != 0;
6544    
6545  /* Data will be discarded anyway... */  /* Data will be discarded anyway... */
6546  if (common->currententry != NULL)  if (common->currententry != NULL)
6547    return cc + 1 + IMM2_SIZE;    return cc + 1 + IMM2_SIZE;
6548    
6549  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR_PRIV(offset));  if (!optimized_cbracket)
6550      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR_PRIV(offset));
6551  offset <<= 1;  offset <<= 1;
6552  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);
6553  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);  if (!optimized_cbracket)
6554      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);
6555  return cc + 1 + IMM2_SIZE;  return cc + 1 + IMM2_SIZE;
6556  }  }
6557    
# Line 6549  while (cc < ccend) Line 6690  while (cc < ccend)
6690        cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);        cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
6691      break;      break;
6692    
6693  #if defined SUPPORT_UTF || defined COMPILE_PCRE16  #if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
6694      case OP_XCLASS:      case OP_XCLASS:
6695      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)
6696        cc = compile_iterator_matchingpath(common, cc, parent);        cc = compile_iterator_matchingpath(common, cc, parent);
# Line 6693  int arg1 = -1, arg2 = -1; Line 6834  int arg1 = -1, arg2 = -1;
6834  struct sljit_label *label = NULL;  struct sljit_label *label = NULL;
6835  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
6836  jump_list *jumplist = NULL;  jump_list *jumplist = NULL;
6837  int localptr = PRIV_DATA(cc);  int private_data_ptr = PRIVATE_DATA(cc);
6838  int base = (localptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_LOCALS_REG);  int base = (private_data_ptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_LOCALS_REG);
6839  int offset0 = (localptr == 0) ? STACK(0) : localptr;  int offset0 = (private_data_ptr == 0) ? STACK(0) : private_data_ptr;
6840  int offset1 = (localptr == 0) ? STACK(1) : localptr + (int)sizeof(sljit_w);  int offset1 = (private_data_ptr == 0) ? STACK(1) : private_data_ptr + (int)sizeof(sljit_w);
6841    
6842  cc = get_iterator_parameters(common, cc, &opcode, &type, &arg1, &arg2, NULL);  cc = get_iterator_parameters(common, cc, &opcode, &type, &arg1, &arg2, NULL);
6843    
# Line 6708  switch(opcode) Line 6849  switch(opcode)
6849    case OP_CRRANGE:    case OP_CRRANGE:
6850    if (type == OP_ANYNL || type == OP_EXTUNI)    if (type == OP_ANYNL || type == OP_EXTUNI)
6851      {      {
6852      SLJIT_ASSERT(localptr == 0);      SLJIT_ASSERT(private_data_ptr == 0);
6853      set_jumps(current->topbacktracks, LABEL());      set_jumps(current->topbacktracks, LABEL());
6854      OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));      OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
6855      free_stack(common, 1);      free_stack(common, 1);
# Line 6736  switch(opcode) Line 6877  switch(opcode)
6877      if (opcode == OP_CRRANGE)      if (opcode == OP_CRRANGE)
6878        set_jumps(current->topbacktracks, LABEL());        set_jumps(current->topbacktracks, LABEL());
6879      JUMPHERE(jump);      JUMPHERE(jump);
6880      if (localptr == 0)      if (private_data_ptr == 0)
6881        free_stack(common, 2);        free_stack(common, 2);
6882      if (opcode == OP_PLUS)      if (opcode == OP_PLUS)
6883        set_jumps(current->topbacktracks, LABEL());        set_jumps(current->topbacktracks, LABEL());
# Line 6750  switch(opcode) Line 6891  switch(opcode)
6891    OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);    OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
6892    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->matchingpath);    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->matchingpath);
6893    set_jumps(jumplist, LABEL());    set_jumps(jumplist, LABEL());
6894    if (localptr == 0)    if (private_data_ptr == 0)
6895      free_stack(common, 1);      free_stack(common, 1);
6896    if (opcode == OP_MINPLUS)    if (opcode == OP_MINPLUS)
6897      set_jumps(current->topbacktracks, LABEL());      set_jumps(current->topbacktracks, LABEL());
# Line 6780  switch(opcode) Line 6921  switch(opcode)
6921      CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 2, CURRENT_AS(iterator_backtrack)->matchingpath);      CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 2, CURRENT_AS(iterator_backtrack)->matchingpath);
6922    
6923    set_jumps(jumplist, LABEL());    set_jumps(jumplist, LABEL());
6924    if (localptr == 0)    if (private_data_ptr == 0)
6925      free_stack(common, 2);      free_stack(common, 2);
6926    break;    break;
6927    
# Line 6794  switch(opcode) Line 6935  switch(opcode)
6935    OP1(SLJIT_MOV, base, offset0, SLJIT_IMM, 0);    OP1(SLJIT_MOV, base, offset0, SLJIT_IMM, 0);
6936    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->matchingpath);    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->matchingpath);
6937    JUMPHERE(jump);    JUMPHERE(jump);
6938    if (localptr == 0)    if (private_data_ptr == 0)
6939      free_stack(common, 1);      free_stack(common, 1);
6940    break;    break;
6941    
# Line 6806  switch(opcode) Line 6947  switch(opcode)
6947    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->matchingpath);    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->matchingpath);
6948    set_jumps(jumplist, LABEL());    set_jumps(jumplist, LABEL());
6949    JUMPHERE(jump);    JUMPHERE(jump);
6950    if (localptr == 0)    if (private_data_ptr == 0)
6951      free_stack(common, 1);      free_stack(common, 1);
6952    break;    break;
6953    
# Line 6918  if (bra == OP_BRAZERO) Line 7059  if (bra == OP_BRAZERO)
7059    
7060  if (*cc == OP_ASSERT || *cc == OP_ASSERTBACK)  if (*cc == OP_ASSERT || *cc == OP_ASSERTBACK)
7061    {    {
7062    OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(assert_backtrack)->localptr);    OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(assert_backtrack)->private_data_ptr);
7063    add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));    add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
7064    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(assert_backtrack)->localptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(assert_backtrack)->framesize * sizeof(sljit_w));    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(assert_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(assert_backtrack)->framesize * sizeof(sljit_w));
7065    
7066    set_jumps(current->topbacktracks, LABEL());    set_jumps(current->topbacktracks, LABEL());
7067    }    }
# Line 6942  static void compile_bracket_backtracking Line 7083  static void compile_bracket_backtracking
7083  DEFINE_COMPILER;  DEFINE_COMPILER;
7084  int opcode;  int opcode;
7085  int offset = 0;  int offset = 0;
7086  int localptr = CURRENT_AS(bracket_backtrack)->localptr;  int private_data_ptr = CURRENT_AS(bracket_backtrack)->private_data_ptr;
7087  int stacksize;  int stacksize;
7088  int count;  int count;
7089  pcre_uchar *cc = current->cc;  pcre_uchar *cc = current->cc;
# Line 6997  else if (ket == OP_KETRMIN) Line 7138  else if (ket == OP_KETRMIN)
7138        {        {
7139        /* Checking zero-length iteration. */        /* Checking zero-length iteration. */
7140        if (opcode != OP_ONCE || CURRENT_AS(bracket_backtrack)->u.framesize < 0)        if (opcode != OP_ONCE || CURRENT_AS(bracket_backtrack)->u.framesize < 0)
7141          CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, CURRENT_AS(bracket_backtrack)->recursive_matchingpath);          CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
7142        else        else
7143          {          {
7144          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);          OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
7145          CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (CURRENT_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_w), CURRENT_AS(bracket_backtrack)->recursive_matchingpath);          CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (CURRENT_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_w), CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
7146          }          }
7147        if (opcode != OP_ONCE)        if (opcode != OP_ONCE)
# Line 7022  if (SLJIT_UNLIKELY(opcode == OP_ONCE)) Line 7163  if (SLJIT_UNLIKELY(opcode == OP_ONCE))
7163    {    {
7164    if (CURRENT_AS(bracket_backtrack)->u.framesize >= 0)    if (CURRENT_AS(bracket_backtrack)->u.framesize >= 0)
7165      {      {
7166      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);      OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
7167      add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));      add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
7168      }      }
7169    once = JUMP(SLJIT_JUMP);    once = JUMP(SLJIT_JUMP);
# Line 7088  if (SLJIT_UNLIKELY(opcode == OP_COND) || Line 7229  if (SLJIT_UNLIKELY(opcode == OP_COND) ||
7229      assert = CURRENT_AS(bracket_backtrack)->u.assert;      assert = CURRENT_AS(bracket_backtrack)->u.assert;
7230      if (assert->framesize >= 0 && (ccbegin[1 + LINK_SIZE] == OP_ASSERT || ccbegin[1 + LINK_SIZE] == OP_ASSERTBACK))      if (assert->framesize >= 0 && (ccbegin[1 + LINK_SIZE] == OP_ASSERT || ccbegin[1 + LINK_SIZE] == OP_ASSERTBACK))
7231        {        {
7232        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->private_data_ptr);
7233        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
7234        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), assert->localptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_w));        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_w));
7235        }        }
7236      cond = JUMP(SLJIT_JUMP);      cond = JUMP(SLJIT_JUMP);
7237      set_jumps(CURRENT_AS(bracket_backtrack)->u.assert->condfailed, LABEL());      set_jumps(CURRENT_AS(bracket_backtrack)->u.assert->condfailed, LABEL());
# Line 7119  if (has_alternatives) Line 7260  if (has_alternatives)
7260        cc += GET(cc, 1);        cc += GET(cc, 1);
7261        if (opcode != OP_COND && opcode != OP_SCOND)        if (opcode != OP_COND && opcode != OP_SCOND)
7262          {          {
7263          if (localptr != 0 && opcode != OP_ONCE)          if (private_data_ptr != 0 && opcode != OP_ONCE)
7264            OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);            OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
7265          else          else
7266            OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));            OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
7267          }          }
# Line 7135  if (has_alternatives) Line 7276  if (has_alternatives)
7276        {        {
7277        if (CURRENT_AS(bracket_backtrack)->u.framesize < 0)        if (CURRENT_AS(bracket_backtrack)->u.framesize < 0)
7278          {          {
7279          OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);          OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
7280          /* TMP2 which is set here used by OP_KETRMAX below. */          /* TMP2 which is set here used by OP_KETRMAX below. */
7281          if (ket == OP_KETRMAX)          if (ket == OP_KETRMAX)
7282            OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), 0);            OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), 0);
7283          else if (ket == OP_KETRMIN)          else if (ket == OP_KETRMIN)
7284            {            {
7285            /* Move the STR_PTR to the localptr. */            /* Move the STR_PTR to the private_data_ptr. */
7286            OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_MEM1(STACK_TOP), 0);            OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_MEM1(STACK_TOP), 0);
7287            }            }
7288          }          }
7289        else        else
7290          {          {
7291          OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_IMM, (CURRENT_AS(bracket_backtrack)->u.framesize + 2) * sizeof(sljit_w));          OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, (CURRENT_AS(bracket_backtrack)->u.framesize + 2) * sizeof(sljit_w));
7292          if (ket == OP_KETRMAX)          if (ket == OP_KETRMAX)
7293            {            {
7294            /* TMP2 which is set here used by OP_KETRMAX below. */            /* TMP2 which is set here used by OP_KETRMAX below. */
# Line 7188  if (has_alternatives) Line 7329  if (has_alternatives)
7329    
7330      if (offset != 0)      if (offset != 0)
7331        {        {
7332        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr);        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr);
7333        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);
7334        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 0), TMP1, 0);        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 0), TMP1, 0);
7335        }        }
# Line 7217  if (has_alternatives) Line 7358  if (has_alternatives)
7358      if ((ccbegin[1 + LINK_SIZE] == OP_ASSERT_NOT || ccbegin[1 + LINK_SIZE] == OP_ASSERTBACK_NOT) && assert->framesize >= 0)      if ((ccbegin[1 + LINK_SIZE] == OP_ASSERT_NOT || ccbegin[1 + LINK_SIZE] == OP_ASSERTBACK_NOT) && assert->framesize >= 0)
7359    
7360        {        {
7361        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->private_data_ptr);
7362        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));        add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
7363        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), assert->localptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_w));        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_w));
7364        }        }
7365      JUMPHERE(cond);      JUMPHERE(cond);
7366      }      }
7367    
7368    /* Free the STR_PTR. */    /* Free the STR_PTR. */
7369    if (localptr == 0)    if (private_data_ptr == 0)
7370      free_stack(common, 1);      free_stack(common, 1);
7371    }    }
7372    
7373  if (offset != 0)  if (offset != 0)
7374    {    {
7375    /* Using both tmp register is better for instruction scheduling. */    /* Using both tmp register is better for instruction scheduling. */
7376    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));    if (common->optimized_cbracket[offset >> 1] == 0)
7377    OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1));      {
7378    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
7379    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP2, 0);      OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
7380    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_MEM1(STACK_TOP), STACK(2));      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);
7381    free_stack(common, 3);      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(2));
7382        free_stack(common, 3);
7383        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP2, 0);
7384        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP1, 0);
7385        }
7386      else
7387        {
7388        OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
7389        OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
7390        free_stack(common, 2);
7391        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0);
7392        OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP2, 0);
7393        }
7394    }    }
7395  else if (opcode == OP_SBRA || opcode == OP_SCOND)  else if (opcode == OP_SBRA || opcode == OP_SCOND)
7396    {    {
7397    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_MEM1(STACK_TOP), STACK(0));    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(0));
7398    free_stack(common, 1);    free_stack(common, 1);
7399    }    }
7400  else if (opcode == OP_ONCE)  else if (opcode == OP_ONCE)
# Line 7260  else if (opcode == OP_ONCE) Line 7413  else if (opcode == OP_ONCE)
7413      }      }
7414    
7415    JUMPHERE(once);    JUMPHERE(once);
7416    /* Restore previous localptr */    /* Restore previous private_data_ptr */
7417    if (CURRENT_AS(bracket_backtrack)->u.framesize >= 0)    if (CURRENT_AS(bracket_backtrack)->u.framesize >= 0)
7418      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracket_backtrack)->u.framesize * sizeof(sljit_w));      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracket_backtrack)->u.framesize * sizeof(sljit_w));
7419    else if (ket == OP_KETRMIN)    else if (ket == OP_KETRMIN)
7420      {      {
7421      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
7422      /* See the comment below. */      /* See the comment below. */
7423      free_stack(common, 2);      free_stack(common, 2);
7424      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), localptr, TMP1, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP1, 0);
7425      }      }
7426    }    }
7427    
# Line 7330  if (CURRENT_AS(bracketpos_backtrack)->fr Line 7483  if (CURRENT_AS(bracketpos_backtrack)->fr
7483    return;    return;
7484    }    }
7485    
7486  OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(bracketpos_backtrack)->localptr);  OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(bracketpos_backtrack)->private_data_ptr);
7487  add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));  add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
7488    
7489  if (current->topbacktracks)  if (current->topbacktracks)
# Line 7341  if (current->topbacktracks) Line 7494  if (current->topbacktracks)
7494    free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize);    free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize);
7495    JUMPHERE(jump);    JUMPHERE(jump);
7496    }    }
7497  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(bracketpos_backtrack)->localptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracketpos_backtrack)->framesize * sizeof(sljit_w));  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(bracketpos_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracketpos_backtrack)->framesize * sizeof(sljit_w));
7498  }  }
7499    
7500  static void compile_braminzero_backtrackingpath(compiler_common *common, struct backtrack_common *current)  static void compile_braminzero_backtrackingpath(compiler_common *common, struct backtrack_common *current)
# Line 7537  DEFINE_COMPILER; Line 7690  DEFINE_COMPILER;
7690  pcre_uchar *cc = common->start + common->currententry->start;  pcre_uchar *cc = common->start + common->currententry->start;
7691  pcre_uchar *ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : IMM2_SIZE);  pcre_uchar *ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : IMM2_SIZE);
7692  pcre_uchar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
7693  int localsize = get_localsize(common, ccbegin, ccend);  int private_data_size = get_private_data_length_for_copy(common, ccbegin, ccend);
7694  int framesize = get_framesize(common, cc, TRUE);  int framesize = get_framesize(common, cc, TRUE);
7695  int alternativesize;  int alternativesize;
7696  BOOL needsframe;  BOOL needsframe;
# Line 7557  common->currententry->entry = LABEL(); Line 7710  common->currententry->entry = LABEL();
7710  set_jumps(common->currententry->calls, common->currententry->entry);  set_jumps(common->currententry->calls, common->currententry->entry);
7711    
7712  sljit_emit_fast_enter(compiler, TMP2, 0);  sljit_emit_fast_enter(compiler, TMP2, 0);
7713  allocate_stack(common, localsize + framesize + alternativesize);  allocate_stack(common, private_data_size + framesize + alternativesize);
7714  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(localsize + framesize + alternativesize - 1), TMP2, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(private_data_size + framesize + alternativesize - 1), TMP2, 0);
7715  copy_locals(common, ccbegin, ccend, TRUE, localsize + framesize + alternativesize, framesize + alternativesize);  copy_private_data(common, ccbegin, ccend, TRUE, private_data_size + framesize + alternativesize, framesize + alternativesize);
7716  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head, STACK_TOP, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head, STACK_TOP, 0);
7717  if (needsframe)  if (needsframe)
7718    init_frame(common, cc, framesize + alternativesize - 1, alternativesize, TRUE);    init_frame(common, cc, framesize + alternativesize - 1, alternativesize, TRUE);
# Line 7625  if (needsframe) Line 7778  if (needsframe)
7778  OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 1);  OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 1);
7779    
7780  JUMPHERE(jump);  JUMPHERE(jump);
7781  copy_locals(common, ccbegin, ccend, FALSE, localsize + framesize + alternativesize, framesize + alternativesize);  copy_private_data(common, ccbegin, ccend, FALSE, private_data_size + framesize + alternativesize, framesize + alternativesize);
7782  free_stack(common, localsize + framesize + alternativesize);  free_stack(common, private_data_size + framesize + alternativesize);
7783  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), sizeof(sljit_w));  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), sizeof(sljit_w));
7784  OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);  OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
7785  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head, TMP2, 0);  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head, TMP2, 0);
# Line 7648  compiler_common common_data; Line 7801  compiler_common common_data;
7801  compiler_common *common = &common_data;  compiler_common *common = &common_data;
7802  const pcre_uint8 *tables = re->tables;  const pcre_uint8 *tables = re->tables;
7803  pcre_study_data *study;  pcre_study_data *study;
7804  int localsize;  int private_data_size;
7805  pcre_uchar *ccend;  pcre_uchar *ccend;
7806  executable_functions *functions;  executable_functions *functions;
7807  void *executable_func;  void *executable_func;
# Line 7714  common->name_count = re->name_count; Line 7867  common->name_count = re->name_count;
7867  common->name_entry_size = re->name_entry_size;  common->name_entry_size = re->name_entry_size;
7868  common->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;  common->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;
7869  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
7870  /* PCRE_UTF16 has the same value as PCRE_UTF8. */  /* PCRE_UTF[16|32] have the same value as PCRE_UTF8. */
7871  common->utf = (re->options & PCRE_UTF8) != 0;  common->utf = (re->options & PCRE_UTF8) != 0;
7872  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
7873  common->use_ucp = (re->options & PCRE_UCP) != 0;  common->use_ucp = (re->options & PCRE_UCP) != 0;
# Line 7724  ccend = bracketend(rootbacktrack.cc); Line 7877  ccend = bracketend(rootbacktrack.cc);
7877    
7878  /* Calculate the local space size on the stack. */  /* Calculate the local space size on the stack. */
7879  common->ovector_start = CALL_LIMIT + sizeof(sljit_w);  common->ovector_start = CALL_LIMIT + sizeof(sljit_w);
7880    common->optimized_cbracket = (pcre_uint8 *)SLJIT_MALLOC(re->top_bracket + 1);
7881    if (!common->optimized_cbracket)
7882      return;
7883    memset(common->optimized_cbracket, 1, re->top_bracket + 1);
7884    
7885  SLJIT_ASSERT(*rootbacktrack.cc == OP_BRA && ccend[-(1 + LINK_SIZE)] == OP_KET);  SLJIT_ASSERT(*rootbacktrack.cc == OP_BRA && ccend[-(1 + LINK_SIZE)] == OP_KET);
7886  localsize = get_localspace(common, rootbacktrack.cc, ccend);  private_data_size = get_private_data_length(common, rootbacktrack.cc, ccend);
7887  if (localsize < 0)  if (private_data_size < 0)
7888      {
7889      SLJIT_FREE(common->optimized_cbracket);
7890    return;    return;
7891      }
7892    
7893  /* Checking flags and updating ovector_start. */  /* Checking flags and updating ovector_start. */
7894  if (mode == JIT_COMPILE && (re->flags & PCRE_REQCHSET) != 0 && (re->options & PCRE_NO_START_OPTIMIZE) == 0)  if (mode == JIT_COMPILE && (re->flags & PCRE_REQCHSET) != 0 && (re->options & PCRE_NO_START_OPTIMIZE) == 0)
# Line 7758  if ((common->ovector_start & sizeof(slji Line 7918  if ((common->ovector_start & sizeof(slji
7918    
7919  SLJIT_ASSERT(!(common->req_char_ptr != 0 && common->start_used_ptr != 0));  SLJIT_ASSERT(!(common->req_char_ptr != 0 && common->start_used_ptr != 0));
7920  common->cbraptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_w);  common->cbraptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_w);
7921  localsize += common->cbraptr + (re->top_bracket + 1) * sizeof(sljit_w);  private_data_size += common->cbraptr + (re->top_bracket + 1) * sizeof(sljit_w);
7922  if (localsize > SLJIT_MAX_LOCAL_SIZE)  if (private_data_size > SLJIT_MAX_LOCAL_SIZE)
7923      {
7924      SLJIT_FREE(common->optimized_cbracket);
7925    return;    return;
7926  common->localptrs = (int *)SLJIT_MALLOC((ccend - rootbacktrack.cc) * sizeof(int));    }
7927  if (!common->localptrs)  common->private_data_ptrs = (int *)SLJIT_MALLOC((ccend - rootbacktrack.cc) * sizeof(int));
7928    if (!common->private_data_ptrs)
7929      {
7930      SLJIT_FREE(common->optimized_cbracket);
7931    return;    return;
7932  memset(common->localptrs, 0, (ccend - rootbacktrack.cc) * sizeof(int));    }
7933  set_localptrs(common, common->cbraptr + (re->top_bracket + 1) * sizeof(sljit_w), ccend);  memset(common->private_data_ptrs, 0, (ccend - rootbacktrack.cc) * sizeof(int));
7934    set_private_data_ptrs(common, common->cbraptr + (re->top_bracket + 1) * sizeof(sljit_w), ccend);
7935    
7936  compiler = sljit_create_compiler();  compiler = sljit_create_compiler();
7937  if (!compiler)  if (!compiler)
7938    {    {
7939    SLJIT_FREE(common->localptrs);    SLJIT_FREE(common->optimized_cbracket);
7940      SLJIT_FREE(common->private_data_ptrs);
7941    return;    return;
7942    }    }
7943  common->compiler = compiler;  common->compiler = compiler;
7944    
7945  /* Main pcre_jit_exec entry. */  /* Main pcre_jit_exec entry. */
7946  sljit_emit_enter(compiler, 1, 5, 5, localsize);  sljit_emit_enter(compiler, 1, 5, 5, private_data_size);
7947    
7948  /* Register init. */  /* Register init. */
7949  reset_ovector(common, (re->top_bracket + 1) * 2);  reset_ovector(common, (re->top_bracket + 1) * 2);
# Line 7803  if ((re->options & PCRE_ANCHORED) == 0) Line 7970  if ((re->options & PCRE_ANCHORED) == 0)
7970    /* Forward search if possible. */    /* Forward search if possible. */
7971    if ((re->options & PCRE_NO_START_OPTIMIZE) == 0)    if ((re->options & PCRE_NO_START_OPTIMIZE) == 0)
7972      {      {
7973      if (mode == JIT_COMPILE && fast_forward_first_two_chars(common, (re->options & PCRE_FIRSTLINE) != 0))      if (mode == JIT_COMPILE && fast_forward_first_n_chars(common, (re->options & PCRE_FIRSTLINE) != 0))
7974        { /* Do nothing */ }        { /* Do nothing */ }
7975      else if ((re->flags & PCRE_FIRSTSET) != 0)      else if ((re->flags & PCRE_FIRSTSET) != 0)
7976        fast_forward_first_char(common, (pcre_uchar)re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);        fast_forward_first_char(common, (pcre_uchar)re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);
# Line 7836  compile_matchingpath(common, rootbacktra Line 8003  compile_matchingpath(common, rootbacktra
8003  if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))  if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
8004    {    {
8005    sljit_free_compiler(compiler);    sljit_free_compiler(compiler);
8006    SLJIT_FREE(common->localptrs);    SLJIT_FREE(common->optimized_cbracket);
8007      SLJIT_FREE(common->private_data_ptrs);
8008    return;    return;
8009    }    }
8010    
# Line 7866  compile_backtrackingpath(common, rootbac Line 8034  compile_backtrackingpath(common, rootbac
8034  if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))  if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
8035    {    {
8036    sljit_free_compiler(compiler);    sljit_free_compiler(compiler);
8037    SLJIT_FREE(common->localptrs);    SLJIT_FREE(common->optimized_cbracket);
8038      SLJIT_FREE(common->private_data_ptrs);
8039    return;    return;
8040    }    }
8041    
# Line 7944  while (common->currententry != NULL) Line 8113  while (common->currententry != NULL)
8113    if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))    if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
8114      {      {
8115      sljit_free_compiler(compiler);      sljit_free_compiler(compiler);
8116      SLJIT_FREE(common->localptrs);      SLJIT_FREE(common->optimized_cbracket);
8117        SLJIT_FREE(common->private_data_ptrs);
8118      return;      return;
8119      }      }
8120    flush_stubs(common);    flush_stubs(common);
# Line 8018  if (common->caselesscmp != NULL) Line 8188  if (common->caselesscmp != NULL)
8188    do_caselesscmp(common);    do_caselesscmp(common);
8189    }    }
8190  #ifdef SUPPORT_UTF  #ifdef SUPPORT_UTF
8191    #ifndef COMPILE_PCRE32
8192  if (common->utfreadchar != NULL)  if (common->utfreadchar != NULL)
8193    {    {
8194    set_jumps(common->utfreadchar, LABEL());    set_jumps(common->utfreadchar, LABEL());
8195    do_utfreadchar(common);    do_utfreadchar(common);
8196    }    }
8197    #endif /* !COMPILE_PCRE32 */
8198  #ifdef COMPILE_PCRE8  #ifdef COMPILE_PCRE8
8199  if (common->utfreadtype8 != NULL)  if (common->utfreadtype8 != NULL)
8200    {    {
8201    set_jumps(common->utfreadtype8, LABEL());    set_jumps(common->utfreadtype8, LABEL());
8202    do_utfreadtype8(common);    do_utfreadtype8(common);
8203    }    }
 #endif  
8204  #endif /* COMPILE_PCRE8 */  #endif /* COMPILE_PCRE8 */
8205    #endif /* SUPPORT_UTF */
8206  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
8207  if (common->getucd != NULL)  if (common->getucd != NULL)
8208    {    {
# Line 8039  if (common->getucd != NULL) Line 8211  if (common->getucd != NULL)
8211    }    }
8212  #endif  #endif
8213    
8214  SLJIT_FREE(common->localptrs);  SLJIT_FREE(common->optimized_cbracket);
8215    SLJIT_FREE(common->private_data_ptrs);
8216  executable_func = sljit_generate_code(compiler);  executable_func = sljit_generate_code(compiler);
8217  executable_size = sljit_get_generated_code_size(compiler);  executable_size = sljit_get_generated_code_size(compiler);
8218  sljit_free_compiler(compiler);  sljit_free_compiler(compiler);
# Line 8083  union { Line 8256  union {
8256     void* executable_func;     void* executable_func;
8257     jit_function call_executable_func;     jit_function call_executable_func;
8258  } convert_executable_func;  } convert_executable_func;
8259  pcre_uint8 local_area[LOCAL_SPACE_SIZE];  pcre_uint8 local_space[MACHINE_STACK_SIZE];
8260  struct sljit_stack local_stack;  struct sljit_stack local_stack;
8261    
8262  local_stack.top = (sljit_w)&local_area;  local_stack.top = (sljit_w)&local_space;
8263  local_stack.base = local_stack.top;  local_stack.base = local_stack.top;
8264  local_stack.limit = local_stack.base + LOCAL_SPACE_SIZE;  local_stack.limit = local_stack.base + MACHINE_STACK_SIZE;
8265  local_stack.max_limit = local_stack.limit;  local_stack.max_limit = local_stack.limit;
8266  arguments->stack = &local_stack;  arguments->stack = &local_stack;
8267  convert_executable_func.executable_func = executable_func;  convert_executable_func.executable_func = executable_func;
# Line 8195  PRIV(jit_get_target)(void) Line 8368  PRIV(jit_get_target)(void)
8368  return sljit_get_platform_name();  return sljit_get_platform_name();
8369  }  }
8370    
8371  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
8372  PCRE_EXP_DECL pcre_jit_stack *  PCRE_EXP_DECL pcre_jit_stack *
8373  pcre_jit_stack_alloc(int startsize, int maxsize)  pcre_jit_stack_alloc(int startsize, int maxsize)
8374  #else  #elif defined COMPILE_PCRE16
8375  PCRE_EXP_DECL pcre16_jit_stack *  PCRE_EXP_DECL pcre16_jit_stack *
8376  pcre16_jit_stack_alloc(int startsize, int maxsize)  pcre16_jit_stack_alloc(int startsize, int maxsize)
8377    #elif defined COMPILE_PCRE32
8378    PCRE_EXP_DECL pcre32_jit_stack *
8379    pcre32_jit_stack_alloc(int startsize, int maxsize)
8380  #endif  #endif
8381  {  {
8382  if (startsize < 1 || maxsize < 1)  if (startsize < 1 || maxsize < 1)
# Line 8212  maxsize = (maxsize + STACK_GROWTH_RATE - Line 8388  maxsize = (maxsize + STACK_GROWTH_RATE -
8388  return (PUBL(jit_stack)*)sljit_allocate_stack(startsize, maxsize);  return (PUBL(jit_stack)*)sljit_allocate_stack(startsize, maxsize);
8389  }  }
8390    
8391  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
8392  PCRE_EXP_DECL void  PCRE_EXP_DECL void
8393  pcre_jit_stack_free(pcre_jit_stack *stack)  pcre_jit_stack_free(pcre_jit_stack *stack)
8394  #else  #elif defined COMPILE_PCRE16
8395  PCRE_EXP_DECL void  PCRE_EXP_DECL void
8396  pcre16_jit_stack_free(pcre16_jit_stack *stack)  pcre16_jit_stack_free(pcre16_jit_stack *stack)
8397    #elif defined COMPILE_PCRE32
8398    PCRE_EXP_DECL void
8399    pcre32_jit_stack_free(pcre32_jit_stack *stack)
8400  #endif  #endif
8401  {  {
8402  sljit_free_stack((struct sljit_stack *)stack);  sljit_free_stack((struct sljit_stack *)stack);
8403  }  }
8404    
8405  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
8406  PCRE_EXP_DECL void  PCRE_EXP_DECL void
8407  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)
8408  #else  #elif defined COMPILE_PCRE16
8409  PCRE_EXP_DECL void  PCRE_EXP_DECL void
8410  pcre16_assign_jit_stack(pcre16_extra *extra, pcre16_jit_callback callback, void *userdata)  pcre16_assign_jit_stack(pcre16_extra *extra, pcre16_jit_callback callback, void *userdata)
8411    #elif defined COMPILE_PCRE32
8412    PCRE_EXP_DECL void
8413    pcre32_assign_jit_stack(pcre32_extra *extra, pcre32_jit_callback callback, void *userdata)
8414  #endif  #endif
8415  {  {
8416  executable_functions *functions;  executable_functions *functions;
# Line 8247  if (extra != NULL && Line 8429  if (extra != NULL &&
8429  /* 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
8430  being compiled. */  being compiled. */
8431    
8432  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
8433  PCRE_EXP_DECL pcre_jit_stack *  PCRE_EXP_DECL pcre_jit_stack *
8434  pcre_jit_stack_alloc(int startsize, int maxsize)  pcre_jit_stack_alloc(int startsize, int maxsize)
8435  #else  #elif defined COMPILE_PCRE16
8436  PCRE_EXP_DECL pcre16_jit_stack *  PCRE_EXP_DECL pcre16_jit_stack *
8437  pcre16_jit_stack_alloc(int startsize, int maxsize)  pcre16_jit_stack_alloc(int startsize, int maxsize)
8438    #elif defined COMPILE_PCRE32
8439    PCRE_EXP_DECL pcre32_jit_stack *
8440    pcre32_jit_stack_alloc(int startsize, int maxsize)
8441  #endif  #endif
8442  {  {
8443  (void)startsize;  (void)startsize;
# Line 8260  pcre16_jit_stack_alloc(int startsize, in Line 8445  pcre16_jit_stack_alloc(int startsize, in
8445  return NULL;  return NULL;
8446  }  }
8447    
8448  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
8449  PCRE_EXP_DECL void  PCRE_EXP_DECL void
8450  pcre_jit_stack_free(pcre_jit_stack *stack)  pcre_jit_stack_free(pcre_jit_stack *stack)
8451  #else  #elif defined COMPILE_PCRE16
8452  PCRE_EXP_DECL void  PCRE_EXP_DECL void
8453  pcre16_jit_stack_free(pcre16_jit_stack *stack)  pcre16_jit_stack_free(pcre16_jit_stack *stack)
8454    #elif defined COMPILE_PCRE32
8455    PCRE_EXP_DECL void
8456    pcre32_jit_stack_free(pcre32_jit_stack *stack)
8457  #endif  #endif
8458  {  {
8459  (void)stack;  (void)stack;
8460  }  }
8461    
8462  #ifdef COMPILE_PCRE8  #if defined COMPILE_PCRE8
8463  PCRE_EXP_DECL void  PCRE_EXP_DECL void
8464  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)
8465  #else  #elif defined COMPILE_PCRE16
8466  PCRE_EXP_DECL void  PCRE_EXP_DECL void
8467  pcre16_assign_jit_stack(pcre16_extra *extra, pcre16_jit_callback callback, void *userdata)  pcre16_assign_jit_stack(pcre16_extra *extra, pcre16_jit_callback callback, void *userdata)
8468    #elif defined COMPILE_PCRE32
8469    PCRE_EXP_DECL void
8470    pcre32_assign_jit_stack(pcre32_extra *extra, pcre32_jit_callback callback, void *userdata)
8471  #endif  #endif
8472  {  {
8473  (void)extra;  (void)extra;

Legend:
Removed from v.999  
changed lines
  Added in v.1176

  ViewVC Help
Powered by ViewVC 1.1.5