comparison src/share/vm/code/compiledIC.cpp @ 17937:78bbf4d43a14

8037816: Fix for 8036122 breaks build with Xcode5/clang 8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas 8043164: Format warning in traceStream.hpp Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings Reviewed-by: kvn, coleenp, iveresov, twisti
author drchase
date Thu, 22 May 2014 15:52:41 -0400
parents df832bd8edb9
children 52b4284cb496 c64b6b0c40c8
comparison
equal deleted inserted replaced
17935:7384f6a12fc1 17937:78bbf4d43a14
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2014, 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.
86 } 86 }
87 87
88 if (TraceCompiledIC) { 88 if (TraceCompiledIC) {
89 tty->print(" "); 89 tty->print(" ");
90 print_compiled_ic(); 90 print_compiled_ic();
91 tty->print(" changing destination to " INTPTR_FORMAT, entry_point); 91 tty->print(" changing destination to " INTPTR_FORMAT, p2i(entry_point));
92 if (!is_optimized()) { 92 if (!is_optimized()) {
93 tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", (address)cache); 93 tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", p2i((address)cache));
94 } 94 }
95 if (is_icstub) { 95 if (is_icstub) {
96 tty->print(" (icstub)"); 96 tty->print(" (icstub)");
97 } 97 }
98 tty->cr(); 98 tty->cr();
193 } 193 }
194 194
195 if (TraceICs) { 195 if (TraceICs) {
196 ResourceMark rm; 196 ResourceMark rm;
197 tty->print_cr ("IC@" INTPTR_FORMAT ": to megamorphic %s entry: " INTPTR_FORMAT, 197 tty->print_cr ("IC@" INTPTR_FORMAT ": to megamorphic %s entry: " INTPTR_FORMAT,
198 instruction_address(), call_info->selected_method()->print_value_string(), entry); 198 p2i(instruction_address()), call_info->selected_method()->print_value_string(), p2i(entry));
199 } 199 }
200 200
201 // We can't check this anymore. With lazy deopt we could have already 201 // We can't check this anymore. With lazy deopt we could have already
202 // cleaned this IC entry before we even return. This is possible if 202 // cleaned this IC entry before we even return. This is possible if
203 // we ran out of space in the inline cache buffer trying to do the 203 // we ran out of space in the inline cache buffer trying to do the
270 270
271 271
272 void CompiledIC::set_to_clean() { 272 void CompiledIC::set_to_clean() {
273 assert(SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->is_locked() , "MT-unsafe call"); 273 assert(SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->is_locked() , "MT-unsafe call");
274 if (TraceInlineCacheClearing || TraceICs) { 274 if (TraceInlineCacheClearing || TraceICs) {
275 tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", instruction_address()); 275 tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", p2i(instruction_address()));
276 print(); 276 print();
277 } 277 }
278 278
279 address entry; 279 address entry;
280 if (is_optimized()) { 280 if (is_optimized()) {
352 methodHandle method (thread, (Method*)info.cached_metadata()); 352 methodHandle method (thread, (Method*)info.cached_metadata());
353 csc->set_to_interpreted(method, info.entry()); 353 csc->set_to_interpreted(method, info.entry());
354 if (TraceICs) { 354 if (TraceICs) {
355 ResourceMark rm(thread); 355 ResourceMark rm(thread);
356 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter: %s", 356 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter: %s",
357 instruction_address(), 357 p2i(instruction_address()),
358 method->print_value_string()); 358 method->print_value_string());
359 } 359 }
360 } else { 360 } else {
361 // Call via method-klass-holder 361 // Call via method-klass-holder
362 InlineCacheBuffer::create_transition_stub(this, info.claim_cached_icholder(), info.entry()); 362 InlineCacheBuffer::create_transition_stub(this, info.claim_cached_icholder(), info.entry());
363 if (TraceICs) { 363 if (TraceICs) {
364 ResourceMark rm(thread); 364 ResourceMark rm(thread);
365 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", instruction_address()); 365 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", p2i(instruction_address()));
366 } 366 }
367 } 367 }
368 } else { 368 } else {
369 // Call to compiled code 369 // Call to compiled code
370 bool static_bound = info.is_optimized() || (info.cached_metadata() == NULL); 370 bool static_bound = info.is_optimized() || (info.cached_metadata() == NULL);
390 390
391 if (TraceICs) { 391 if (TraceICs) {
392 ResourceMark rm(thread); 392 ResourceMark rm(thread);
393 assert(info.cached_metadata() == NULL || info.cached_metadata()->is_klass(), "must be"); 393 assert(info.cached_metadata() == NULL || info.cached_metadata()->is_klass(), "must be");
394 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to compiled (rcvr klass) %s: %s", 394 tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to compiled (rcvr klass) %s: %s",
395 instruction_address(), 395 p2i(instruction_address()),
396 ((Klass*)info.cached_metadata())->print_value_string(), 396 ((Klass*)info.cached_metadata())->print_value_string(),
397 (safe) ? "" : "via stub"); 397 (safe) ? "" : "via stub");
398 } 398 }
399 } 399 }
400 // We can't check this anymore. With lazy deopt we could have already 400 // We can't check this anymore. With lazy deopt we could have already
528 set_to_interpreted(info.callee(), info.entry()); 528 set_to_interpreted(info.callee(), info.entry());
529 } else { 529 } else {
530 if (TraceICs) { 530 if (TraceICs) {
531 ResourceMark rm; 531 ResourceMark rm;
532 tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_compiled " INTPTR_FORMAT, 532 tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_compiled " INTPTR_FORMAT,
533 instruction_address(), 533 p2i(instruction_address()),
534 info.entry()); 534 p2i(info.entry()));
535 } 535 }
536 // Call to compiled code 536 // Call to compiled code
537 assert (CodeCache::contains(info.entry()), "wrong entry point"); 537 assert (CodeCache::contains(info.entry()), "wrong entry point");
538 set_destination_mt_safe(info.entry()); 538 set_destination_mt_safe(info.entry());
539 } 539 }
598 tty->cr(); 598 tty->cr();
599 } 599 }
600 600
601 void CompiledIC::print_compiled_ic() { 601 void CompiledIC::print_compiled_ic() {
602 tty->print("Inline cache at " INTPTR_FORMAT ", calling %s " INTPTR_FORMAT " cached_value " INTPTR_FORMAT, 602 tty->print("Inline cache at " INTPTR_FORMAT ", calling %s " INTPTR_FORMAT " cached_value " INTPTR_FORMAT,
603 instruction_address(), is_call_to_interpreted() ? "interpreted " : "", ic_destination(), is_optimized() ? NULL : cached_value()); 603 p2i(instruction_address()), is_call_to_interpreted() ? "interpreted " : "", p2i(ic_destination()), p2i(is_optimized() ? NULL : cached_value()));
604 } 604 }
605 605
606 void CompiledStaticCall::print() { 606 void CompiledStaticCall::print() {
607 tty->print("static call at " INTPTR_FORMAT " -> ", instruction_address()); 607 tty->print("static call at " INTPTR_FORMAT " -> ", p2i(instruction_address()));
608 if (is_clean()) { 608 if (is_clean()) {
609 tty->print("clean"); 609 tty->print("clean");
610 } else if (is_call_to_compiled()) { 610 } else if (is_call_to_compiled()) {
611 tty->print("compiled"); 611 tty->print("compiled");
612 } else if (is_call_to_interpreted()) { 612 } else if (is_call_to_interpreted()) {