comparison src/share/vm/runtime/compilationPolicy.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 7150b16fda52
children 52b4284cb496
comparison
equal deleted inserted replaced
17935:7384f6a12fc1 17937:78bbf4d43a14
1 /* 1 /*
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 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.
168 } 168 }
169 169
170 void NonTieredCompPolicy::trace_osr_completion(nmethod* osr_nm) { 170 void NonTieredCompPolicy::trace_osr_completion(nmethod* osr_nm) {
171 if (TraceOnStackReplacement) { 171 if (TraceOnStackReplacement) {
172 if (osr_nm == NULL) tty->print_cr("compilation failed"); 172 if (osr_nm == NULL) tty->print_cr("compilation failed");
173 else tty->print_cr("nmethod " INTPTR_FORMAT, osr_nm); 173 else tty->print_cr("nmethod " INTPTR_FORMAT, p2i(osr_nm));
174 } 174 }
175 } 175 }
176 #endif // !PRODUCT 176 #endif // !PRODUCT
177 177
178 void NonTieredCompPolicy::initialize() { 178 void NonTieredCompPolicy::initialize() {
415 } 415 }
416 return NULL; 416 return NULL;
417 } 417 }
418 418
419 #ifndef PRODUCT 419 #ifndef PRODUCT
420 PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
420 void NonTieredCompPolicy::trace_frequency_counter_overflow(methodHandle m, int branch_bci, int bci) { 421 void NonTieredCompPolicy::trace_frequency_counter_overflow(methodHandle m, int branch_bci, int bci) {
421 if (TraceInvocationCounterOverflow) { 422 if (TraceInvocationCounterOverflow) {
422 MethodCounters* mcs = m->method_counters(); 423 MethodCounters* mcs = m->method_counters();
423 assert(mcs != NULL, "MethodCounters cannot be NULL for profiling"); 424 assert(mcs != NULL, "MethodCounters cannot be NULL for profiling");
424 InvocationCounter* ic = mcs->invocation_counter(); 425 InvocationCounter* ic = mcs->invocation_counter();
426 ResourceMark rm; 427 ResourceMark rm;
427 const char* msg = 428 const char* msg =
428 bci == InvocationEntryBci 429 bci == InvocationEntryBci
429 ? "comp-policy cntr ovfl @ %d in entry of " 430 ? "comp-policy cntr ovfl @ %d in entry of "
430 : "comp-policy cntr ovfl @ %d in loop of "; 431 : "comp-policy cntr ovfl @ %d in loop of ";
432 PRAGMA_DIAG_PUSH
433 PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
431 tty->print(msg, bci); 434 tty->print(msg, bci);
435 PRAGMA_DIAG_POP
432 m->print_value(); 436 m->print_value();
433 tty->cr(); 437 tty->cr();
434 ic->print(); 438 ic->print();
435 bc->print(); 439 bc->print();
436 if (ProfileInterpreter) { 440 if (ProfileInterpreter) {
501 assert(fr.interpreter_frame_method() == m(), "bad method"); 505 assert(fr.interpreter_frame_method() == m(), "bad method");
502 506
503 if (TraceCompilationPolicy) { 507 if (TraceCompilationPolicy) {
504 tty->print("method invocation trigger: "); 508 tty->print("method invocation trigger: ");
505 m->print_short_name(tty); 509 m->print_short_name(tty);
506 tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", (address)m(), m->code_size()); 510 tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", p2i((address)m()), m->code_size());
507 } 511 }
508 RegisterMap reg_map(thread, false); 512 RegisterMap reg_map(thread, false);
509 javaVFrame* triggerVF = thread->last_java_vframe(&reg_map); 513 javaVFrame* triggerVF = thread->last_java_vframe(&reg_map);
510 // triggerVF is the frame that triggered its counter 514 // triggerVF is the frame that triggered its counter
511 RFrame* first = new InterpretedRFrame(triggerVF->fr(), thread, m); 515 RFrame* first = new InterpretedRFrame(triggerVF->fr(), thread, m);
512 516
513 if (first->top_method()->code() != NULL) { 517 if (first->top_method()->code() != NULL) {
514 // called obsolete method/nmethod -- no need to recompile 518 // called obsolete method/nmethod -- no need to recompile
515 if (TraceCompilationPolicy) tty->print_cr(" --> " INTPTR_FORMAT, first->top_method()->code()); 519 if (TraceCompilationPolicy) tty->print_cr(" --> " INTPTR_FORMAT, p2i(first->top_method()->code()));
516 } else { 520 } else {
517 if (TimeCompilationPolicy) accumulated_time()->start(); 521 if (TimeCompilationPolicy) accumulated_time()->start();
518 GrowableArray<RFrame*>* stack = new GrowableArray<RFrame*>(50); 522 GrowableArray<RFrame*>* stack = new GrowableArray<RFrame*>(50);
519 stack->push(first); 523 stack->push(first);
520 RFrame* top = findTopInlinableFrame(stack); 524 RFrame* top = findTopInlinableFrame(stack);
638 } 642 }
639 643
640 if (TraceCompilationPolicy && Verbose) { 644 if (TraceCompilationPolicy && Verbose) {
641 tty->print("\n\t check caller: "); 645 tty->print("\n\t check caller: ");
642 next_m->print_short_name(tty); 646 next_m->print_short_name(tty);
643 tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", (address)next_m(), next_m->code_size()); 647 tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", p2i((address)next_m()), next_m->code_size());
644 } 648 }
645 649
646 current = next; 650 current = next;
647 } 651 }
648 652