/[pcre]/code/trunk/pcre_jit_compile.c
ViewVC logotype

Diff of /code/trunk/pcre_jit_compile.c

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

revision 1507 by zherczeg, Tue Sep 30 06:35:20 2014 UTC revision 1508 by zherczeg, Mon Oct 6 06:55:29 2014 UTC
# Line 545  the start pointers when the end of the c Line 545  the start pointers when the end of the c
545    
546  #define READ_CHAR_MAX 0x7fffffff  #define READ_CHAR_MAX 0x7fffffff
547    
548  static pcre_uchar* bracketend(pcre_uchar* cc)  static pcre_uchar *bracketend(pcre_uchar *cc)
549  {  {
550  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));
551  do cc += GET(cc, 1); while (*cc == OP_ALT);  do cc += GET(cc, 1); while (*cc == OP_ALT);
# Line 554  cc += 1 + LINK_SIZE; Line 554  cc += 1 + LINK_SIZE;
554  return cc;  return cc;
555  }  }
556    
557  static int no_alternatives(pcre_uchar* cc)  static int no_alternatives(pcre_uchar *cc)
558  {  {
559  int count = 0;  int count = 0;
560  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));
# Line 1237  while (cc < ccend) Line 1237  while (cc < ccend)
1237  }  }
1238    
1239  /* Returns with a frame_types (always < 0) if no need for frame. */  /* Returns with a frame_types (always < 0) if no need for frame. */
1240  static int get_framesize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, BOOL recursive, BOOL* needs_control_head)  static int get_framesize(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend, BOOL recursive, BOOL *needs_control_head)
1241  {  {
1242  int length = 0;  int length = 0;
1243  int possessive = 0;  int possessive = 0;
# Line 2030  while (list) Line 2030  while (list)
2030    }    }
2031  }  }
2032    
2033  static SLJIT_INLINE void add_jump(struct sljit_compiler *compiler, jump_list **list, struct sljit_jump* jump)  static SLJIT_INLINE void add_jump(struct sljit_compiler *compiler, jump_list **list, struct sljit_jump *jump)
2034  {  {
2035  jump_list *list_item = sljit_alloc_memory(compiler, sizeof(jump_list));  jump_list *list_item = sljit_alloc_memory(compiler, sizeof(jump_list));
2036  if (list_item)  if (list_item)
# Line 2044  if (list_item) Line 2044  if (list_item)
2044  static void add_stub(compiler_common *common, struct sljit_jump *start)  static void add_stub(compiler_common *common, struct sljit_jump *start)
2045  {  {
2046  DEFINE_COMPILER;  DEFINE_COMPILER;
2047  stub_list* list_item = sljit_alloc_memory(compiler, sizeof(stub_list));  stub_list *list_item = sljit_alloc_memory(compiler, sizeof(stub_list));
2048    
2049  if (list_item)  if (list_item)
2050    {    {
# Line 2058  if (list_item) Line 2058  if (list_item)
2058  static void flush_stubs(compiler_common *common)  static void flush_stubs(compiler_common *common)
2059  {  {
2060  DEFINE_COMPILER;  DEFINE_COMPILER;
2061  stub_list* list_item = common->stubs;  stub_list *list_item = common->stubs;
2062    
2063  while (list_item)  while (list_item)
2064    {    {
# Line 2314  else if (common->mode == JIT_PARTIAL_HAR Line 2314  else if (common->mode == JIT_PARTIAL_HAR
2314    }    }
2315  }  }
2316    
2317  static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, pcre_uchar* cc)  static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, pcre_uchar *cc)
2318  {  {
2319  /* Detects if the character has an othercase. */  /* Detects if the character has an othercase. */
2320  unsigned int c;  unsigned int c;
# Line 2357  if (common->utf && c > 127) Line 2357  if (common->utf && c > 127)
2357  return TABLE_GET(c, common->fcc, c);  return TABLE_GET(c, common->fcc, c);
2358  }  }
2359    
2360  static unsigned int char_get_othercase_bit(compiler_common *common, pcre_uchar* cc)  static unsigned int char_get_othercase_bit(compiler_common *common, pcre_uchar *cc)
2361  {  {
2362  /* Detects if the character and its othercase has only 1 bit difference. */  /* Detects if the character and its othercase has only 1 bit difference. */
2363  unsigned int c, oc, bit;  unsigned int c, oc, bit;
# Line 2572  static BOOL is_char7_bitset(const pcre_u Line 2572  static BOOL is_char7_bitset(const pcre_u
2572  /* Tells whether the character codes below 128 are enough  /* Tells whether the character codes below 128 are enough
2573  to determine a match. */  to determine a match. */
2574  const pcre_uint8 value = nclass ? 0xff : 0;  const pcre_uint8 value = nclass ? 0xff : 0;
2575  const pcre_uint8* end = bitset + 32;  const pcre_uint8 *end = bitset + 32;
2576    
2577  bitset += 16;  bitset += 16;
2578  do  do
# Line 4555  return src2; Line 4555  return src2;
4555  #endif /* SUPPORT_UTF && SUPPORT_UCP */  #endif /* SUPPORT_UTF && SUPPORT_UCP */
4556    
4557  static pcre_uchar *byte_sequence_compare(compiler_common *common, BOOL caseless, pcre_uchar *cc,  static pcre_uchar *byte_sequence_compare(compiler_common *common, BOOL caseless, pcre_uchar *cc,
4558      compare_context* context, jump_list **backtracks)      compare_context *context, jump_list **backtracks)
4559  {  {
4560  DEFINE_COMPILER;  DEFINE_COMPILER;
4561  unsigned int othercasebit = 0;  unsigned int othercasebit = 0;
# Line 6304  add_jump(compiler, &backtrack->topbacktr Line 6304  add_jump(compiler, &backtrack->topbacktr
6304  return cc + 1 + LINK_SIZE;  return cc + 1 + LINK_SIZE;
6305  }  }
6306    
6307  static int SLJIT_CALL do_callout(struct jit_arguments* arguments, PUBL(callout_block) *callout_block, pcre_uchar **jit_ovector)  static int SLJIT_CALL do_callout(struct jit_arguments *arguments, PUBL(callout_block) *callout_block, pcre_uchar **jit_ovector)
6308  {  {
6309  const pcre_uchar *begin = arguments->begin;  const pcre_uchar *begin = arguments->begin;
6310  int *offset_vector = arguments->offsets;  int *offset_vector = arguments->offsets;
# Line 6364  PUSH_BACKTRACK(sizeof(backtrack_common), Line 6364  PUSH_BACKTRACK(sizeof(backtrack_common),
6364    
6365  allocate_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));  allocate_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
6366    
6367    SLJIT_ASSERT(common->capture_last_ptr != 0);
6368  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);  OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
6369  OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);  OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
 SLJIT_ASSERT(common->capture_last_ptr != 0);  
6370  OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(callout_number), SLJIT_IMM, cc[1]);  OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(callout_number), SLJIT_IMM, cc[1]);
6371  OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(capture_last), TMP2, 0);  OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(capture_last), TMP2, 0);
6372    
# Line 7848  backtrack_common *backtrack; Line 7848  backtrack_common *backtrack;
7848  pcre_uchar opcode;  pcre_uchar opcode;
7849  pcre_uchar type;  pcre_uchar type;
7850  int max = -1, min = -1;  int max = -1, min = -1;
7851  pcre_uchar* end;  pcre_uchar *end;
7852  jump_list *nomatch = NULL;  jump_list *nomatch = NULL;
7853  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
7854  struct sljit_label *label;  struct sljit_label *label;
# Line 10022  if ((re->options & PCRE_ANCHORED) == 0) Line 10022  if ((re->options & PCRE_ANCHORED) == 0)
10022        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);
10023      else if ((re->flags & PCRE_STARTLINE) != 0)      else if ((re->flags & PCRE_STARTLINE) != 0)
10024        fast_forward_newline(common, (re->options & PCRE_FIRSTLINE) != 0);        fast_forward_newline(common, (re->options & PCRE_FIRSTLINE) != 0);
10025      else if ((re->flags & PCRE_STARTLINE) == 0 && study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)      else if (study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)
10026        fast_forward_start_bits(common, study->start_bits, (re->options & PCRE_FIRSTLINE) != 0);        fast_forward_start_bits(common, study->start_bits, (re->options & PCRE_FIRSTLINE) != 0);
10027      }      }
10028    }    }
# Line 10359  functions->read_only_data[mode] = common Line 10359  functions->read_only_data[mode] = common
10359  functions->executable_sizes[mode] = executable_size;  functions->executable_sizes[mode] = executable_size;
10360  }  }
10361    
10362  static int jit_machine_stack_exec(jit_arguments *arguments, void* executable_func)  static int jit_machine_stack_exec(jit_arguments *arguments, void *executable_func)
10363  {  {
10364  union {  union {
10365     void* executable_func;     void *executable_func;
10366     jit_function call_executable_func;     jit_function call_executable_func;
10367  } convert_executable_func;  } convert_executable_func;
10368  pcre_uint8 local_space[MACHINE_STACK_SIZE];  pcre_uint8 local_space[MACHINE_STACK_SIZE];
# Line 10383  PRIV(jit_exec)(const PUBL(extra) *extra_ Line 10383  PRIV(jit_exec)(const PUBL(extra) *extra_
10383  {  {
10384  executable_functions *functions = (executable_functions *)extra_data->executable_jit;  executable_functions *functions = (executable_functions *)extra_data->executable_jit;
10385  union {  union {
10386     void* executable_func;     void *executable_func;
10387     jit_function call_executable_func;     jit_function call_executable_func;
10388  } convert_executable_func;  } convert_executable_func;
10389  jit_arguments arguments;  jit_arguments arguments;
# Line 10470  pcre32_jit_exec(const pcre32 *argument_r Line 10470  pcre32_jit_exec(const pcre32 *argument_r
10470  pcre_uchar *subject_ptr = (pcre_uchar *)subject;  pcre_uchar *subject_ptr = (pcre_uchar *)subject;
10471  executable_functions *functions = (executable_functions *)extra_data->executable_jit;  executable_functions *functions = (executable_functions *)extra_data->executable_jit;
10472  union {  union {
10473     void* executable_func;     void *executable_func;
10474     jit_function call_executable_func;     jit_function call_executable_func;
10475  } convert_executable_func;  } convert_executable_func;
10476  jit_arguments arguments;  jit_arguments arguments;

Legend:
Removed from v.1507  
changed lines
  Added in v.1508

  ViewVC Help
Powered by ViewVC 1.1.5