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 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "classfile/classFileStream.hpp"
28 #include "classfile/javaClasses.hpp"
29 #include "classfile/stackMapTable.hpp"
30 #include "classfile/stackMapFrame.hpp"
31 #include "classfile/stackMapTableFormat.hpp"
32 #include "classfile/systemDictionary.hpp"
33 #include "classfile/verifier.hpp"
34 #include "classfile/vmSymbols.hpp"
35 #include "interpreter/bytecodes.hpp"
36 #include "interpreter/bytecodeStream.hpp"
37 #include "logging/log.hpp"
38 #include "logging/logStream.hpp"
39 #include "memory/oopFactory.hpp"
40 #include "memory/resourceArea.hpp"
41 #include "oops/constantPool.inline.hpp"
42 #include "oops/instanceKlass.hpp"
43 #include "oops/oop.inline.hpp"
44 #include "oops/typeArrayOop.hpp"
45 #include "runtime/fieldDescriptor.hpp"
46 #include "runtime/handles.inline.hpp"
47 #include "runtime/interfaceSupport.inline.hpp"
48 #include "runtime/javaCalls.hpp"
49 #include "runtime/jniHandles.inline.hpp"
50 #include "runtime/orderAccess.hpp"
51 #include "runtime/os.hpp"
52 #include "runtime/safepointVerifiers.hpp"
594 }
595
596 void ClassVerifier::verify_class(TRAPS) {
597 log_info(verification)("Verifying class %s with new format", _klass->external_name());
598
599 Array<Method*>* methods = _klass->methods();
600 int num_methods = methods->length();
601
602 for (int index = 0; index < num_methods; index++) {
603 // Check for recursive re-verification before each method.
604 if (was_recursively_verified()) return;
605
606 Method* m = methods->at(index);
607 if (m->is_native() || m->is_abstract() || m->is_overpass()) {
608 // If m is native or abstract, skip it. It is checked in class file
609 // parser that methods do not override a final method. Overpass methods
610 // are trusted since the VM generates them.
611 continue;
612 }
613 verify_method(methodHandle(THREAD, m), CHECK_VERIFY(this));
614 }
615
616 if (was_recursively_verified()){
617 log_info(verification)("Recursive verification detected for: %s", _klass->external_name());
618 log_info(class, init)("Recursive verification detected for: %s",
619 _klass->external_name());
620 }
621 }
622
623 void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
624 HandleMark hm(THREAD);
625 _method = m; // initialize _method
626 log_info(verification)("Verifying method %s", m->name_and_sig_as_C_string());
627
628 // For clang, the only good constant format string is a literal constant format string.
629 #define bad_type_msg "Bad type on operand stack in %s"
630
631 int32_t max_stack = m->verifier_max_stack();
632 int32_t max_locals = m->max_locals();
633 constantPoolHandle cp(THREAD, m->constants());
|
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 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "classfile/classFileStream.hpp"
28 #include "classfile/javaClasses.hpp"
29 #include "classfile/stackMapTable.hpp"
30 #include "classfile/stackMapFrame.hpp"
31 #include "classfile/stackMapTableFormat.hpp"
32 #include "classfile/systemDictionary.hpp"
33 #include "classfile/systemDictionaryShared.hpp"
34 #include "classfile/verifier.hpp"
35 #include "classfile/vmSymbols.hpp"
36 #include "interpreter/bytecodes.hpp"
37 #include "interpreter/bytecodeStream.hpp"
38 #include "logging/log.hpp"
39 #include "logging/logStream.hpp"
40 #include "memory/oopFactory.hpp"
41 #include "memory/resourceArea.hpp"
42 #include "oops/constantPool.inline.hpp"
43 #include "oops/instanceKlass.hpp"
44 #include "oops/oop.inline.hpp"
45 #include "oops/typeArrayOop.hpp"
46 #include "runtime/fieldDescriptor.hpp"
47 #include "runtime/handles.inline.hpp"
48 #include "runtime/interfaceSupport.inline.hpp"
49 #include "runtime/javaCalls.hpp"
50 #include "runtime/jniHandles.inline.hpp"
51 #include "runtime/orderAccess.hpp"
52 #include "runtime/os.hpp"
53 #include "runtime/safepointVerifiers.hpp"
595 }
596
597 void ClassVerifier::verify_class(TRAPS) {
598 log_info(verification)("Verifying class %s with new format", _klass->external_name());
599
600 Array<Method*>* methods = _klass->methods();
601 int num_methods = methods->length();
602
603 for (int index = 0; index < num_methods; index++) {
604 // Check for recursive re-verification before each method.
605 if (was_recursively_verified()) return;
606
607 Method* m = methods->at(index);
608 if (m->is_native() || m->is_abstract() || m->is_overpass()) {
609 // If m is native or abstract, skip it. It is checked in class file
610 // parser that methods do not override a final method. Overpass methods
611 // are trusted since the VM generates them.
612 continue;
613 }
614 verify_method(methodHandle(THREAD, m), CHECK_VERIFY(this));
615 }
616
617 if (DumpSharedSpaces) {
618 SystemDictionaryShared::finalize_verification_constraints(_klass);
619 }
620
621 if (was_recursively_verified()){
622 log_info(verification)("Recursive verification detected for: %s", _klass->external_name());
623 log_info(class, init)("Recursive verification detected for: %s",
624 _klass->external_name());
625 }
626 }
627
628 void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
629 HandleMark hm(THREAD);
630 _method = m; // initialize _method
631 log_info(verification)("Verifying method %s", m->name_and_sig_as_C_string());
632
633 // For clang, the only good constant format string is a literal constant format string.
634 #define bad_type_msg "Bad type on operand stack in %s"
635
636 int32_t max_stack = m->verifier_max_stack();
637 int32_t max_locals = m->max_locals();
638 constantPoolHandle cp(THREAD, m->constants());
|