277 while(iter.next()) {
278 if (iter.type() == relocInfo::virtual_call_type) {
279 if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc(), this)) {
280 CompiledIC *ic = CompiledIC_at(&iter);
281 if (TraceCompiledIC) {
282 tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder()));
283 ic->print();
284 }
285 assert(ic->cached_icholder() != NULL, "must be non-NULL");
286 count++;
287 }
288 }
289 }
290
291 return count;
292 }
293
294 // Method that knows how to preserve outgoing arguments at call. This method must be
295 // called with a frame corresponding to a Java invoke
296 void CompiledMethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
297 #ifndef SHARK
298 if (method() != NULL && !method()->is_native()) {
299 address pc = fr.pc();
300 SimpleScopeDesc ssd(this, pc);
301 Bytecode_invoke call(ssd.method(), ssd.bci());
302 bool has_receiver = call.has_receiver();
303 bool has_appendix = call.has_appendix();
304 Symbol* signature = call.signature();
305
306 // The method attached by JIT-compilers should be used, if present.
307 // Bytecode can be inaccurate in such case.
308 Method* callee = attached_method_before_pc(pc);
309 if (callee != NULL) {
310 has_receiver = !(callee->access_flags().is_static());
311 has_appendix = false;
312 signature = callee->signature();
313 }
314
315 fr.oops_compiled_arguments_do(signature, has_receiver, has_appendix, reg_map, f);
316 }
317 #endif // !SHARK
318 }
319
320 Method* CompiledMethod::attached_method(address call_instr) {
321 assert(code_contains(call_instr), "not part of the nmethod");
322 RelocIterator iter(this, call_instr, call_instr + 1);
323 while (iter.next()) {
324 if (iter.addr() == call_instr) {
325 switch(iter.type()) {
326 case relocInfo::static_call_type: return iter.static_call_reloc()->method_value();
327 case relocInfo::opt_virtual_call_type: return iter.opt_virtual_call_reloc()->method_value();
328 case relocInfo::virtual_call_type: return iter.virtual_call_reloc()->method_value();
329 default: break;
330 }
331 }
332 }
333 return NULL; // not found
334 }
335
336 Method* CompiledMethod::attached_method_before_pc(address pc) {
337 if (NativeCall::is_call_before(pc)) {
|
277 while(iter.next()) {
278 if (iter.type() == relocInfo::virtual_call_type) {
279 if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc(), this)) {
280 CompiledIC *ic = CompiledIC_at(&iter);
281 if (TraceCompiledIC) {
282 tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder()));
283 ic->print();
284 }
285 assert(ic->cached_icholder() != NULL, "must be non-NULL");
286 count++;
287 }
288 }
289 }
290
291 return count;
292 }
293
294 // Method that knows how to preserve outgoing arguments at call. This method must be
295 // called with a frame corresponding to a Java invoke
296 void CompiledMethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
297 if (method() != NULL && !method()->is_native()) {
298 address pc = fr.pc();
299 SimpleScopeDesc ssd(this, pc);
300 Bytecode_invoke call(ssd.method(), ssd.bci());
301 bool has_receiver = call.has_receiver();
302 bool has_appendix = call.has_appendix();
303 Symbol* signature = call.signature();
304
305 // The method attached by JIT-compilers should be used, if present.
306 // Bytecode can be inaccurate in such case.
307 Method* callee = attached_method_before_pc(pc);
308 if (callee != NULL) {
309 has_receiver = !(callee->access_flags().is_static());
310 has_appendix = false;
311 signature = callee->signature();
312 }
313
314 fr.oops_compiled_arguments_do(signature, has_receiver, has_appendix, reg_map, f);
315 }
316 }
317
318 Method* CompiledMethod::attached_method(address call_instr) {
319 assert(code_contains(call_instr), "not part of the nmethod");
320 RelocIterator iter(this, call_instr, call_instr + 1);
321 while (iter.next()) {
322 if (iter.addr() == call_instr) {
323 switch(iter.type()) {
324 case relocInfo::static_call_type: return iter.static_call_reloc()->method_value();
325 case relocInfo::opt_virtual_call_type: return iter.opt_virtual_call_reloc()->method_value();
326 case relocInfo::virtual_call_type: return iter.virtual_call_reloc()->method_value();
327 default: break;
328 }
329 }
330 }
331 return NULL; // not found
332 }
333
334 Method* CompiledMethod::attached_method_before_pc(address pc) {
335 if (NativeCall::is_call_before(pc)) {
|