1/*
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25class Bytecode {
26    public static final int IINC               = 132;
27    public static final int TABLESWITCH        = 170;
28    public static final int LOOKUPSWITCH       = 171;
29    public static final int GETSTATIC          = 178;
30    public static final int PUTSTATIC          = 179;
31    public static final int GETFIELD           = 180;
32    public static final int PUTFIELD           = 181;
33    public static final int INVOKEVIRTUAL      = 182;
34    public static final int INVOKESPECIAL      = 183;
35    public static final int INVOKESTATIC       = 184;
36    public static final int INVOKEINTERFACE    = 185;
37    public static final int NEW                = 187;
38    public static final int ANEWARRAY          = 189;
39    public static final int CHECKCAST          = 192;
40    public static final int INSTANCEOF         = 193;
41    public static final int MULTIANEWARRAY     = 197;
42    public static final int WIDE               = 196;
43
44    private static final int lengths[] = {
45        1,
46        1,
47        1,
48        1,
49        1,
50        1,
51        1,
52        1,
53        1,
54        1,
55        1,
56        1,
57        1,
58        1,
59        1,
60        1,
61        2,
62        3,
63        2,
64        3,
65        3,
66        2,
67        2,
68        2,
69        2,
70        2,
71        1,
72        1,
73        1,
74        1,
75        1,
76        1,
77        1,
78        1,
79        1,
80        1,
81        1,
82        1,
83        1,
84        1,
85        1,
86        1,
87        1,
88        1,
89        1,
90        1,
91        1,
92        1,
93        1,
94        1,
95        1,
96        1,
97        1,
98        1,
99        2,
100        2,
101        2,
102        2,
103        2,
104        1,
105        1,
106        1,
107        1,
108        1,
109        1,
110        1,
111        1,
112        1,
113        1,
114        1,
115        1,
116        1,
117        1,
118        1,
119        1,
120        1,
121        1,
122        1,
123        1,
124        1,
125        1,
126        1,
127        1,
128        1,
129        1,
130        1,
131        1,
132        1,
133        1,
134        1,
135        1,
136        1,
137        1,
138        1,
139        1,
140        1,
141        1,
142        1,
143        1,
144        1,
145        1,
146        1,
147        1,
148        1,
149        1,
150        1,
151        1,
152        1,
153        1,
154        1,
155        1,
156        1,
157        1,
158        1,
159        1,
160        1,
161        1,
162        1,
163        1,
164        1,
165        1,
166        1,
167        1,
168        1,
169        1,
170        1,
171        1,
172        1,
173        1,
174        1,
175        1,
176        1,
177        3,
178        1,
179        1,
180        1,
181        1,
182        1,
183        1,
184        1,
185        1,
186        1,
187        1,
188        1,
189        1,
190        1,
191        1,
192        1,
193        1,
194        1,
195        1,
196        1,
197        1,
198        3,
199        3,
200        3,
201        3,
202        3,
203        3,
204        3,
205        3,
206        3,
207        3,
208        3,
209        3,
210        3,
211        3,
212        3,
213        3,
214        2,
215        99,
216        99,
217        1,
218        1,
219        1,
220        1,
221        1,
222        1,
223        3,
224        3,
225        3,
226        3,
227        3,
228        3,
229        3,
230        5,
231        5,
232        3,
233        2,
234        3,
235        1,
236        1,
237        3,
238        3,
239        1,
240        1,
241        0,
242        4,
243        3,
244        3,
245        5,
246        5,
247        1
248    };
249
250    public static int getLength(int bc) throws IllegalArgumentException {
251        if ((bc < 0) || (bc >= lengths.length)) {
252            throw new IllegalArgumentException("Unknown bytecode " + bc);
253        }
254        return lengths[bc];
255    }
256}
257