Mercurial > hg > truffle
comparison src/share/vm/oops/klassVtable.cpp @ 665:c89f86385056
6814659: separable cleanups and subroutines for 6655638
Summary: preparatory but separable changes for method handles
Reviewed-by: kvn, never
author | jrose |
---|---|
date | Fri, 20 Mar 2009 23:19:36 -0700 |
parents | 70998f2e05ef |
children | d3676b4cb78c |
comparison
equal
deleted
inserted
replaced
647:bd441136a5ce | 665:c89f86385056 |
---|---|
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. |
1151 index--; | 1151 index--; |
1152 } | 1152 } |
1153 return index; | 1153 return index; |
1154 } | 1154 } |
1155 | 1155 |
1156 | |
1157 // inverse to compute_itable_index | |
1158 methodOop klassItable::method_for_itable_index(klassOop intf, int itable_index) { | |
1159 assert(instanceKlass::cast(intf)->is_interface(), "sanity check"); | |
1160 objArrayOop methods = instanceKlass::cast(intf)->methods(); | |
1161 | |
1162 int index = itable_index; | |
1163 // Adjust for <clinit>, which is left out of table if first method | |
1164 if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) { | |
1165 index++; | |
1166 } | |
1167 | |
1168 if (itable_index < 0 || index >= methods->length()) | |
1169 return NULL; // help caller defend against bad indexes | |
1170 | |
1171 methodOop m = (methodOop)methods->obj_at(index); | |
1172 assert(compute_itable_index(m) == itable_index, "correct inverse"); | |
1173 | |
1174 return m; | |
1175 } | |
1176 | |
1156 void klassVtable::verify(outputStream* st, bool forced) { | 1177 void klassVtable::verify(outputStream* st, bool forced) { |
1157 // make sure table is initialized | 1178 // make sure table is initialized |
1158 if (!Universe::is_fully_initialized()) return; | 1179 if (!Universe::is_fully_initialized()) return; |
1159 #ifndef PRODUCT | 1180 #ifndef PRODUCT |
1160 // avoid redundant verifies | 1181 // avoid redundant verifies |