comparison src/share/vm/runtime/compilationPolicy.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 0926a952ba55 78bbf4d43a14
children 2a69cbe850a8
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
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.
172 } 172 }
173 173
174 void NonTieredCompPolicy::trace_osr_completion(nmethod* osr_nm) { 174 void NonTieredCompPolicy::trace_osr_completion(nmethod* osr_nm) {
175 if (TraceOnStackReplacement) { 175 if (TraceOnStackReplacement) {
176 if (osr_nm == NULL) tty->print_cr("compilation failed"); 176 if (osr_nm == NULL) tty->print_cr("compilation failed");
177 else tty->print_cr("nmethod " INTPTR_FORMAT, osr_nm); 177 else tty->print_cr("nmethod " INTPTR_FORMAT, p2i(osr_nm));
178 } 178 }
179 } 179 }
180 #endif // !PRODUCT 180 #endif // !PRODUCT
181 181
182 void NonTieredCompPolicy::initialize() { 182 void NonTieredCompPolicy::initialize() {
184 if (CICompilerCountPerCPU) { 184 if (CICompilerCountPerCPU) {
185 // Example: if CICompilerCountPerCPU is true, then we get 185 // Example: if CICompilerCountPerCPU is true, then we get
186 // max(log2(8)-1,1) = 2 compiler threads on an 8-way machine. 186 // max(log2(8)-1,1) = 2 compiler threads on an 8-way machine.
187 // May help big-app startup time. 187 // May help big-app startup time.
188 _compiler_count = MAX2(log2_intptr(os::active_processor_count())-1,1); 188 _compiler_count = MAX2(log2_intptr(os::active_processor_count())-1,1);
189 FLAG_SET_ERGO(intx, CICompilerCount, _compiler_count);
189 } else { 190 } else {
190 _compiler_count = CICompilerCount; 191 _compiler_count = CICompilerCount;
191 } 192 }
192 } 193 }
193 194
418 } 419 }
419 return NULL; 420 return NULL;
420 } 421 }
421 422
422 #ifndef PRODUCT 423 #ifndef PRODUCT
424 PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
423 void NonTieredCompPolicy::trace_frequency_counter_overflow(methodHandle m, int branch_bci, int bci) { 425 void NonTieredCompPolicy::trace_frequency_counter_overflow(methodHandle m, int branch_bci, int bci) {
424 if (TraceInvocationCounterOverflow) { 426 if (TraceInvocationCounterOverflow) {
425 MethodCounters* mcs = m->method_counters(); 427 MethodCounters* mcs = m->method_counters();
426 assert(mcs != NULL, "MethodCounters cannot be NULL for profiling"); 428 assert(mcs != NULL, "MethodCounters cannot be NULL for profiling");
427 InvocationCounter* ic = mcs->invocation_counter(); 429 InvocationCounter* ic = mcs->invocation_counter();
429 ResourceMark rm; 431 ResourceMark rm;
430 const char* msg = 432 const char* msg =
431 bci == InvocationEntryBci 433 bci == InvocationEntryBci
432 ? "comp-policy cntr ovfl @ %d in entry of " 434 ? "comp-policy cntr ovfl @ %d in entry of "
433 : "comp-policy cntr ovfl @ %d in loop of "; 435 : "comp-policy cntr ovfl @ %d in loop of ";
436 PRAGMA_DIAG_PUSH
437 PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
434 tty->print(msg, bci); 438 tty->print(msg, bci);
439 PRAGMA_DIAG_POP
435 m->print_value(); 440 m->print_value();
436 tty->cr(); 441 tty->cr();
437 ic->print(); 442 ic->print();
438 bc->print(); 443 bc->print();
439 if (ProfileInterpreter) { 444 if (ProfileInterpreter) {
504 assert(fr.interpreter_frame_method() == m(), "bad method"); 509 assert(fr.interpreter_frame_method() == m(), "bad method");
505 510
506 if (TraceCompilationPolicy) { 511 if (TraceCompilationPolicy) {
507 tty->print("method invocation trigger: "); 512 tty->print("method invocation trigger: ");
508 m->print_short_name(tty); 513 m->print_short_name(tty);
509 tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", (address)m(), m->code_size()); 514 tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", p2i((address)m()), m->code_size());
510 } 515 }
511 RegisterMap reg_map(thread, false); 516 RegisterMap reg_map(thread, false);
512 javaVFrame* triggerVF = thread->last_java_vframe(&reg_map); 517 javaVFrame* triggerVF = thread->last_java_vframe(&reg_map);
513 // triggerVF is the frame that triggered its counter 518 // triggerVF is the frame that triggered its counter
514 RFrame* first = new InterpretedRFrame(triggerVF->fr(), thread, m); 519 RFrame* first = new InterpretedRFrame(triggerVF->fr(), thread, m);
515 520
516 if (first->top_method()->code() != NULL) { 521 if (first->top_method()->code() != NULL) {
517 // called obsolete method/nmethod -- no need to recompile 522 // called obsolete method/nmethod -- no need to recompile
518 if (TraceCompilationPolicy) tty->print_cr(" --> " INTPTR_FORMAT, first->top_method()->code()); 523 if (TraceCompilationPolicy) tty->print_cr(" --> " INTPTR_FORMAT, p2i(first->top_method()->code()));
519 } else { 524 } else {
520 if (TimeCompilationPolicy) accumulated_time()->start(); 525 if (TimeCompilationPolicy) accumulated_time()->start();
521 GrowableArray<RFrame*>* stack = new GrowableArray<RFrame*>(50); 526 GrowableArray<RFrame*>* stack = new GrowableArray<RFrame*>(50);
522 stack->push(first); 527 stack->push(first);
523 RFrame* top = findTopInlinableFrame(stack); 528 RFrame* top = findTopInlinableFrame(stack);
641 } 646 }
642 647
643 if (TraceCompilationPolicy && Verbose) { 648 if (TraceCompilationPolicy && Verbose) {
644 tty->print("\n\t check caller: "); 649 tty->print("\n\t check caller: ");
645 next_m->print_short_name(tty); 650 next_m->print_short_name(tty);
646 tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", (address)next_m(), next_m->code_size()); 651 tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", p2i((address)next_m()), next_m->code_size());
647 } 652 }
648 653
649 current = next; 654 current = next;
650 } 655 }
651 656