1 /*
  2  * Copyright (c) 2016, 2019, 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 
 25 package gc.stress.gcbasher;
 26 
 27 class Bytecode {
 28     public static final int IINC               = 132;
 29     public static final int TABLESWITCH        = 170;
 30     public static final int LOOKUPSWITCH       = 171;
 31     public static final int GETSTATIC          = 178;
 32     public static final int PUTSTATIC          = 179;
 33     public static final int GETFIELD           = 180;
 34     public static final int PUTFIELD           = 181;
 35     public static final int INVOKEVIRTUAL      = 182;
 36     public static final int INVOKESPECIAL      = 183;
 37     public static final int INVOKESTATIC       = 184;
 38     public static final int INVOKEINTERFACE    = 185;
 39     public static final int NEW                = 187;
 40     public static final int ANEWARRAY          = 189;
 41     public static final int CHECKCAST          = 192;
 42     public static final int INSTANCEOF         = 193;
 43     public static final int MULTIANEWARRAY     = 197;
 44     public static final int WIDE               = 196;
 45 
 46     private static final int lengths[] = {
 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         1,
 62         1,
 63         2,
 64         3,
 65         2,
 66         3,
 67         3,
 68         2,
 69         2,
 70         2,
 71         2,
 72         2,
 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         1,
100         1,
101         2,
102         2,
103         2,
104         2,
105         2,
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         1,
178         1,
179         3,
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         1,
199         1,
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         3,
215         3,
216         2,
217         99,
218         99,
219         1,
220         1,
221         1,
222         1,
223         1,
224         1,
225         3,
226         3,
227         3,
228         3,
229         3,
230         3,
231         3,
232         5,
233         5,
234         3,
235         2,
236         3,
237         1,
238         1,
239         3,
240         3,
241         1,
242         1,
243         0,
244         4,
245         3,
246         3,
247         5,
248         5,
249         1
250     };
251 
252     public static int getLength(int bc) throws IllegalArgumentException {
253         if ((bc < 0) || (bc >= lengths.length)) {
254             throw new IllegalArgumentException("Unknown bytecode " + bc);
255         }
256         return lengths[bc];
257     }
258 }