7022998: JSR 292 recursive method handle calls inline themselves infinitely
Reviewed-by: never, kvn
This commit is contained in:
parent
36303f61b6
commit
f51036e9bc
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1769,6 +1769,7 @@ static void create_inner_frame(MacroAssembler* masm, bool* already_created) {
|
||||
// returns.
|
||||
nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
|
||||
methodHandle method,
|
||||
int compile_id,
|
||||
int total_in_args,
|
||||
int comp_args_on_stack, // in VMRegStackSlots
|
||||
BasicType *in_sig_bt,
|
||||
@ -2462,6 +2463,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
|
||||
__ flush();
|
||||
|
||||
nmethod *nm = nmethod::new_native_nmethod(method,
|
||||
compile_id,
|
||||
masm->code(),
|
||||
vep_offset,
|
||||
frame_complete,
|
||||
|
@ -1111,6 +1111,7 @@ void SharedRuntime::restore_native_result(MacroAssembler *masm, BasicType ret_ty
|
||||
// returns.
|
||||
nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
methodHandle method,
|
||||
int compile_id,
|
||||
int total_in_args,
|
||||
int comp_args_on_stack,
|
||||
BasicType *in_sig_bt,
|
||||
@ -1854,6 +1855,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
__ flush();
|
||||
|
||||
nmethod *nm = nmethod::new_native_nmethod(method,
|
||||
compile_id,
|
||||
masm->code(),
|
||||
vep_offset,
|
||||
frame_complete,
|
||||
|
@ -1174,6 +1174,7 @@ static void restore_args(MacroAssembler *masm, int arg_count, int first_arg, VMR
|
||||
// returns.
|
||||
nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
methodHandle method,
|
||||
int compile_id,
|
||||
int total_in_args,
|
||||
int comp_args_on_stack,
|
||||
BasicType *in_sig_bt,
|
||||
@ -1881,6 +1882,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
__ flush();
|
||||
|
||||
nmethod *nm = nmethod::new_native_nmethod(method,
|
||||
compile_id,
|
||||
masm->code(),
|
||||
vep_offset,
|
||||
frame_complete,
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "c1/c1_InstructionPrinter.hpp"
|
||||
#include "ci/ciField.hpp"
|
||||
#include "ci/ciKlass.hpp"
|
||||
#include "compiler/compileBroker.hpp"
|
||||
#include "interpreter/bytecode.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
#include "utilities/bitMap.inline.hpp"
|
||||
@ -3775,24 +3776,7 @@ void GraphBuilder::append_unsafe_CAS(ciMethod* callee) {
|
||||
|
||||
#ifndef PRODUCT
|
||||
void GraphBuilder::print_inline_result(ciMethod* callee, bool res) {
|
||||
const char sync_char = callee->is_synchronized() ? 's' : ' ';
|
||||
const char exception_char = callee->has_exception_handlers() ? '!' : ' ';
|
||||
const char monitors_char = callee->has_monitor_bytecodes() ? 'm' : ' ';
|
||||
tty->print(" %c%c%c ", sync_char, exception_char, monitors_char);
|
||||
for (int i = 0; i < scope()->level(); i++) tty->print(" ");
|
||||
if (res) {
|
||||
tty->print(" ");
|
||||
} else {
|
||||
tty->print("- ");
|
||||
}
|
||||
tty->print("@ %d ", bci());
|
||||
callee->print_short_name();
|
||||
tty->print(" (%d bytes)", callee->code_size());
|
||||
if (_inline_bailout_msg) {
|
||||
tty->print(" %s", _inline_bailout_msg);
|
||||
}
|
||||
tty->cr();
|
||||
|
||||
CompileTask::print_inlining(callee, scope()->level(), bci(), _inline_bailout_msg);
|
||||
if (res && CIPrintMethodCodes) {
|
||||
callee->print_codes();
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "code/nmethod.hpp"
|
||||
#include "code/scopeDesc.hpp"
|
||||
#include "compiler/abstractCompiler.hpp"
|
||||
#include "compiler/compileBroker.hpp"
|
||||
#include "compiler/compileLog.hpp"
|
||||
#include "compiler/compilerOracle.hpp"
|
||||
#include "compiler/disassembler.hpp"
|
||||
@ -469,6 +470,7 @@ void nmethod::init_defaults() {
|
||||
|
||||
|
||||
nmethod* nmethod::new_native_nmethod(methodHandle method,
|
||||
int compile_id,
|
||||
CodeBuffer *code_buffer,
|
||||
int vep_offset,
|
||||
int frame_complete,
|
||||
@ -485,7 +487,7 @@ nmethod* nmethod::new_native_nmethod(methodHandle method,
|
||||
offsets.set_value(CodeOffsets::Verified_Entry, vep_offset);
|
||||
offsets.set_value(CodeOffsets::Frame_Complete, frame_complete);
|
||||
nm = new (native_nmethod_size)
|
||||
nmethod(method(), native_nmethod_size, &offsets,
|
||||
nmethod(method(), native_nmethod_size, compile_id, &offsets,
|
||||
code_buffer, frame_size,
|
||||
basic_lock_owner_sp_offset, basic_lock_sp_offset,
|
||||
oop_maps);
|
||||
@ -610,6 +612,7 @@ nmethod* nmethod::new_nmethod(methodHandle method,
|
||||
nmethod::nmethod(
|
||||
methodOop method,
|
||||
int nmethod_size,
|
||||
int compile_id,
|
||||
CodeOffsets* offsets,
|
||||
CodeBuffer* code_buffer,
|
||||
int frame_size,
|
||||
@ -644,7 +647,7 @@ nmethod::nmethod(
|
||||
_handler_table_offset = _dependencies_offset;
|
||||
_nul_chk_table_offset = _handler_table_offset;
|
||||
_nmethod_end_offset = _nul_chk_table_offset;
|
||||
_compile_id = 0; // default
|
||||
_compile_id = compile_id;
|
||||
_comp_level = CompLevel_none;
|
||||
_entry_point = code_begin() + offsets->value(CodeOffsets::Entry);
|
||||
_verified_entry_point = code_begin() + offsets->value(CodeOffsets::Verified_Entry);
|
||||
@ -930,72 +933,11 @@ void nmethod::log_new_nmethod() const {
|
||||
#undef LOG_OFFSET
|
||||
|
||||
|
||||
void nmethod::print_compilation(outputStream *st, const char *method_name, const char *title,
|
||||
methodOop method, bool is_blocking, int compile_id, int bci, int comp_level) {
|
||||
bool is_synchronized = false, has_xhandler = false, is_native = false;
|
||||
int code_size = -1;
|
||||
if (method != NULL) {
|
||||
is_synchronized = method->is_synchronized();
|
||||
has_xhandler = method->has_exception_handler();
|
||||
is_native = method->is_native();
|
||||
code_size = method->code_size();
|
||||
}
|
||||
// print compilation number
|
||||
st->print("%7d %3d", (int)tty->time_stamp().milliseconds(), compile_id);
|
||||
|
||||
// print method attributes
|
||||
const bool is_osr = bci != InvocationEntryBci;
|
||||
const char blocking_char = is_blocking ? 'b' : ' ';
|
||||
const char compile_type = is_osr ? '%' : ' ';
|
||||
const char sync_char = is_synchronized ? 's' : ' ';
|
||||
const char exception_char = has_xhandler ? '!' : ' ';
|
||||
const char native_char = is_native ? 'n' : ' ';
|
||||
st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char);
|
||||
if (TieredCompilation) {
|
||||
st->print("%d ", comp_level);
|
||||
}
|
||||
|
||||
// print optional title
|
||||
bool do_nl = false;
|
||||
if (title != NULL) {
|
||||
int tlen = (int) strlen(title);
|
||||
bool do_nl = false;
|
||||
if (tlen > 0 && title[tlen-1] == '\n') { tlen--; do_nl = true; }
|
||||
st->print("%.*s", tlen, title);
|
||||
} else {
|
||||
do_nl = true;
|
||||
}
|
||||
|
||||
// print method name string if given
|
||||
if (method_name != NULL) {
|
||||
st->print(method_name);
|
||||
} else {
|
||||
// otherwise as the method to print itself
|
||||
if (method != NULL && !Universe::heap()->is_gc_active()) {
|
||||
method->print_short_name(st);
|
||||
} else {
|
||||
st->print("(method)");
|
||||
}
|
||||
}
|
||||
|
||||
if (method != NULL) {
|
||||
// print osr_bci if any
|
||||
if (is_osr) st->print(" @ %d", bci);
|
||||
// print method size
|
||||
st->print(" (%d bytes)", code_size);
|
||||
}
|
||||
if (do_nl) st->cr();
|
||||
}
|
||||
|
||||
// Print out more verbose output usually for a newly created nmethod.
|
||||
void nmethod::print_on(outputStream* st, const char* title) const {
|
||||
void nmethod::print_on(outputStream* st, const char* msg) const {
|
||||
if (st != NULL) {
|
||||
ttyLocker ttyl;
|
||||
print_compilation(st, /*method_name*/NULL, title,
|
||||
method(), /*is_blocking*/false,
|
||||
compile_id(),
|
||||
is_osr_method() ? osr_entry_bci() : InvocationEntryBci,
|
||||
comp_level());
|
||||
CompileTask::print_compilation(st, this, msg);
|
||||
if (WizardMode) st->print(" (" INTPTR_FORMAT ")", this);
|
||||
}
|
||||
}
|
||||
@ -1309,8 +1251,7 @@ void nmethod::log_state_change() const {
|
||||
}
|
||||
}
|
||||
if (PrintCompilation && _state != unloaded) {
|
||||
print_on(tty, _state == zombie ? "made zombie " : "made not entrant ");
|
||||
tty->cr();
|
||||
print_on(tty, _state == zombie ? "made zombie" : "made not entrant");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1816,7 +1757,7 @@ bool nmethod::test_set_oops_do_mark() {
|
||||
break;
|
||||
}
|
||||
// Mark was clear when we first saw this guy.
|
||||
NOT_PRODUCT(if (TraceScavenge) print_on(tty, "oops_do, mark\n"));
|
||||
NOT_PRODUCT(if (TraceScavenge) print_on(tty, "oops_do, mark"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1841,7 +1782,7 @@ void nmethod::oops_do_marking_epilogue() {
|
||||
nmethod* next = cur->_oops_do_mark_link;
|
||||
cur->_oops_do_mark_link = NULL;
|
||||
cur->fix_oop_relocations();
|
||||
NOT_PRODUCT(if (TraceScavenge) cur->print_on(tty, "oops_do, unmark\n"));
|
||||
NOT_PRODUCT(if (TraceScavenge) cur->print_on(tty, "oops_do, unmark"));
|
||||
cur = next;
|
||||
}
|
||||
void* required = _oops_do_mark_nmethods;
|
||||
@ -2396,7 +2337,7 @@ void nmethod::print() const {
|
||||
ResourceMark rm;
|
||||
ttyLocker ttyl; // keep the following output all in one block
|
||||
|
||||
tty->print("Compiled ");
|
||||
tty->print("Compiled method ");
|
||||
|
||||
if (is_compiled_by_c1()) {
|
||||
tty->print("(c1) ");
|
||||
@ -2408,8 +2349,8 @@ void nmethod::print() const {
|
||||
tty->print("(nm) ");
|
||||
}
|
||||
|
||||
print_on(tty, "nmethod");
|
||||
tty->cr();
|
||||
print_on(tty, NULL);
|
||||
|
||||
if (WizardMode) {
|
||||
tty->print("((nmethod*) "INTPTR_FORMAT ") ", this);
|
||||
tty->print(" for method " INTPTR_FORMAT , (address)method());
|
||||
@ -2796,7 +2737,8 @@ void nmethod::print_code_comment_on(outputStream* st, int column, u_char* begin,
|
||||
#ifndef PRODUCT
|
||||
|
||||
void nmethod::print_value_on(outputStream* st) const {
|
||||
print_on(st, "nmethod");
|
||||
st->print("nmethod");
|
||||
print_on(st, NULL);
|
||||
}
|
||||
|
||||
void nmethod::print_calls(outputStream* st) {
|
||||
|
@ -229,6 +229,7 @@ class nmethod : public CodeBlob {
|
||||
// For native wrappers
|
||||
nmethod(methodOop method,
|
||||
int nmethod_size,
|
||||
int compile_id,
|
||||
CodeOffsets* offsets,
|
||||
CodeBuffer *code_buffer,
|
||||
int frame_size,
|
||||
@ -299,6 +300,7 @@ class nmethod : public CodeBlob {
|
||||
int comp_level);
|
||||
|
||||
static nmethod* new_native_nmethod(methodHandle method,
|
||||
int compile_id,
|
||||
CodeBuffer *code_buffer,
|
||||
int vep_offset,
|
||||
int frame_complete,
|
||||
@ -500,8 +502,8 @@ public:
|
||||
address continuation_for_implicit_exception(address pc);
|
||||
|
||||
// On-stack replacement support
|
||||
int osr_entry_bci() const { assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); return _entry_bci; }
|
||||
address osr_entry() const { assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); return _osr_entry_point; }
|
||||
int osr_entry_bci() const { assert(is_osr_method(), "wrong kind of nmethod"); return _entry_bci; }
|
||||
address osr_entry() const { assert(is_osr_method(), "wrong kind of nmethod"); return _osr_entry_point; }
|
||||
void invalidate_osr_method();
|
||||
nmethod* osr_link() const { return _osr_link; }
|
||||
void set_osr_link(nmethod *n) { _osr_link = n; }
|
||||
@ -608,10 +610,6 @@ public:
|
||||
void verify_scopes();
|
||||
void verify_interrupt_point(address interrupt_point);
|
||||
|
||||
// print compilation helper
|
||||
static void print_compilation(outputStream *st, const char *method_name, const char *title,
|
||||
methodOop method, bool is_blocking, int compile_id, int bci, int comp_level);
|
||||
|
||||
// printing support
|
||||
void print() const;
|
||||
void print_code();
|
||||
@ -627,7 +625,7 @@ public:
|
||||
|
||||
// need to re-define this from CodeBlob else the overload hides it
|
||||
virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
|
||||
void print_on(outputStream* st, const char* title) const;
|
||||
void print_on(outputStream* st, const char* msg) const;
|
||||
|
||||
// Logging
|
||||
void log_identity(xmlStream* log) const;
|
||||
|
@ -268,11 +268,6 @@ void CompileTask::print() {
|
||||
}
|
||||
|
||||
|
||||
void CompileTask::print_compilation(outputStream *st, methodOop method, char* method_name) {
|
||||
nmethod::print_compilation(st, method_name,/*title*/ NULL, method,
|
||||
is_blocking(), compile_id(), osr_bci(), comp_level());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print_line_on_error
|
||||
//
|
||||
@ -284,32 +279,116 @@ void CompileTask::print_compilation(outputStream *st, methodOop method, char* me
|
||||
// Otherwise it's the same as CompileTask::print_line()
|
||||
//
|
||||
void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) {
|
||||
methodOop method = (methodOop)JNIHandles::resolve(_method);
|
||||
// print compiler name
|
||||
st->print("%s:", CompileBroker::compiler(comp_level())->name());
|
||||
char* method_name = NULL;
|
||||
if (method != NULL) {
|
||||
method_name = method->name_and_sig_as_C_string(buf, buflen);
|
||||
}
|
||||
print_compilation(st, method, method_name);
|
||||
print_compilation(st);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print_line
|
||||
void CompileTask::print_line() {
|
||||
Thread *thread = Thread::current();
|
||||
methodHandle method(thread,
|
||||
(methodOop)JNIHandles::resolve(method_handle()));
|
||||
ResourceMark rm(thread);
|
||||
|
||||
ttyLocker ttyl; // keep the following output all in one block
|
||||
|
||||
// print compiler name if requested
|
||||
if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler(comp_level())->name());
|
||||
print_compilation(tty, method(), NULL);
|
||||
print_compilation();
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print_compilation_impl
|
||||
void CompileTask::print_compilation_impl(outputStream* st, methodOop method, int compile_id, int comp_level, bool is_osr_method, int osr_bci, bool is_blocking, const char* msg) {
|
||||
st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp
|
||||
st->print("%4d ", compile_id); // print compilation number
|
||||
|
||||
// method attributes
|
||||
const char compile_type = is_osr_method ? '%' : ' ';
|
||||
const char sync_char = method->is_synchronized() ? 's' : ' ';
|
||||
const char exception_char = method->has_exception_handler() ? '!' : ' ';
|
||||
const char blocking_char = is_blocking ? 'b' : ' ';
|
||||
const char native_char = method->is_native() ? 'n' : ' ';
|
||||
|
||||
// print method attributes
|
||||
st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char);
|
||||
|
||||
if (TieredCompilation) {
|
||||
if (comp_level != -1) st->print("%d ", comp_level);
|
||||
else st->print("- ");
|
||||
}
|
||||
st->print(" "); // more indent
|
||||
|
||||
method->print_short_name(st);
|
||||
if (is_osr_method) {
|
||||
st->print(" @ %d", osr_bci);
|
||||
}
|
||||
st->print(" (%d bytes)", method->code_size());
|
||||
|
||||
if (msg != NULL) {
|
||||
st->print(" %s", msg);
|
||||
}
|
||||
st->cr();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print_inlining
|
||||
void CompileTask::print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg) {
|
||||
// 1234567
|
||||
st->print(" "); // print timestamp
|
||||
// 1234
|
||||
st->print(" "); // print compilation number
|
||||
|
||||
// method attributes
|
||||
const char sync_char = method->is_synchronized() ? 's' : ' ';
|
||||
const char exception_char = method->has_exception_handlers() ? '!' : ' ';
|
||||
const char monitors_char = method->has_monitor_bytecodes() ? 'm' : ' ';
|
||||
|
||||
// print method attributes
|
||||
st->print(" %c%c%c ", sync_char, exception_char, monitors_char);
|
||||
|
||||
if (TieredCompilation) {
|
||||
st->print(" ");
|
||||
}
|
||||
st->print(" "); // more indent
|
||||
st->print(" "); // initial inlining indent
|
||||
|
||||
for (int i = 0; i < inline_level; i++) st->print(" ");
|
||||
|
||||
st->print("@ %d ", bci); // print bci
|
||||
method->print_short_name(st);
|
||||
st->print(" (%d bytes)", method->code_size());
|
||||
|
||||
if (msg != NULL) {
|
||||
st->print(" %s", msg);
|
||||
}
|
||||
st->cr();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print_inline_indent
|
||||
void CompileTask::print_inline_indent(int inline_level, outputStream* st) {
|
||||
// 1234567
|
||||
st->print(" "); // print timestamp
|
||||
// 1234
|
||||
st->print(" "); // print compilation number
|
||||
// %s!bn
|
||||
st->print(" "); // print method attributes
|
||||
if (TieredCompilation) {
|
||||
st->print(" ");
|
||||
}
|
||||
st->print(" "); // more indent
|
||||
st->print(" "); // initial inlining indent
|
||||
for (int i = 0; i < inline_level; i++) st->print(" ");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print_compilation
|
||||
void CompileTask::print_compilation(outputStream* st) {
|
||||
oop rem = JNIHandles::resolve(method_handle());
|
||||
assert(rem != NULL && rem->is_method(), "must be");
|
||||
methodOop method = (methodOop) rem;
|
||||
bool is_osr_method = osr_bci() != InvocationEntryBci;
|
||||
print_compilation_impl(st, method, compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::log_task
|
||||
void CompileTask::log_task(xmlStream* log) {
|
||||
@ -1086,7 +1165,13 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
|
||||
// do the compilation
|
||||
if (method->is_native()) {
|
||||
if (!PreferInterpreterNativeStubs) {
|
||||
(void) AdapterHandlerLibrary::create_native_wrapper(method);
|
||||
// Acquire our lock.
|
||||
int compile_id;
|
||||
{
|
||||
MutexLocker locker(MethodCompileQueue_lock, THREAD);
|
||||
compile_id = assign_compile_id(method, standard_entry_bci);
|
||||
}
|
||||
(void) AdapterHandlerLibrary::create_native_wrapper(method, compile_id);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
@ -1194,7 +1279,6 @@ uint CompileBroker::assign_compile_id(methodHandle method, int osr_bci) {
|
||||
assert(MethodCompileQueue_lock->owner() == Thread::current(),
|
||||
"must hold the compilation queue lock");
|
||||
bool is_osr = (osr_bci != standard_entry_bci);
|
||||
assert(!method->is_native(), "no longer compile natives");
|
||||
uint id;
|
||||
if (CICountOSR && is_osr) {
|
||||
id = ++_osr_compilation_id;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -56,7 +56,6 @@ class CompileTask : public CHeapObj {
|
||||
int _hot_count; // information about its invocation counter
|
||||
const char* _comment; // more info about the task
|
||||
|
||||
void print_compilation(outputStream *st, methodOop method, char* method_name);
|
||||
public:
|
||||
CompileTask() {
|
||||
_lock = new Monitor(Mutex::nonleaf+2, "CompileTaskLock");
|
||||
@ -96,10 +95,26 @@ class CompileTask : public CHeapObj {
|
||||
CompileTask* prev() const { return _prev; }
|
||||
void set_prev(CompileTask* prev) { _prev = prev; }
|
||||
|
||||
private:
|
||||
static void print_compilation_impl(outputStream* st, methodOop method, int compile_id, int comp_level, bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false, const char* msg = NULL);
|
||||
|
||||
public:
|
||||
void print_compilation(outputStream* st = tty);
|
||||
static void print_compilation(outputStream* st, const nmethod* nm, const char* msg = NULL) {
|
||||
print_compilation_impl(st, nm->method(), nm->compile_id(), nm->comp_level(), nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false, msg);
|
||||
}
|
||||
|
||||
static void print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg = NULL);
|
||||
static void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
|
||||
print_inlining(tty, method, inline_level, bci, msg);
|
||||
}
|
||||
|
||||
static void print_inline_indent(int inline_level, outputStream* st = tty);
|
||||
|
||||
void print();
|
||||
void print_line();
|
||||
|
||||
void print_line_on_error(outputStream* st, char* buf, int buflen);
|
||||
|
||||
void log_task(xmlStream* log);
|
||||
void log_task_queued();
|
||||
void log_task_start(CompileLog* log);
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "classfile/vmSymbols.hpp"
|
||||
#include "compiler/compileBroker.hpp"
|
||||
#include "compiler/compileLog.hpp"
|
||||
#include "interpreter/linkResolver.hpp"
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
@ -75,13 +76,6 @@ InlineTree::InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvm
|
||||
assert(!UseOldInlining, "do not use for old stuff");
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void print_indent(int depth) {
|
||||
tty->print(" ");
|
||||
for (int i = depth; i != 0; --i) tty->print(" ");
|
||||
}
|
||||
|
||||
static bool is_init_with_ea(ciMethod* callee_method,
|
||||
ciMethod* caller_method, Compile* C) {
|
||||
// True when EA is ON and a java constructor is called or
|
||||
@ -100,7 +94,7 @@ const char* InlineTree::shouldInline(ciMethod* callee_method, ciMethod* caller_m
|
||||
if(callee_method->should_inline()) {
|
||||
*wci_result = *(WarmCallInfo::always_hot());
|
||||
if (PrintInlining && Verbose) {
|
||||
print_indent(inline_depth());
|
||||
CompileTask::print_inline_indent(inline_depth());
|
||||
tty->print_cr("Inlined method is hot: ");
|
||||
}
|
||||
return NULL;
|
||||
@ -116,7 +110,7 @@ const char* InlineTree::shouldInline(ciMethod* callee_method, ciMethod* caller_m
|
||||
size < InlineThrowMaxSize ) {
|
||||
wci_result->set_profit(wci_result->profit() * 100);
|
||||
if (PrintInlining && Verbose) {
|
||||
print_indent(inline_depth());
|
||||
CompileTask::print_inline_indent(inline_depth());
|
||||
tty->print_cr("Inlined method with many throws (throws=%d):", callee_method->interpreter_throwout_count());
|
||||
}
|
||||
return NULL;
|
||||
@ -138,9 +132,9 @@ const char* InlineTree::shouldInline(ciMethod* callee_method, ciMethod* caller_m
|
||||
|
||||
max_size = C->freq_inline_size();
|
||||
if (size <= max_size && TraceFrequencyInlining) {
|
||||
print_indent(inline_depth());
|
||||
CompileTask::print_inline_indent(inline_depth());
|
||||
tty->print_cr("Inlined frequent method (freq=%d count=%d):", freq, call_site_count);
|
||||
print_indent(inline_depth());
|
||||
CompileTask::print_inline_indent(inline_depth());
|
||||
callee_method->print();
|
||||
tty->cr();
|
||||
}
|
||||
@ -315,8 +309,25 @@ const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_
|
||||
if( inline_depth() > MaxInlineLevel ) {
|
||||
return "inlining too deep";
|
||||
}
|
||||
if( method() == callee_method &&
|
||||
inline_depth() > MaxRecursiveInlineLevel ) {
|
||||
|
||||
// We need to detect recursive inlining of method handle targets: if
|
||||
// the current method is a method handle adapter and one of the
|
||||
// callers is the same method as the callee, we bail out if
|
||||
// MaxRecursiveInlineLevel is hit.
|
||||
if (method()->is_method_handle_adapter()) {
|
||||
JVMState* jvms = caller_jvms();
|
||||
int inline_level = 0;
|
||||
while (jvms != NULL && jvms->has_method()) {
|
||||
if (jvms->method() == callee_method) {
|
||||
inline_level++;
|
||||
if (inline_level > MaxRecursiveInlineLevel)
|
||||
return "recursively inlining too deep";
|
||||
}
|
||||
jvms = jvms->caller();
|
||||
}
|
||||
}
|
||||
|
||||
if (method() == callee_method && inline_depth() > MaxRecursiveInlineLevel) {
|
||||
return "recursively inlining too deep";
|
||||
}
|
||||
|
||||
@ -368,18 +379,14 @@ bool pass_initial_checks(ciMethod* caller_method, int caller_bci, ciMethod* call
|
||||
#ifndef PRODUCT
|
||||
//------------------------------print_inlining---------------------------------
|
||||
// Really, the failure_msg can be a success message also.
|
||||
void InlineTree::print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const {
|
||||
print_indent(inline_depth());
|
||||
tty->print("@ %d ", caller_bci);
|
||||
if( callee_method ) callee_method->print_short_name();
|
||||
else tty->print(" callee not monotonic or profiled");
|
||||
tty->print(" %s", (failure_msg ? failure_msg : "inline"));
|
||||
if( Verbose && callee_method ) {
|
||||
void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, const char* failure_msg) const {
|
||||
CompileTask::print_inlining(callee_method, inline_depth(), caller_bci, failure_msg ? failure_msg : "inline");
|
||||
if (callee_method == NULL) tty->print(" callee not monotonic or profiled");
|
||||
if (Verbose && callee_method) {
|
||||
const InlineTree *top = this;
|
||||
while( top->caller_tree() != NULL ) { top = top->caller_tree(); }
|
||||
tty->print(" bcs: %d+%d invoked: %d", top->count_inline_bcs(), callee_method->code_size(), callee_method->interpreter_invocation_count());
|
||||
}
|
||||
tty->cr();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,6 +27,7 @@
|
||||
#include "ci/ciCallSite.hpp"
|
||||
#include "ci/ciMethodHandle.hpp"
|
||||
#include "classfile/vmSymbols.hpp"
|
||||
#include "compiler/compileBroker.hpp"
|
||||
#include "compiler/compileLog.hpp"
|
||||
#include "interpreter/linkResolver.hpp"
|
||||
#include "opto/addnode.hpp"
|
||||
@ -43,17 +44,17 @@
|
||||
#ifndef PRODUCT
|
||||
void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) {
|
||||
if (TraceTypeProfile || PrintInlining || PrintOptoInlining) {
|
||||
tty->print(" ");
|
||||
for( int i = 0; i < depth; i++ ) tty->print(" ");
|
||||
if (!PrintOpto) {
|
||||
method->print_short_name();
|
||||
tty->print(" ->");
|
||||
if (!PrintInlining) {
|
||||
if (!PrintOpto && !PrintCompilation) {
|
||||
method->print_short_name();
|
||||
tty->cr();
|
||||
}
|
||||
CompileTask::print_inlining(prof_method, depth, bci);
|
||||
}
|
||||
tty->print(" @ %d ", bci);
|
||||
prof_method->print_short_name();
|
||||
tty->print(" >>TypeProfile (%d/%d counts) = ", receiver_count, site_count);
|
||||
CompileTask::print_inline_indent(depth);
|
||||
tty->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count);
|
||||
prof_klass->name()->print_symbol();
|
||||
tty->print_cr(" (%d bytes)", prof_method->code_size());
|
||||
tty->cr();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -269,13 +270,13 @@ CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index,
|
||||
}
|
||||
if (miss_cg != NULL) {
|
||||
if (next_hit_cg != NULL) {
|
||||
NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)));
|
||||
NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1)));
|
||||
// We don't need to record dependency on a receiver here and below.
|
||||
// Whenever we inline, the dependency is added by Parse::Parse().
|
||||
miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX);
|
||||
}
|
||||
if (miss_cg != NULL) {
|
||||
NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth(), jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count));
|
||||
NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count));
|
||||
cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0));
|
||||
if (cg != NULL) return cg;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "classfile/vmSymbols.hpp"
|
||||
#include "compiler/compileBroker.hpp"
|
||||
#include "compiler/compileLog.hpp"
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
#include "opto/addnode.hpp"
|
||||
@ -388,11 +389,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
|
||||
#endif
|
||||
if (kit.try_to_inline()) {
|
||||
if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
|
||||
tty->print("Inlining intrinsic %s%s at bci:%d in",
|
||||
vmIntrinsics::name_at(intrinsic_id()),
|
||||
(is_virtual() ? " (virtual)" : ""), kit.bci());
|
||||
kit.caller()->print_short_name(tty);
|
||||
tty->print_cr(" (%d bytes)", kit.caller()->code_size());
|
||||
CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, kit.bci(), is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
|
||||
}
|
||||
C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
|
||||
if (C->log()) {
|
||||
|
@ -2479,20 +2479,10 @@ bool AdapterHandlerEntry::compare_code(unsigned char* buffer, int length, int to
|
||||
// java compiled calling convention to the native convention, handlizes
|
||||
// arguments, and transitions to native. On return from the native we transition
|
||||
// back to java blocking if a safepoint is in progress.
|
||||
nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
|
||||
nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method, int compile_id) {
|
||||
ResourceMark rm;
|
||||
nmethod* nm = NULL;
|
||||
|
||||
if (PrintCompilation) {
|
||||
ttyLocker ttyl;
|
||||
tty->print("--- n%s ", (method->is_synchronized() ? "s" : " "));
|
||||
method->print_short_name(tty);
|
||||
if (method->is_static()) {
|
||||
tty->print(" (static)");
|
||||
}
|
||||
tty->cr();
|
||||
}
|
||||
|
||||
assert(method->has_native_function(), "must have something valid to call!");
|
||||
|
||||
{
|
||||
@ -2537,6 +2527,7 @@ nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
|
||||
// Generate the compiled-to-native wrapper code
|
||||
nm = SharedRuntime::generate_native_wrapper(&_masm,
|
||||
method,
|
||||
compile_id,
|
||||
total_args_passed,
|
||||
comp_args_on_stack,
|
||||
sig_bt,regs,
|
||||
@ -2548,6 +2539,10 @@ nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
|
||||
|
||||
// Install the generated code.
|
||||
if (nm != NULL) {
|
||||
if (PrintCompilation) {
|
||||
ttyLocker ttyl;
|
||||
CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
|
||||
}
|
||||
method->set_code(method, nm);
|
||||
nm->post_compiled_method_load_event();
|
||||
} else {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -438,6 +438,7 @@ class SharedRuntime: AllStatic {
|
||||
// returns.
|
||||
static nmethod *generate_native_wrapper(MacroAssembler* masm,
|
||||
methodHandle method,
|
||||
int compile_id,
|
||||
int total_args_passed,
|
||||
int max_arg,
|
||||
BasicType *sig_bt,
|
||||
@ -659,7 +660,7 @@ class AdapterHandlerLibrary: public AllStatic {
|
||||
|
||||
static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
|
||||
address i2c_entry, address c2i_entry, address c2i_unverified_entry);
|
||||
static nmethod* create_native_wrapper(methodHandle method);
|
||||
static nmethod* create_native_wrapper(methodHandle method, int compile_id);
|
||||
static AdapterHandlerEntry* get_adapter(methodHandle method);
|
||||
|
||||
#ifdef HAVE_DTRACE_H
|
||||
|
Loading…
Reference in New Issue
Block a user