comparison src/share/vm/oops/klassVtable.cpp @ 676:d3676b4cb78c

Merge
author kvn
date Tue, 31 Mar 2009 10:02:01 -0700
parents 4aaa9f5e02a8 c89f86385056
children cff162798819
comparison
equal deleted inserted replaced
662:9ab385cb0c42 676:d3676b4cb78c
1 /* 1 /*
2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
1146 index--; 1146 index--;
1147 } 1147 }
1148 return index; 1148 return index;
1149 } 1149 }
1150 1150
1151
1152 // inverse to compute_itable_index
1153 methodOop klassItable::method_for_itable_index(klassOop intf, int itable_index) {
1154 assert(instanceKlass::cast(intf)->is_interface(), "sanity check");
1155 objArrayOop methods = instanceKlass::cast(intf)->methods();
1156
1157 int index = itable_index;
1158 // Adjust for <clinit>, which is left out of table if first method
1159 if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) {
1160 index++;
1161 }
1162
1163 if (itable_index < 0 || index >= methods->length())
1164 return NULL; // help caller defend against bad indexes
1165
1166 methodOop m = (methodOop)methods->obj_at(index);
1167 assert(compute_itable_index(m) == itable_index, "correct inverse");
1168
1169 return m;
1170 }
1171
1151 void klassVtable::verify(outputStream* st, bool forced) { 1172 void klassVtable::verify(outputStream* st, bool forced) {
1152 // make sure table is initialized 1173 // make sure table is initialized
1153 if (!Universe::is_fully_initialized()) return; 1174 if (!Universe::is_fully_initialized()) return;
1154 #ifndef PRODUCT 1175 #ifndef PRODUCT
1155 // avoid redundant verifies 1176 // avoid redundant verifies