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 @SuppressWarnings("javadoc")
23 public interface OPSize {
24 
25     // this might be helpful for potential byte[] migration
26     final int OPCODE                = 1;
27     final int RELADDR               = 1;
28     final int ABSADDR               = 1;
29     final int LENGTH                = 1;
30     final int MEMNUM                = 1;
31     final int STATE_CHECK_NUM       = 1;
32     final int REPEATNUM             = 1;
33     final int OPTION                = 1;
34     final int CODE_POINT            = 1;
35     final int POINTER               = 1;
36     final int INDEX                 = 1;
37 
38     /* op-code + arg size */
39 
40     final int ANYCHAR_STAR                  = OPCODE;
41     final int ANYCHAR_STAR_PEEK_NEXT        = (OPCODE + 1);
42     final int JUMP                          = (OPCODE + RELADDR);
43     final int PUSH                          = (OPCODE + RELADDR);
44     final int POP                           = OPCODE;
45     final int PUSH_OR_JUMP_EXACT1           = (OPCODE + RELADDR + 1);
46     final int PUSH_IF_PEEK_NEXT             = (OPCODE + RELADDR + 1);
47     final int REPEAT_INC                    = (OPCODE + MEMNUM);
48     final int REPEAT_INC_NG                 = (OPCODE + MEMNUM);
49     final int PUSH_POS                      = OPCODE;
50     final int PUSH_POS_NOT                  = (OPCODE + RELADDR);
51     final int POP_POS                       = OPCODE;
52     final int FAIL_POS                      = OPCODE;
53     final int SET_OPTION                    = (OPCODE + OPTION);
54     final int SET_OPTION_PUSH               = (OPCODE + OPTION);
55     final int FAIL                          = OPCODE;
56     final int MEMORY_START                  = (OPCODE + MEMNUM);
57     final int MEMORY_START_PUSH             = (OPCODE + MEMNUM);
58     final int MEMORY_END_PUSH               = (OPCODE + MEMNUM);
59     final int MEMORY_END_PUSH_REC           = (OPCODE + MEMNUM);
60     final int MEMORY_END                    = (OPCODE + MEMNUM);
61     final int MEMORY_END_REC                = (OPCODE + MEMNUM);
62     final int PUSH_STOP_BT                  = OPCODE;
63     final int POP_STOP_BT                   = OPCODE;
64     final int NULL_CHECK_START              = (OPCODE + MEMNUM);
65     final int NULL_CHECK_END                = (OPCODE + MEMNUM);
66     final int LOOK_BEHIND                   = (OPCODE + LENGTH);
67     final int PUSH_LOOK_BEHIND_NOT          = (OPCODE + RELADDR + LENGTH);
68     final int FAIL_LOOK_BEHIND_NOT          = OPCODE;
69     final int CALL                          = (OPCODE + ABSADDR);
70     final int RETURN                        = OPCODE;
71 
72     // #ifdef USE_COMBINATION_EXPLOSION_CHECK
73     final int STATE_CHECK                   = (OPCODE + STATE_CHECK_NUM);
74     final int STATE_CHECK_PUSH              = (OPCODE + STATE_CHECK_NUM + RELADDR);
75     final int STATE_CHECK_PUSH_OR_JUMP      = (OPCODE + STATE_CHECK_NUM + RELADDR);
76     final int STATE_CHECK_ANYCHAR_STAR      = (OPCODE + STATE_CHECK_NUM);
77 }
78