1 /*
   2  * Permission is hereby granted, free of charge, to any person obtaining a copy of
   3  * this software and associated documentation files (the "Software"), to deal in
   4  * the Software without restriction, including without limitation the rights to
   5  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
   6  * of the Software, and to permit persons to whom the Software is furnished to do
   7  * so, subject to the following conditions:
   8  *
   9  * The above copyright notice and this permission notice shall be included in all
  10  * copies or substantial portions of the Software.
  11  *
  12  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  18  * SOFTWARE.
  19  */
  20 package jdk.nashorn.internal.runtime.regexp.joni.constants;
  21 
  22 public interface OPSize {
  23 
  24     // this might be helpful for potential byte[] migration
  25     final int OPCODE                = 1;
  26     final int RELADDR               = 1;
  27     final int ABSADDR               = 1;
  28     final int LENGTH                = 1;
  29     final int MEMNUM                = 1;
  30     final int STATE_CHECK_NUM       = 1;
  31     final int REPEATNUM             = 1;
  32     final int OPTION                = 1;
  33     final int CODE_POINT            = 1;
  34     final int POINTER               = 1;
  35     final int INDEX                 = 1;
  36 
  37     /* op-code + arg size */
  38 
  39     final int ANYCHAR_STAR                  = OPCODE;
  40     final int ANYCHAR_STAR_PEEK_NEXT        = (OPCODE + 1);
  41     final int JUMP                          = (OPCODE + RELADDR);
  42     final int PUSH                          = (OPCODE + RELADDR);
  43     final int POP                           = OPCODE;
  44     final int PUSH_OR_JUMP_EXACT1           = (OPCODE + RELADDR + 1);
  45     final int PUSH_IF_PEEK_NEXT             = (OPCODE + RELADDR + 1);
  46     final int REPEAT_INC                    = (OPCODE + MEMNUM);
  47     final int REPEAT_INC_NG                 = (OPCODE + MEMNUM);
  48     final int PUSH_POS                      = OPCODE;
  49     final int PUSH_POS_NOT                  = (OPCODE + RELADDR);
  50     final int POP_POS                       = OPCODE;
  51     final int FAIL_POS                      = OPCODE;
  52     final int SET_OPTION                    = (OPCODE + OPTION);
  53     final int SET_OPTION_PUSH               = (OPCODE + OPTION);
  54     final int FAIL                          = OPCODE;
  55     final int MEMORY_START                  = (OPCODE + MEMNUM);
  56     final int MEMORY_START_PUSH             = (OPCODE + MEMNUM);
  57     final int MEMORY_END_PUSH               = (OPCODE + MEMNUM);
  58     final int MEMORY_END_PUSH_REC           = (OPCODE + MEMNUM);
  59     final int MEMORY_END                    = (OPCODE + MEMNUM);
  60     final int MEMORY_END_REC                = (OPCODE + MEMNUM);
  61     final int PUSH_STOP_BT                  = OPCODE;
  62     final int POP_STOP_BT                   = OPCODE;
  63     final int NULL_CHECK_START              = (OPCODE + MEMNUM);
  64     final int NULL_CHECK_END                = (OPCODE + MEMNUM);
  65     final int LOOK_BEHIND                   = (OPCODE + LENGTH);
  66     final int PUSH_LOOK_BEHIND_NOT          = (OPCODE + RELADDR + LENGTH);
  67     final int FAIL_LOOK_BEHIND_NOT          = OPCODE;
  68     final int CALL                          = (OPCODE + ABSADDR);
  69     final int RETURN                        = OPCODE;
  70 
  71     // #ifdef USE_COMBINATION_EXPLOSION_CHECK
  72     final int STATE_CHECK                   = (OPCODE + STATE_CHECK_NUM);
  73     final int STATE_CHECK_PUSH              = (OPCODE + STATE_CHECK_NUM + RELADDR);
  74     final int STATE_CHECK_PUSH_OR_JUMP      = (OPCODE + STATE_CHECK_NUM + RELADDR);
  75     final int STATE_CHECK_ANYCHAR_STAR      = (OPCODE + STATE_CHECK_NUM);
  76 }