269 // ciMethod::vtable_index
270 //
271 // Get the position of this method's entry in the vtable, if any.
272 int ciMethod::vtable_index() {
273 check_is_loaded();
274 assert(holder()->is_linked(), "must be linked");
275 VM_ENTRY_MARK;
276 return get_Method()->vtable_index();
277 }
278
279
280 #ifdef SHARK
281 // ------------------------------------------------------------------
282 // ciMethod::itable_index
283 //
284 // Get the position of this method's entry in the itable, if any.
285 int ciMethod::itable_index() {
286 check_is_loaded();
287 assert(holder()->is_linked(), "must be linked");
288 VM_ENTRY_MARK;
289 return klassItable::compute_itable_index(get_Method());
290 }
291 #endif // SHARK
292
293
294 // ------------------------------------------------------------------
295 // ciMethod::native_entry
296 //
297 // Get the address of this method's native code, if any.
298 address ciMethod::native_entry() {
299 check_is_loaded();
300 assert(flags().is_native(), "must be native method");
301 VM_ENTRY_MARK;
302 Method* method = get_Method();
303 address entry = method->native_function();
304 assert(entry != NULL, "must be valid entry point");
305 return entry;
306 }
307
308
309 // ------------------------------------------------------------------
1120 methodHandle m(THREAD, get_Method());
1121 bool has_unloaded = Method::has_unloaded_classes_in_signature(m, (JavaThread *)THREAD);
1122 if( HAS_PENDING_EXCEPTION ) {
1123 CLEAR_PENDING_EXCEPTION;
1124 return true; // Declare that we may have unloaded classes
1125 }
1126 return has_unloaded;
1127 }
1128 }
1129
1130 // ------------------------------------------------------------------
1131 // ciMethod::is_klass_loaded
1132 bool ciMethod::is_klass_loaded(int refinfo_index, bool must_be_resolved) const {
1133 VM_ENTRY_MARK;
1134 return get_Method()->is_klass_loaded(refinfo_index, must_be_resolved);
1135 }
1136
1137 // ------------------------------------------------------------------
1138 // ciMethod::check_call
1139 bool ciMethod::check_call(int refinfo_index, bool is_static) const {
1140 VM_ENTRY_MARK;
1141 {
1142 EXCEPTION_MARK;
1143 HandleMark hm(THREAD);
1144 constantPoolHandle pool (THREAD, get_Method()->constants());
1145 methodHandle spec_method;
1146 KlassHandle spec_klass;
1147 Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual);
1148 LinkResolver::resolve_method_statically(spec_method, spec_klass, code, pool, refinfo_index, THREAD);
1149 if (HAS_PENDING_EXCEPTION) {
1150 CLEAR_PENDING_EXCEPTION;
1151 return false;
1152 } else {
1153 return (spec_method->is_static() == is_static);
1154 }
1155 }
1156 return false;
1157 }
1158
1159 // ------------------------------------------------------------------
|
269 // ciMethod::vtable_index
270 //
271 // Get the position of this method's entry in the vtable, if any.
272 int ciMethod::vtable_index() {
273 check_is_loaded();
274 assert(holder()->is_linked(), "must be linked");
275 VM_ENTRY_MARK;
276 return get_Method()->vtable_index();
277 }
278
279
280 #ifdef SHARK
281 // ------------------------------------------------------------------
282 // ciMethod::itable_index
283 //
284 // Get the position of this method's entry in the itable, if any.
285 int ciMethod::itable_index() {
286 check_is_loaded();
287 assert(holder()->is_linked(), "must be linked");
288 VM_ENTRY_MARK;
289 Method* m = get_Method();
290 if (!m->has_itable_index())
291 return Method::nonvirtual_vtable_index;
292 return m->itable_index();
293 }
294 #endif // SHARK
295
296
297 // ------------------------------------------------------------------
298 // ciMethod::native_entry
299 //
300 // Get the address of this method's native code, if any.
301 address ciMethod::native_entry() {
302 check_is_loaded();
303 assert(flags().is_native(), "must be native method");
304 VM_ENTRY_MARK;
305 Method* method = get_Method();
306 address entry = method->native_function();
307 assert(entry != NULL, "must be valid entry point");
308 return entry;
309 }
310
311
312 // ------------------------------------------------------------------
1123 methodHandle m(THREAD, get_Method());
1124 bool has_unloaded = Method::has_unloaded_classes_in_signature(m, (JavaThread *)THREAD);
1125 if( HAS_PENDING_EXCEPTION ) {
1126 CLEAR_PENDING_EXCEPTION;
1127 return true; // Declare that we may have unloaded classes
1128 }
1129 return has_unloaded;
1130 }
1131 }
1132
1133 // ------------------------------------------------------------------
1134 // ciMethod::is_klass_loaded
1135 bool ciMethod::is_klass_loaded(int refinfo_index, bool must_be_resolved) const {
1136 VM_ENTRY_MARK;
1137 return get_Method()->is_klass_loaded(refinfo_index, must_be_resolved);
1138 }
1139
1140 // ------------------------------------------------------------------
1141 // ciMethod::check_call
1142 bool ciMethod::check_call(int refinfo_index, bool is_static) const {
1143 // This method is used only in C2 from InlineTree::ok_to_inline,
1144 // and is only used under -Xcomp or -XX:CompileTheWorld.
1145 // It appears to fail when applied to an invokeinterface call site.
1146 // FIXME: Remove this method and resolve_method_statically; refactor to use the other LinkResolver entry points.
1147 VM_ENTRY_MARK;
1148 {
1149 EXCEPTION_MARK;
1150 HandleMark hm(THREAD);
1151 constantPoolHandle pool (THREAD, get_Method()->constants());
1152 methodHandle spec_method;
1153 KlassHandle spec_klass;
1154 Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual);
1155 LinkResolver::resolve_method_statically(spec_method, spec_klass, code, pool, refinfo_index, THREAD);
1156 if (HAS_PENDING_EXCEPTION) {
1157 CLEAR_PENDING_EXCEPTION;
1158 return false;
1159 } else {
1160 return (spec_method->is_static() == is_static);
1161 }
1162 }
1163 return false;
1164 }
1165
1166 // ------------------------------------------------------------------
|