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

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

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

revision 755 by ph10, Mon Nov 21 10:41:54 2011 UTC revision 756 by ph10, Mon Nov 21 10:48:42 2011 UTC
# Line 152  typedef struct jit_arguments { Line 152  typedef struct jit_arguments {
152    PCRE_SPTR begin;    PCRE_SPTR begin;
153    PCRE_SPTR end;    PCRE_SPTR end;
154    int *offsets;    int *offsets;
155    uschar *ptr;    pcre_uchar *ptr;
156    /* Everything else after. */    /* Everything else after. */
157    int offsetcount;    int offsetcount;
158    int calllimit;    int calllimit;
159    uschar notbol;    pcre_uint8 notbol;
160    uschar noteol;    pcre_uint8 noteol;
161    uschar notempty;    pcre_uint8 notempty;
162    uschar notempty_atstart;    pcre_uint8 notempty_atstart;
163  } jit_arguments;  } jit_arguments;
164    
165  typedef struct executable_function {  typedef struct executable_function {
# Line 197  typedef struct fallback_common { Line 197  typedef struct fallback_common {
197    struct fallback_common *top;    struct fallback_common *top;
198    jump_list *topfallbacks;    jump_list *topfallbacks;
199    /* Opcode pointer. */    /* Opcode pointer. */
200    uschar *cc;    pcre_uchar *cc;
201  } fallback_common;  } fallback_common;
202    
203  typedef struct assert_fallback {  typedef struct assert_fallback {
# Line 268  typedef struct recurse_fallback { Line 268  typedef struct recurse_fallback {
268    
269  typedef struct compiler_common {  typedef struct compiler_common {
270    struct sljit_compiler *compiler;    struct sljit_compiler *compiler;
271    uschar *start;    pcre_uchar *start;
272    int localsize;    int localsize;
273    int *localptrs;    int *localptrs;
274    const uschar *fcc;    const pcre_uint8 *fcc;
275    sljit_w lcc;    sljit_w lcc;
276    int cbraptr;    int cbraptr;
277    int nltype;    int nltype;
# Line 397  the start pointers when the end of the c Line 397  the start pointers when the end of the c
397  #define COND_VALUE(op, dst, dstw, type) \  #define COND_VALUE(op, dst, dstw, type) \
398    sljit_emit_cond_value(compiler, (op), (dst), (dstw), (type))    sljit_emit_cond_value(compiler, (op), (dst), (dstw), (type))
399    
400  static uschar* bracketend(uschar* cc)  static pcre_uchar* bracketend(pcre_uchar* cc)
401  {  {
402  SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND));  SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND));
403  do cc += GET(cc, 1); while (*cc == OP_ALT);  do cc += GET(cc, 1); while (*cc == OP_ALT);
# Line 418  return cc; Line 418  return cc;
418   compile_fallbackpath   compile_fallbackpath
419  */  */
420    
421  static uschar *next_opcode(compiler_common *common, uschar *cc)  static pcre_uchar *next_opcode(compiler_common *common, pcre_uchar *cc)
422  {  {
423  SLJIT_UNUSED_ARG(common);  SLJIT_UNUSED_ARG(common);
424  switch(*cc)  switch(*cc)
# Line 609  switch(*cc) Line 609  switch(*cc)
609    }    }
610  }  }
611    
612  static int get_localspace(compiler_common *common, uschar *cc, uschar *ccend)  static int get_localspace(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
613  {  {
614  int localspace = 0;  int localspace = 0;
615  uschar *alternative;  pcre_uchar *alternative;
616  /* 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. */
617  while (cc < ccend)  while (cc < ccend)
618    {    {
# Line 656  while (cc < ccend) Line 656  while (cc < ccend)
656  return localspace;  return localspace;
657  }  }
658    
659  static void set_localptrs(compiler_common *common, int localptr, uschar *ccend)  static void set_localptrs(compiler_common *common, int localptr, pcre_uchar *ccend)
660  {  {
661  uschar *cc = common->start;  pcre_uchar *cc = common->start;
662  uschar *alternative;  pcre_uchar *alternative;
663  while (cc < ccend)  while (cc < ccend)
664    {    {
665    switch(*cc)    switch(*cc)
# Line 706  while (cc < ccend) Line 706  while (cc < ccend)
706  }  }
707    
708  /* Returns with -1 if no need for frame. */  /* Returns with -1 if no need for frame. */
709  static int get_framesize(compiler_common *common, uschar *cc, BOOL recursive)  static int get_framesize(compiler_common *common, pcre_uchar *cc, BOOL recursive)
710  {  {
711  uschar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
712  int length = 0;  int length = 0;
713  BOOL possessive = FALSE;  BOOL possessive = FALSE;
714  BOOL setsom_found = FALSE;  BOOL setsom_found = FALSE;
# Line 757  if (length > 0) Line 757  if (length > 0)
757  return -1;  return -1;
758  }  }
759    
760  static void init_frame(compiler_common *common, uschar *cc, int stackpos, int stacktop, BOOL recursive)  static void init_frame(compiler_common *common, pcre_uchar *cc, int stackpos, int stacktop, BOOL recursive)
761  {  {
762  DEFINE_COMPILER;  DEFINE_COMPILER;
763  uschar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
764  BOOL setsom_found = FALSE;  BOOL setsom_found = FALSE;
765  int offset;  int offset;
766    
# Line 815  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), st Line 815  OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), st
815  SLJIT_ASSERT(stackpos == STACK(stacktop));  SLJIT_ASSERT(stackpos == STACK(stacktop));
816  }  }
817    
818  static SLJIT_INLINE int get_localsize(compiler_common *common, uschar *cc, uschar *ccend)  static SLJIT_INLINE int get_localsize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
819  {  {
820  int localsize = 2;  int localsize = 2;
821  uschar *alternative;  pcre_uchar *alternative;
822  /* Calculate the sum of the local variables. */  /* Calculate the sum of the local variables. */
823  while (cc < ccend)  while (cc < ccend)
824    {    {
# Line 868  SLJIT_ASSERT(cc == ccend); Line 868  SLJIT_ASSERT(cc == ccend);
868  return localsize;  return localsize;
869  }  }
870    
871  static void copy_locals(compiler_common *common, uschar *cc, uschar *ccend,  static void copy_locals(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend,
872    BOOL save, int stackptr, int stacktop)    BOOL save, int stackptr, int stacktop)
873  {  {
874  DEFINE_COMPILER;  DEFINE_COMPILER;
# Line 877  int count; Line 877  int count;
877  BOOL tmp1next = TRUE;  BOOL tmp1next = TRUE;
878  BOOL tmp1empty = TRUE;  BOOL tmp1empty = TRUE;
879  BOOL tmp2empty = TRUE;  BOOL tmp2empty = TRUE;
880  uschar *alternative;  pcre_uchar *alternative;
881  enum {  enum {
882    start,    start,
883    loop,    loop,
# Line 1233  else Line 1233  else
1233    OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);    OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1);
1234  }  }
1235    
1236  static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, uschar* cc)  static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, pcre_uchar* cc)
1237  {  {
1238  /* Detects if the character has an othercase. */  /* Detects if the character has an othercase. */
1239  unsigned int c;  unsigned int c;
# Line 1273  if (common->utf8 && c > 127) Line 1273  if (common->utf8 && c > 127)
1273  return common->fcc[c];  return common->fcc[c];
1274  }  }
1275    
1276  static unsigned int char_get_othercase_bit(compiler_common *common, uschar* cc)  static unsigned int char_get_othercase_bit(compiler_common *common, pcre_uchar* cc)
1277  {  {
1278  /* Detects if the character and its othercase has only 1 bit difference. */  /* Detects if the character and its othercase has only 1 bit difference. */
1279  unsigned int c, oc, bit;  unsigned int c, oc, bit;
# Line 1565  sljit_emit_fast_return(compiler, RETURN_ Line 1565  sljit_emit_fast_return(compiler, RETURN_
1565  JUMPHERE(jump);  JUMPHERE(jump);
1566    
1567  /* We only have types for characters less than 256. */  /* We only have types for characters less than 256. */
1568  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), (sljit_w)_pcre_utf8_char_sizes - 0xc0);  OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP2), (sljit_w)_pcre_utf8_table4 - 0xc0);
1569  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1570  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);  OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 0);
1571  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);  sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
# Line 1687  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S Line 1687  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S
1687  if (common->utf8)  if (common->utf8)
1688    {    {
1689    singlebyte = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);    singlebyte = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
1690    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0);
1691    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1692    JUMPHERE(singlebyte);    JUMPHERE(singlebyte);
1693    }    }
# Line 1748  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S Line 1748  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S
1748  if (common->utf8)  if (common->utf8)
1749    {    {
1750    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
1751    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0);
1752    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1753    }    }
1754  #endif  #endif
# Line 1875  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S Line 1875  OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, S
1875  if (common->utf8)  if (common->utf8)
1876    {    {
1877    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);    CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0, start);
1878    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0);    OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0);
1879    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);    OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
1880    }    }
1881  #endif  #endif
# Line 2231  sljit_emit_fast_return(compiler, RETURN_ Line 2231  sljit_emit_fast_return(compiler, RETURN_
2231  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2232  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2233    
2234  static uschar * SLJIT_CALL do_utf8caselesscmp(uschar *src1, jit_arguments *args, uschar *end1)  static const pcre_uchar *SLJIT_CALL do_utf_caselesscmp(pcre_uchar *src1, jit_arguments *args, pcre_uchar *end1)
2235  {  {
2236  /* This function would be ineffective to do in JIT level. */  /* This function would be ineffective to do in JIT level. */
2237  int c1, c2;  int c1, c2;
2238  uschar *src2 = args->ptr;  const pcre_uchar *src2 = args->ptr;
2239  uschar *end2 = (uschar*)args->end;  const pcre_uchar *end2 = (pcre_uchar *)args->end;
2240    
2241  while (src1 < end1)  while (src1 < end1)
2242    {    {
# Line 2252  return src2; Line 2252  return src2;
2252  #endif  #endif
2253  #endif  #endif
2254    
2255  static uschar *byte_sequence_compare(compiler_common *common, BOOL caseless, uschar *cc,  static pcre_uchar *byte_sequence_compare(compiler_common *common, BOOL caseless, pcre_uchar *cc,
2256      compare_context* context, jump_list **fallbacks)      compare_context* context, jump_list **fallbacks)
2257  {  {
2258  DEFINE_COMPILER;  DEFINE_COMPILER;
2259  unsigned int othercasebit = 0;  unsigned int othercasebit = 0;
2260  uschar *othercasebyte = NULL;  pcre_uint8 *othercasebyte = NULL;
2261  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2262  int utf8length;  int utf8length;
2263  #endif  #endif
# Line 2395  return cc; Line 2395  return cc;
2395      } \      } \
2396    charoffset = (value);    charoffset = (value);
2397    
2398  static void compile_xclass_hotpath(compiler_common *common, uschar *cc, jump_list **fallbacks)  static void compile_xclass_hotpath(compiler_common *common, pcre_uchar *cc, jump_list **fallbacks)
2399  {  {
2400  DEFINE_COMPILER;  DEFINE_COMPILER;
2401  jump_list *found = NULL;  jump_list *found = NULL;
# Line 2403  jump_list **list = (*cc & XCL_NOT) == 0 Line 2403  jump_list **list = (*cc & XCL_NOT) == 0
2403  unsigned int c;  unsigned int c;
2404  int compares;  int compares;
2405  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
2406  uschar *ccbegin;  pcre_uchar *ccbegin;
2407  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2408  BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;  BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;
2409  BOOL charsaved = FALSE;  BOOL charsaved = FALSE;
# Line 2724  if (found != NULL) Line 2724  if (found != NULL)
2724    
2725  #endif  #endif
2726    
2727  static uschar *compile_char1_hotpath(compiler_common *common, uschar type, uschar *cc, jump_list **fallbacks)  static pcre_uchar *compile_char1_hotpath(compiler_common *common, pcre_uchar type, pcre_uchar *cc, jump_list **fallbacks)
2728  {  {
2729  DEFINE_COMPILER;  DEFINE_COMPILER;
2730  int length;  int length;
# Line 2734  struct sljit_jump *jump[4]; Line 2734  struct sljit_jump *jump[4];
2734  #ifdef SUPPORT_UTF8  #ifdef SUPPORT_UTF8
2735  struct sljit_label *label;  struct sljit_label *label;
2736  #ifdef SUPPORT_UCP  #ifdef SUPPORT_UCP
2737  uschar propdata[5];  pcre_uchar propdata[5];
2738  #endif  #endif
2739  #endif  #endif
2740    
# Line 2806  switch(type) Line 2806  switch(type)
2806      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
2807      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);
2808      jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);      jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
2809      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0);      OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0);
2810      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);      OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
2811      JUMPHERE(jump[0]);      JUMPHERE(jump[0]);
2812      return cc;      return cc;
# Line 3077  switch(type) Line 3077  switch(type)
3077        /* Skip the variable-length character. */        /* Skip the variable-length character. */
3078        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 1);
3079        jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);        jump[0] = CMP(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, 0xc0);
3080        OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_char_sizes - 0xc0);        OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_w)_pcre_utf8_table4 - 0xc0);
3081        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);        OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
3082        JUMPHERE(jump[0]);        JUMPHERE(jump[0]);
3083        return cc + length;        return cc + length;
# Line 3172  SLJIT_ASSERT_STOP(); Line 3172  SLJIT_ASSERT_STOP();
3172  return cc;  return cc;
3173  }  }
3174    
3175  static SLJIT_INLINE uschar *compile_charn_hotpath(compiler_common *common, uschar *cc, uschar *ccend, jump_list **fallbacks)  static SLJIT_INLINE pcre_uchar *compile_charn_hotpath(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, jump_list **fallbacks)
3176  {  {
3177  /* This function consumes at least one input character. */  /* This function consumes at least one input character. */
3178  /* To decrease the number of length checks, we try to concatenate the fixed length character sequences. */  /* To decrease the number of length checks, we try to concatenate the fixed length character sequences. */
3179  DEFINE_COMPILER;  DEFINE_COMPILER;
3180  uschar *ccbegin = cc;  pcre_uchar *ccbegin = cc;
3181  compare_context context;  compare_context context;
3182  int size;  int size;
3183    
# Line 3238  if (context.length > 0) Line 3238  if (context.length > 0)
3238  return compile_char1_hotpath(common, *cc, cc + 1, fallbacks);  return compile_char1_hotpath(common, *cc, cc + 1, fallbacks);
3239  }  }
3240    
3241  static struct sljit_jump *compile_ref_checks(compiler_common *common, uschar *cc, jump_list **fallbacks)  static struct sljit_jump *compile_ref_checks(compiler_common *common, pcre_uchar *cc, jump_list **fallbacks)
3242  {  {
3243  DEFINE_COMPILER;  DEFINE_COMPILER;
3244  int offset = GET2(cc, 1) << 1;  int offset = GET2(cc, 1) << 1;
# Line 3260  return CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT Line 3260  return CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT
3260  }  }
3261    
3262  /* Forward definitions. */  /* Forward definitions. */
3263  static void compile_hotpath(compiler_common *, uschar *, uschar *, fallback_common *);  static void compile_hotpath(compiler_common *, pcre_uchar *, pcre_uchar *, fallback_common *);
3264  static void compile_fallbackpath(compiler_common *, struct fallback_common *);  static void compile_fallbackpath(compiler_common *, struct fallback_common *);
3265    
3266  #define PUSH_FALLBACK(size, ccstart, error) \  #define PUSH_FALLBACK(size, ccstart, error) \
# Line 3291  static void compile_fallbackpath(compile Line 3291  static void compile_fallbackpath(compile
3291    
3292  #define FALLBACK_AS(type) ((type*)fallback)  #define FALLBACK_AS(type) ((type*)fallback)
3293    
3294  static uschar *compile_ref_hotpath(compiler_common *common, uschar *cc, jump_list **fallbacks, BOOL withchecks, BOOL emptyfail)  static pcre_uchar *compile_ref_hotpath(compiler_common *common, pcre_uchar *cc, jump_list **fallbacks, BOOL withchecks, BOOL emptyfail)
3295  {  {
3296  DEFINE_COMPILER;  DEFINE_COMPILER;
3297  int offset = GET2(cc, 1) << 1;  int offset = GET2(cc, 1) << 1;
# Line 3314  if (common->utf8 && *cc == OP_REFI) Line 3314  if (common->utf8 && *cc == OP_REFI)
3314    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0);
3315    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, ARGUMENTS, 0);    OP1(SLJIT_MOV, SLJIT_TEMPORARY_REG2, 0, ARGUMENTS, 0);
3316    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), SLJIT_OFFSETOF(jit_arguments, ptr), STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_TEMPORARY_REG2), SLJIT_OFFSETOF(jit_arguments, ptr), STR_PTR, 0);
3317    sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf8caselesscmp));    sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf_caselesscmp));
3318    OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);    OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0);
3319    add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0));    add_jump(compiler, fallbacks, CMP(SLJIT_C_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0));
3320    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);
# Line 3343  if (jump != NULL) Line 3343  if (jump != NULL)
3343  return cc + 3;  return cc + 3;
3344  }  }
3345    
3346  static SLJIT_INLINE uschar *compile_ref_iterator_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static SLJIT_INLINE pcre_uchar *compile_ref_iterator_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
3347  {  {
3348  DEFINE_COMPILER;  DEFINE_COMPILER;
3349  fallback_common *fallback;  fallback_common *fallback;
3350  uschar type;  pcre_uchar type;
3351  struct sljit_label *label;  struct sljit_label *label;
3352  struct sljit_jump *zerolength;  struct sljit_jump *zerolength;
3353  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
3354  uschar *ccbegin = cc;  pcre_uchar *ccbegin = cc;
3355  int min = 0, max = 0;  int min = 0, max = 0;
3356  BOOL minimize;  BOOL minimize;
3357    
# Line 3487  decrease_call_count(common); Line 3487  decrease_call_count(common);
3487  return cc;  return cc;
3488  }  }
3489    
3490  static SLJIT_INLINE uschar *compile_recurse_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static SLJIT_INLINE pcre_uchar *compile_recurse_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
3491  {  {
3492  DEFINE_COMPILER;  DEFINE_COMPILER;
3493  fallback_common *fallback;  fallback_common *fallback;
# Line 3533  add_jump(compiler, &fallback->topfallbac Line 3533  add_jump(compiler, &fallback->topfallbac
3533  return cc + 1 + LINK_SIZE;  return cc + 1 + LINK_SIZE;
3534  }  }
3535    
3536  static uschar *compile_assert_hotpath(compiler_common *common, uschar *cc, assert_fallback *fallback, BOOL conditional)  static pcre_uchar *compile_assert_hotpath(compiler_common *common, pcre_uchar *cc, assert_fallback *fallback, BOOL conditional)
3537  {  {
3538  DEFINE_COMPILER;  DEFINE_COMPILER;
3539  int framesize;  int framesize;
3540  int localptr;  int localptr;
3541  fallback_common altfallback;  fallback_common altfallback;
3542  uschar *ccbegin;  pcre_uchar *ccbegin;
3543  uschar opcode;  pcre_uchar opcode;
3544  uschar bra = OP_BRA;  pcre_uchar bra = OP_BRA;
3545  jump_list *tmp = NULL;  jump_list *tmp = NULL;
3546  jump_list **target = (conditional) ? &fallback->condfailed : &fallback->common.topfallbacks;  jump_list **target = (conditional) ? &fallback->condfailed : &fallback->common.topfallbacks;
3547  jump_list **found;  jump_list **found;
# Line 3803  common->accept = save_accept; Line 3803  common->accept = save_accept;
3803  return cc + 1 + LINK_SIZE;  return cc + 1 + LINK_SIZE;
3804  }  }
3805    
3806  static sljit_w SLJIT_CALL do_searchovector(sljit_w refno, sljit_w* locals, uschar *name_table)  static sljit_w SLJIT_CALL do_searchovector(sljit_w refno, sljit_w* locals, pcre_uchar *name_table)
3807  {  {
3808  int condition = FALSE;  int condition = FALSE;
3809  uschar *slotA = name_table;  pcre_uchar *slotA = name_table;
3810  uschar *slotB;  pcre_uchar *slotB;
3811  sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)];  sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)];
3812  sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];  sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];
3813  sljit_w no_capture;  sljit_w no_capture;
# Line 3859  if (i < name_count) Line 3859  if (i < name_count)
3859  return condition;  return condition;
3860  }  }
3861    
3862  static sljit_w SLJIT_CALL do_searchgroups(sljit_w recno, sljit_w* locals, uschar *name_table)  static sljit_w SLJIT_CALL do_searchgroups(sljit_w recno, sljit_w* locals, pcre_uchar *name_table)
3863  {  {
3864  int condition = FALSE;  int condition = FALSE;
3865  uschar *slotA = name_table;  pcre_uchar *slotA = name_table;
3866  uschar *slotB;  pcre_uchar *slotB;
3867  sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)];  sljit_w name_count = locals[LOCALS0 / sizeof(sljit_w)];
3868  sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];  sljit_w name_entry_size = locals[LOCALS1 / sizeof(sljit_w)];
3869  sljit_w group_num = locals[POSSESSIVE0 / sizeof(sljit_w)];  sljit_w group_num = locals[POSSESSIVE0 / sizeof(sljit_w)];
# Line 3966  return condition; Line 3966  return condition;
3966                                            Or nothing, if trace is unnecessary                                            Or nothing, if trace is unnecessary
3967  */  */
3968    
3969  static uschar *compile_bracket_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static pcre_uchar *compile_bracket_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
3970  {  {
3971  DEFINE_COMPILER;  DEFINE_COMPILER;
3972  fallback_common *fallback;  fallback_common *fallback;
3973  uschar opcode;  pcre_uchar opcode;
3974  int localptr = 0;  int localptr = 0;
3975  int offset = 0;  int offset = 0;
3976  int stacksize;  int stacksize;
3977  uschar *ccbegin;  pcre_uchar *ccbegin;
3978  uschar *hotpath;  pcre_uchar *hotpath;
3979  uschar bra = OP_BRA;  pcre_uchar bra = OP_BRA;
3980  uschar ket;  pcre_uchar ket;
3981  assert_fallback *assert;  assert_fallback *assert;
3982  BOOL has_alternatives;  BOOL has_alternatives;
3983  struct sljit_jump *jump;  struct sljit_jump *jump;
# Line 4405  cc += 1 + LINK_SIZE; Line 4405  cc += 1 + LINK_SIZE;
4405  return cc;  return cc;
4406  }  }
4407    
4408  static uschar *compile_bracketpos_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static pcre_uchar *compile_bracketpos_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
4409  {  {
4410  DEFINE_COMPILER;  DEFINE_COMPILER;
4411  fallback_common *fallback;  fallback_common *fallback;
4412  uschar opcode;  pcre_uchar opcode;
4413  int localptr;  int localptr;
4414  int cbraprivptr = 0;  int cbraprivptr = 0;
4415  int framesize;  int framesize;
4416  int stacksize;  int stacksize;
4417  int offset = 0;  int offset = 0;
4418  BOOL zero = FALSE;  BOOL zero = FALSE;
4419  uschar *ccbegin = NULL;  pcre_uchar *ccbegin = NULL;
4420  int stack;  int stack;
4421  struct sljit_label *loop = NULL;  struct sljit_label *loop = NULL;
4422  struct jump_list *emptymatch = NULL;  struct jump_list *emptymatch = NULL;
# Line 4623  decrease_call_count(common); Line 4623  decrease_call_count(common);
4623  return cc + 1 + LINK_SIZE;  return cc + 1 + LINK_SIZE;
4624  }  }
4625    
4626  static SLJIT_INLINE uschar *get_iterator_parameters(compiler_common *common, uschar *cc, uschar *opcode, uschar *type, int *arg1, int *arg2, uschar **end)  static SLJIT_INLINE pcre_uchar *get_iterator_parameters(compiler_common *common, pcre_uchar *cc, pcre_uchar *opcode, pcre_uchar *type, int *arg1, int *arg2, pcre_uchar **end)
4627  {  {
4628  int class_len;  int class_len;
4629    
# Line 4715  if (end != NULL) Line 4715  if (end != NULL)
4715  return cc;  return cc;
4716  }  }
4717    
4718  static uschar *compile_iterator_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static pcre_uchar *compile_iterator_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
4719  {  {
4720  DEFINE_COMPILER;  DEFINE_COMPILER;
4721  fallback_common *fallback;  fallback_common *fallback;
4722  uschar opcode;  pcre_uchar opcode;
4723  uschar type;  pcre_uchar type;
4724  int arg1 = -1, arg2 = -1;  int arg1 = -1, arg2 = -1;
4725  uschar* end;  pcre_uchar* end;
4726  jump_list *nomatch = NULL;  jump_list *nomatch = NULL;
4727  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
4728  struct sljit_label *label;  struct sljit_label *label;
# Line 4884  decrease_call_count(common); Line 4884  decrease_call_count(common);
4884  return end;  return end;
4885  }  }
4886    
4887  static SLJIT_INLINE uschar *compile_fail_accept_hotpath(compiler_common *common, uschar *cc, fallback_common *parent)  static SLJIT_INLINE pcre_uchar *compile_fail_accept_hotpath(compiler_common *common, pcre_uchar *cc, fallback_common *parent)
4888  {  {
4889  DEFINE_COMPILER;  DEFINE_COMPILER;
4890  fallback_common *fallback;  fallback_common *fallback;
# Line 4928  add_jump(compiler, &fallback->topfallbac Line 4928  add_jump(compiler, &fallback->topfallbac
4928  return cc + 1;  return cc + 1;
4929  }  }
4930    
4931  static SLJIT_INLINE uschar *compile_close_hotpath(compiler_common *common, uschar *cc)  static SLJIT_INLINE pcre_uchar *compile_close_hotpath(compiler_common *common, pcre_uchar *cc)
4932  {  {
4933  DEFINE_COMPILER;  DEFINE_COMPILER;
4934  int offset = GET2(cc, 1);  int offset = GET2(cc, 1);
# Line 4944  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_R Line 4944  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_R
4944  return cc + 3;  return cc + 3;
4945  }  }
4946    
4947  static void compile_hotpath(compiler_common *common, uschar *cc, uschar *ccend, fallback_common *parent)  static void compile_hotpath(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, fallback_common *parent)
4948  {  {
4949  DEFINE_COMPILER;  DEFINE_COMPILER;
4950  fallback_common *fallback;  fallback_common *fallback;
# Line 5195  SLJIT_ASSERT(cc == ccend); Line 5195  SLJIT_ASSERT(cc == ccend);
5195  static void compile_iterator_fallbackpath(compiler_common *common, struct fallback_common *current)  static void compile_iterator_fallbackpath(compiler_common *common, struct fallback_common *current)
5196  {  {
5197  DEFINE_COMPILER;  DEFINE_COMPILER;
5198  uschar *cc = current->cc;  pcre_uchar *cc = current->cc;
5199  uschar opcode;  pcre_uchar opcode;
5200  uschar type;  pcre_uchar type;
5201  int arg1 = -1, arg2 = -1;  int arg1 = -1, arg2 = -1;
5202  struct sljit_label *label = NULL;  struct sljit_label *label = NULL;
5203  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
# Line 5322  switch(opcode) Line 5322  switch(opcode)
5322  static void compile_ref_iterator_fallbackpath(compiler_common *common, struct fallback_common *current)  static void compile_ref_iterator_fallbackpath(compiler_common *common, struct fallback_common *current)
5323  {  {
5324  DEFINE_COMPILER;  DEFINE_COMPILER;
5325  uschar *cc = current->cc;  pcre_uchar *cc = current->cc;
5326  uschar type;  pcre_uchar type;
5327    
5328  type = cc[3];  type = cc[3];
5329  if ((type & 0x1) == 0)  if ((type & 0x1) == 0)
# Line 5354  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_R Line 5354  OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_R
5354  static void compile_assert_fallbackpath(compiler_common *common, struct fallback_common *current)  static void compile_assert_fallbackpath(compiler_common *common, struct fallback_common *current)
5355  {  {
5356  DEFINE_COMPILER;  DEFINE_COMPILER;
5357  uschar *cc = current->cc;  pcre_uchar *cc = current->cc;
5358  uschar bra = OP_BRA;  pcre_uchar bra = OP_BRA;
5359  struct sljit_jump *brajump = NULL;  struct sljit_jump *brajump = NULL;
5360    
5361  SLJIT_ASSERT(*cc != OP_BRAMINZERO);  SLJIT_ASSERT(*cc != OP_BRAMINZERO);
# Line 5426  int offset = 0; Line 5426  int offset = 0;
5426  int localptr = CURRENT_AS(bracket_fallback)->localptr;  int localptr = CURRENT_AS(bracket_fallback)->localptr;
5427  int stacksize;  int stacksize;
5428  int count;  int count;
5429  uschar *cc = current->cc;  pcre_uchar *cc = current->cc;
5430  uschar *ccbegin;  pcre_uchar *ccbegin;
5431  uschar *ccprev;  pcre_uchar *ccprev;
5432  jump_list *jumplist = NULL;  jump_list *jumplist = NULL;
5433  jump_list *jumplistitem = NULL;  jump_list *jumplistitem = NULL;
5434  uschar bra = OP_BRA;  pcre_uchar bra = OP_BRA;
5435  uschar ket;  pcre_uchar ket;
5436  assert_fallback *assert;  assert_fallback *assert;
5437  BOOL has_alternatives;  BOOL has_alternatives;
5438  struct sljit_jump *brazero = NULL;  struct sljit_jump *brazero = NULL;
# Line 5998  while (current) Line 5998  while (current)
5998  static SLJIT_INLINE void compile_recurse(compiler_common *common)  static SLJIT_INLINE void compile_recurse(compiler_common *common)
5999  {  {
6000  DEFINE_COMPILER;  DEFINE_COMPILER;
6001  uschar *cc = common->start + common->currententry->start;  pcre_uchar *cc = common->start + common->currententry->start;
6002  uschar *ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : 2);  pcre_uchar *ccbegin = cc + 1 + LINK_SIZE + (*cc == OP_BRA ? 0 : 2);
6003  uschar *ccend = bracketend(cc);  pcre_uchar *ccend = bracketend(cc);
6004  int localsize = get_localsize(common, ccbegin, ccend);  int localsize = get_localsize(common, ccbegin, ccend);
6005  int framesize = get_framesize(common, cc, TRUE);  int framesize = get_framesize(common, cc, TRUE);
6006  int alternativesize;  int alternativesize;
# Line 6094  struct sljit_compiler *compiler; Line 6094  struct sljit_compiler *compiler;
6094  fallback_common rootfallback;  fallback_common rootfallback;
6095  compiler_common common_data;  compiler_common common_data;
6096  compiler_common *common = &common_data;  compiler_common *common = &common_data;
6097  const uschar *tables = re->tables;  const pcre_uint8 *tables = re->tables;
6098  pcre_study_data *study;  pcre_study_data *study;
6099  uschar *ccend;  pcre_uchar *ccend;
6100  executable_function *function;  executable_function *function;
6101  void *executable_func;  void *executable_func;
6102  struct sljit_label *leave;  struct sljit_label *leave;
# Line 6114  if (!tables) Line 6114  if (!tables)
6114    tables = _pcre_default_tables;    tables = _pcre_default_tables;
6115    
6116  memset(&rootfallback, 0, sizeof(fallback_common));  memset(&rootfallback, 0, sizeof(fallback_common));
6117  rootfallback.cc = (uschar *)re + re->name_table_offset + re->name_count * re->name_entry_size;  rootfallback.cc = (pcre_uchar *)re + re->name_table_offset + re->name_count * re->name_entry_size;
6118    
6119  common->compiler = NULL;  common->compiler = NULL;
6120  common->start = rootfallback.cc;  common->start = rootfallback.cc;
# Line 6454  union { Line 6454  union {
6454     void* executable_func;     void* executable_func;
6455     jit_function call_executable_func;     jit_function call_executable_func;
6456  } convert_executable_func;  } convert_executable_func;
6457  uschar local_area[LOCAL_SPACE_SIZE];  pcre_uint8 local_area[LOCAL_SPACE_SIZE];
6458  struct sljit_stack local_stack;  struct sljit_stack local_stack;
6459    
6460  local_stack.top = (sljit_w)&local_area;  local_stack.top = (sljit_w)&local_area;

Legend:
Removed from v.755  
changed lines
  Added in v.756

  ViewVC Help
Powered by ViewVC 1.1.5