1 /*
2 * Copyright (c) 1998, 2006, 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 // The verifier class
26 class Verifier : AllStatic {
27 public:
28 enum {
29 STACKMAP_ATTRIBUTE_MAJOR_VERSION = 50,
30 INVOKEDYNAMIC_MAJOR_VERSION = 51
31 };
32 typedef enum { ThrowException, NoException } Mode;
33
34 /**
35 * Verify the bytecodes for a class. If 'throw_exception' is true
36 * then the appropriate VerifyError or ClassFormatError will be thrown.
37 * Otherwise, no exception is thrown and the return indicates the
38 * error.
39 */
40 static bool verify(instanceKlassHandle klass, Mode mode, bool should_verify_class, TRAPS);
41
42 // Return false if the class is loaded by the bootstrap loader,
43 // or if defineClass was called requesting skipping verification
44 // -Xverify:all/none override this value
237 return 2;
238 case T_DOUBLE:
239 *inference_type = VerificationType::double_type();
240 *++inference_type = VerificationType::double2_type();
241 return 2;
242 case T_INT:
243 case T_BOOLEAN:
244 case T_BYTE:
245 case T_CHAR:
246 case T_SHORT:
247 *inference_type = VerificationType::integer_type();
248 return 1;
249 case T_FLOAT:
250 *inference_type = VerificationType::float_type();
251 return 1;
252 default:
253 ShouldNotReachHere();
254 return 1;
255 }
256 }
|
1 /*
2 * Copyright (c) 1998, 2010, 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 #ifndef SHARE_VM_CLASSFILE_VERIFIER_HPP
26 #define SHARE_VM_CLASSFILE_VERIFIER_HPP
27
28 #include "classfile/verificationType.hpp"
29 #include "memory/gcLocker.hpp"
30 #include "oops/klass.hpp"
31 #include "oops/methodOop.hpp"
32 #include "runtime/handles.hpp"
33 #include "utilities/exceptions.hpp"
34
35 // The verifier class
36 class Verifier : AllStatic {
37 public:
38 enum {
39 STACKMAP_ATTRIBUTE_MAJOR_VERSION = 50,
40 INVOKEDYNAMIC_MAJOR_VERSION = 51
41 };
42 typedef enum { ThrowException, NoException } Mode;
43
44 /**
45 * Verify the bytecodes for a class. If 'throw_exception' is true
46 * then the appropriate VerifyError or ClassFormatError will be thrown.
47 * Otherwise, no exception is thrown and the return indicates the
48 * error.
49 */
50 static bool verify(instanceKlassHandle klass, Mode mode, bool should_verify_class, TRAPS);
51
52 // Return false if the class is loaded by the bootstrap loader,
53 // or if defineClass was called requesting skipping verification
54 // -Xverify:all/none override this value
247 return 2;
248 case T_DOUBLE:
249 *inference_type = VerificationType::double_type();
250 *++inference_type = VerificationType::double2_type();
251 return 2;
252 case T_INT:
253 case T_BOOLEAN:
254 case T_BYTE:
255 case T_CHAR:
256 case T_SHORT:
257 *inference_type = VerificationType::integer_type();
258 return 1;
259 case T_FLOAT:
260 *inference_type = VerificationType::float_type();
261 return 1;
262 default:
263 ShouldNotReachHere();
264 return 1;
265 }
266 }
267
268 #endif // SHARE_VM_CLASSFILE_VERIFIER_HPP
|