/[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 974 by zherczeg, Sat Jun 2 05:56:58 2012 UTC revision 977 by zherczeg, Sun Jun 17 06:20:52 2012 UTC
# Line 5438  switch(opcode) Line 5438  switch(opcode)
5438      }      }
5439    else    else
5440      {      {
5441        if (opcode == OP_PLUS)
5442          compile_char1_trypath(common, type, cc, &backtrack->topbacktracks);
5443      allocate_stack(common, 2);      allocate_stack(common, 2);
5444      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
5445      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 1);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 1);
# Line 5457  switch(opcode) Line 5459  switch(opcode)
5459        CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 1, label);        CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 1, label);
5460        }        }
5461      set_jumps(nomatch, LABEL());      set_jumps(nomatch, LABEL());
5462      if (opcode == OP_PLUS || opcode == OP_CRRANGE)      if (opcode == OP_CRRANGE)
5463        add_jump(compiler, &backtrack->topbacktracks,        add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_LESS, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, arg2 + 1));
         CMP(SLJIT_C_LESS, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, opcode == OP_PLUS ? 2 : arg2 + 1));  
5464      OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));      OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
5465      }      }
5466    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();
# Line 5467  switch(opcode) Line 5468  switch(opcode)
5468    
5469    case OP_MINSTAR:    case OP_MINSTAR:
5470    case OP_MINPLUS:    case OP_MINPLUS:
5471      if (opcode == OP_MINPLUS)
5472        compile_char1_trypath(common, type, cc, &backtrack->topbacktracks);
5473    allocate_stack(common, 1);    allocate_stack(common, 1);
5474    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
   if (opcode == OP_MINPLUS)  
     add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_JUMP));  
5475    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();    BACKTRACK_AS(iterator_backtrack)->trypath = LABEL();
5476    break;    break;
5477    
# Line 5886  pcre_uchar type; Line 5887  pcre_uchar type;
5887  int arg1 = -1, arg2 = -1;  int arg1 = -1, arg2 = -1;
5888  struct sljit_label *label = NULL;  struct sljit_label *label = NULL;
5889  struct sljit_jump *jump = NULL;  struct sljit_jump *jump = NULL;
5890    jump_list *jumplist = NULL;
5891    
5892  cc = get_iterator_parameters(common, cc, &opcode, &type, &arg1, &arg2, NULL);  cc = get_iterator_parameters(common, cc, &opcode, &type, &arg1, &arg2, NULL);
5893    
# Line 5904  switch(opcode) Line 5906  switch(opcode)
5906      }      }
5907    else    else
5908      {      {
5909      if (opcode == OP_STAR || opcode == OP_UPTO)      if (opcode <= OP_PLUS || opcode == OP_UPTO)
5910        arg2 = 0;        arg2 = 0;
5911      else if (opcode == OP_PLUS)      OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
5912        arg2 = 1;      jump = CMP(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, arg2 + 1);
5913      jump = CMP(SLJIT_C_LESS_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, arg2 + 1);      OP2(SLJIT_SUB, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0, SLJIT_IMM, 1);
     OP2(SLJIT_SUB, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 1);  
5914      OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));      OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
5915      skip_char_back(common);      skip_char_back(common);
5916      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);      OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
5917      JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);      JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);
5918      if (opcode == OP_PLUS || opcode == OP_CRRANGE)      if (opcode == OP_CRRANGE)
5919        set_jumps(current->topbacktracks, LABEL());        set_jumps(current->topbacktracks, LABEL());
5920      JUMPHERE(jump);      JUMPHERE(jump);
5921      free_stack(common, 2);      free_stack(common, 2);
5922        if (opcode == OP_PLUS)
5923          set_jumps(current->topbacktracks, LABEL());
5924      }      }
5925    break;    break;
5926    
5927    case OP_MINSTAR:    case OP_MINSTAR:
5928    case OP_MINPLUS:    case OP_MINPLUS:
5929    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
5930    if (opcode == OP_MINPLUS)    compile_char1_trypath(common, type, cc, &jumplist);
     {  
     set_jumps(current->topbacktracks, LABEL());  
     current->topbacktracks = NULL;  
     }  
   compile_char1_trypath(common, type, cc, &current->topbacktracks);  
5931    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
5932    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);
5933    set_jumps(current->topbacktracks, LABEL());    set_jumps(jumplist, LABEL());
5934    free_stack(common, 1);    free_stack(common, 1);
5935      if (opcode == OP_MINPLUS)
5936        set_jumps(current->topbacktracks, LABEL());
5937    break;    break;
5938    
5939    case OP_MINUPTO:    case OP_MINUPTO:
5940    case OP_CRMINRANGE:    case OP_CRMINRANGE:
5941    if (opcode == OP_CRMINRANGE)    if (opcode == OP_CRMINRANGE)
5942      {      {
     set_jumps(current->topbacktracks, LABEL());  
     current->topbacktracks = NULL;  
5943      label = LABEL();      label = LABEL();
5944        set_jumps(current->topbacktracks, label);
5945      }      }
5946    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
5947    compile_char1_trypath(common, type, cc, &current->topbacktracks);    compile_char1_trypath(common, type, cc, &jumplist);
5948    
5949    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));    OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
5950    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
# Line 5960  switch(opcode) Line 5959  switch(opcode)
5959    else    else
5960      CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 2, CURRENT_AS(iterator_backtrack)->trypath);      CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 2, CURRENT_AS(iterator_backtrack)->trypath);
5961    
5962    set_jumps(current->topbacktracks, LABEL());    set_jumps(jumplist, LABEL());
5963    free_stack(common, 2);    free_stack(common, 2);
5964    break;    break;
5965    
# Line 5981  switch(opcode) Line 5980  switch(opcode)
5980    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));    OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
5981    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);    OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
5982    jump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);    jump = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_IMM, 0);
5983    compile_char1_trypath(common, type, cc, &current->topbacktracks);    compile_char1_trypath(common, type, cc, &jumplist);
5984    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);    JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->trypath);
5985    set_jumps(current->topbacktracks, LABEL());    set_jumps(jumplist, LABEL());
5986    JUMPHERE(jump);    JUMPHERE(jump);
5987    free_stack(common, 1);    free_stack(common, 1);
5988    break;    break;

Legend:
Removed from v.974  
changed lines
  Added in v.977

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12