1 /* |
1 /* |
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. 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. |
1031 // when interface 'I' was the starting point. |
1031 // when interface 'I' was the starting point. |
1032 // %%% Until this is fixed more systematically, bail out. |
1032 // %%% Until this is fixed more systematically, bail out. |
1033 // (Old CHA had the same limitation.) |
1033 // (Old CHA had the same limitation.) |
1034 return context_type; |
1034 return context_type; |
1035 } |
1035 } |
1036 for (int i = 0; i < nof_impls; i++) { |
1036 if (nof_impls > 0) { |
1037 klassOop impl = instanceKlass::cast(context_type)->implementor(i); |
1037 klassOop impl = instanceKlass::cast(context_type)->implementor(); |
1038 if (impl == NULL) { |
1038 assert(impl != NULL, "just checking"); |
1039 // implementors array overflowed => no exact info. |
1039 // If impl is the same as the context_type, then more than one |
|
1040 // implementor has seen. No exact info in this case. |
|
1041 if (impl == context_type) { |
1040 return context_type; // report an inexact witness to this sad affair |
1042 return context_type; // report an inexact witness to this sad affair |
1041 } |
1043 } |
1042 if (do_counts) |
1044 if (do_counts) |
1043 { NOT_PRODUCT(deps_find_witness_steps++); } |
1045 { NOT_PRODUCT(deps_find_witness_steps++); } |
1044 if (is_participant(impl)) { |
1046 if (is_participant(impl)) { |
1045 if (participants_hide_witnesses) continue; |
1047 if (!participants_hide_witnesses) { |
1046 // else fall through to process this guy's subclasses |
1048 ADD_SUBCLASS_CHAIN(impl); |
|
1049 } |
1047 } else if (is_witness(impl) && !ignore_witness(impl)) { |
1050 } else if (is_witness(impl) && !ignore_witness(impl)) { |
1048 return impl; |
1051 return impl; |
1049 } |
1052 } else { |
1050 ADD_SUBCLASS_CHAIN(impl); |
1053 ADD_SUBCLASS_CHAIN(impl); |
|
1054 } |
1051 } |
1055 } |
1052 |
1056 |
1053 // Recursively process each non-trivial sibling chain. |
1057 // Recursively process each non-trivial sibling chain. |
1054 while (chaini > 0) { |
1058 while (chaini > 0) { |
1055 Klass* chain = chains[--chaini]; |
1059 Klass* chain = chains[--chaini]; |
1172 if (sub != NULL) { |
1176 if (sub != NULL) { |
1173 return sub->as_klassOop(); |
1177 return sub->as_klassOop(); |
1174 } else if (ctx->nof_implementors() != 0) { |
1178 } else if (ctx->nof_implementors() != 0) { |
1175 // if it is an interface, it must be unimplemented |
1179 // if it is an interface, it must be unimplemented |
1176 // (if it is not an interface, nof_implementors is always zero) |
1180 // (if it is not an interface, nof_implementors is always zero) |
1177 klassOop impl = ctx->implementor(0); |
1181 klassOop impl = ctx->implementor(); |
1178 return (impl != NULL)? impl: ctxk; |
1182 assert(impl != NULL, "must be set"); |
|
1183 return impl; |
1179 } else { |
1184 } else { |
1180 return NULL; |
1185 return NULL; |
1181 } |
1186 } |
1182 } |
1187 } |
1183 |
1188 |