1 /*
2 * Copyright (c) 1997, 2015, 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 *
640 }
641 if (secondary_super_cache() != NULL) {
642 Klass* ko = secondary_super_cache();
643 guarantee(ko->is_klass(), "should be klass");
644 }
645 for ( uint i = 0; i < primary_super_limit(); i++ ) {
646 Klass* ko = _primary_supers[i];
647 if (ko != NULL) {
648 guarantee(ko->is_klass(), "should be klass");
649 }
650 }
651
652 if (java_mirror() != NULL) {
653 guarantee(java_mirror()->is_oop(), "should be instance");
654 }
655 }
656
657 void Klass::oop_verify_on(oop obj, outputStream* st) {
658 guarantee(obj->is_oop(), "should be oop");
659 guarantee(obj->klass()->is_klass(), "klass field is not a klass");
660 }
661
662 #ifndef PRODUCT
663
664 bool Klass::verify_vtable_index(int i) {
665 int limit = vtable_length()/vtableEntry::size();
666 assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit);
667 return true;
668 }
669
670 bool Klass::verify_itable_index(int i) {
671 assert(is_instance_klass(), "");
672 int method_count = klassItable::method_count_for_interface(this);
673 assert(i >= 0 && i < method_count, "index out of bounds");
674 return true;
675 }
676
677 #endif
678
679 /////////////// Unit tests ///////////////
|
1 /*
2 * Copyright (c) 1997, 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 *
640 }
641 if (secondary_super_cache() != NULL) {
642 Klass* ko = secondary_super_cache();
643 guarantee(ko->is_klass(), "should be klass");
644 }
645 for ( uint i = 0; i < primary_super_limit(); i++ ) {
646 Klass* ko = _primary_supers[i];
647 if (ko != NULL) {
648 guarantee(ko->is_klass(), "should be klass");
649 }
650 }
651
652 if (java_mirror() != NULL) {
653 guarantee(java_mirror()->is_oop(), "should be instance");
654 }
655 }
656
657 void Klass::oop_verify_on(oop obj, outputStream* st) {
658 guarantee(obj->is_oop(), "should be oop");
659 guarantee(obj->klass()->is_klass(), "klass field is not a klass");
660 }
661
662 ByteSize Klass::vtable_start_offset() {
663 return in_ByteSize(InstanceKlass::header_size() * wordSize);
664 }
665
666 #ifndef PRODUCT
667
668 bool Klass::verify_vtable_index(int i) {
669 int limit = vtable_length()/vtableEntry::size();
670 assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit);
671 return true;
672 }
673
674 bool Klass::verify_itable_index(int i) {
675 assert(is_instance_klass(), "");
676 int method_count = klassItable::method_count_for_interface(this);
677 assert(i >= 0 && i < method_count, "index out of bounds");
678 return true;
679 }
680
681 #endif
682
683 /////////////// Unit tests ///////////////
|