提交 3d784467 编写于 作者: N never

6943485: JVMTI always on capabilities change code generation too much

Reviewed-by: twisti, dcubed
上级 622cef17
......@@ -316,7 +316,7 @@ void Compilation::install_code(int frame_size) {
implicit_exception_table(),
compiler(),
_env->comp_level(),
needs_debug_information(),
true,
has_unsafe_access()
);
}
......@@ -449,8 +449,6 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* metho
assert(_arena == NULL, "shouldn't only one instance of Compilation in existence at a time");
_arena = Thread::current()->resource_area();
_compilation = this;
_needs_debug_information = _env->jvmti_can_examine_or_deopt_anywhere() ||
JavaMonitorsInStackTrace || AlwaysEmitDebugInfo || DeoptimizeALot;
_exception_info_list = new ExceptionInfoList();
_implicit_exception_table.set_size(0);
compile_method();
......
/*
* Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1999-2010 Sun Microsystems, Inc. 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
......@@ -70,7 +70,6 @@ class Compilation: public StackObj {
int _max_spills;
FrameMap* _frame_map;
C1_MacroAssembler* _masm;
bool _needs_debug_information;
bool _has_exception_handlers;
bool _has_fpu_code;
bool _has_unsafe_access;
......@@ -117,7 +116,6 @@ class Compilation: public StackObj {
// accessors
ciEnv* env() const { return _env; }
AbstractCompiler* compiler() const { return _compiler; }
bool needs_debug_information() const { return _needs_debug_information; }
bool has_exception_handlers() const { return _has_exception_handlers; }
bool has_fpu_code() const { return _has_fpu_code; }
bool has_unsafe_access() const { return _has_unsafe_access; }
......@@ -132,7 +130,6 @@ class Compilation: public StackObj {
CodeOffsets* offsets() { return &_offsets; }
// setters
void set_needs_debug_information(bool f) { _needs_debug_information = f; }
void set_has_exception_handlers(bool f) { _has_exception_handlers = f; }
void set_has_fpu_code(bool f) { _has_fpu_code = f; }
void set_has_unsafe_access(bool f) { _has_unsafe_access = f; }
......
......@@ -1493,7 +1493,6 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
Dependencies* GraphBuilder::dependency_recorder() const {
assert(DeoptC1, "need debug information");
compilation()->set_needs_debug_information(true);
return compilation()->dependency_recorder();
}
......
/*
* Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2005-2010 Sun Microsystems, Inc. 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
......@@ -2814,9 +2814,6 @@ IRScopeDebugInfo* LinearScan::compute_debug_info_for_scope(int op_id, IRScope* c
void LinearScan::compute_debug_info(CodeEmitInfo* info, int op_id) {
if (!compilation()->needs_debug_information()) {
return;
}
TRACE_LINEAR_SCAN(3, tty->print_cr("creating debug information at op_id %d", op_id));
IRScope* innermost_scope = info->scope();
......
/*
* Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000-2010 Sun Microsystems, Inc. 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
......@@ -252,9 +252,6 @@
develop(bool, BailoutOnExceptionHandlers, false, \
"bailout of compilation for methods with exception handlers") \
\
develop(bool, AlwaysEmitDebugInfo, false, \
"always emit debug info") \
\
develop(bool, InstallMethods, true, \
"Install methods at the end of successful compilations") \
\
......
......@@ -1408,8 +1408,11 @@ BCEscapeAnalyzer::BCEscapeAnalyzer(ciMethod* method, BCEscapeAnalyzer* parent)
}
void BCEscapeAnalyzer::copy_dependencies(Dependencies *deps) {
if(!has_dependencies())
return;
if (ciEnv::current()->jvmti_can_hotswap_or_post_breakpoint()) {
// Also record evol dependencies so redefinition of the
// callee will trigger recompilation.
deps->assert_evol_method(method());
}
for (int i = 0; i < _dependencies.length(); i+=2) {
ciKlass *k = _dependencies[i]->as_klass();
ciMethod *m = _dependencies[i+1]->as_method();
......
......@@ -176,7 +176,6 @@ void ciEnv::cache_jvmti_state() {
// Get Jvmti capabilities under lock to get consistant values.
MutexLocker mu(JvmtiThreadState_lock);
_jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
_jvmti_can_examine_or_deopt_anywhere = JvmtiExport::can_examine_or_deopt_anywhere();
_jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables();
_jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions();
}
......@@ -887,8 +886,6 @@ void ciEnv::register_method(ciMethod* target,
if (!failing() &&
( (!jvmti_can_hotswap_or_post_breakpoint() &&
JvmtiExport::can_hotswap_or_post_breakpoint()) ||
(!jvmti_can_examine_or_deopt_anywhere() &&
JvmtiExport::can_examine_or_deopt_anywhere()) ||
(!jvmti_can_access_local_variables() &&
JvmtiExport::can_access_local_variables()) ||
(!jvmti_can_post_on_exceptions() &&
......
......@@ -55,7 +55,6 @@ private:
// Cache Jvmti state
bool _jvmti_can_hotswap_or_post_breakpoint;
bool _jvmti_can_examine_or_deopt_anywhere;
bool _jvmti_can_access_local_variables;
bool _jvmti_can_post_on_exceptions;
......@@ -257,7 +256,6 @@ public:
// Cache Jvmti state
void cache_jvmti_state();
bool jvmti_can_hotswap_or_post_breakpoint() const { return _jvmti_can_hotswap_or_post_breakpoint; }
bool jvmti_can_examine_or_deopt_anywhere() const { return _jvmti_can_examine_or_deopt_anywhere; }
bool jvmti_can_access_local_variables() const { return _jvmti_can_access_local_variables; }
bool jvmti_can_post_on_exceptions() const { return _jvmti_can_post_on_exceptions; }
......
/*
* Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1999-2010 Sun Microsystems, Inc. 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
......@@ -105,8 +105,7 @@ void C2Compiler::compile_method(ciEnv* env,
}
bool subsume_loads = true;
bool do_escape_analysis = DoEscapeAnalysis &&
!(env->jvmti_can_hotswap_or_post_breakpoint() ||
env->jvmti_can_examine_or_deopt_anywhere());
!env->jvmti_can_access_local_variables();
while (!env->failing()) {
// Attempt to compile while subsuming loads into machine instructions.
Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis);
......
......@@ -871,7 +871,6 @@ void Compile::Init(int aliaslevel) {
set_has_split_ifs(false);
set_has_loops(has_method() && method()->has_loops()); // first approximation
set_has_stringbuilder(false);
_deopt_happens = true; // start out assuming the worst
_trap_can_recompile = false; // no traps emitted yet
_major_progress = true; // start out assuming good things will happen
set_has_unsafe_access(false);
......
......@@ -146,7 +146,6 @@ class Compile : public Phase {
int _orig_pc_slot_offset_in_bytes;
int _major_progress; // Count of something big happening
bool _deopt_happens; // TRUE if de-optimization CAN happen
bool _has_loops; // True if the method _may_ have some loops
bool _has_split_ifs; // True if the method _may_ have some split-if
bool _has_unsafe_access; // True if the method _may_ produce faults in unsafe loads or stores.
......@@ -300,7 +299,6 @@ class Compile : public Phase {
void set_freq_inline_size(int n) { _freq_inline_size = n; }
int freq_inline_size() const { return _freq_inline_size; }
void set_max_inline_size(int n) { _max_inline_size = n; }
bool deopt_happens() const { return _deopt_happens; }
bool has_loops() const { return _has_loops; }
void set_has_loops(bool z) { _has_loops = z; }
bool has_split_ifs() const { return _has_split_ifs; }
......
......@@ -812,10 +812,6 @@ void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) {
JVMState* youngest_jvms = sync_jvms();
// Do we need debug info here? If it is a SafePoint and this method
// cannot de-opt, then we do NOT need any debug info.
bool full_info = (C->deopt_happens() || call->Opcode() != Op_SafePoint);
// If we are guaranteed to throw, we can prune everything but the
// input to the current bytecode.
bool can_prune_locals = false;
......@@ -829,10 +825,9 @@ void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) {
}
}
if (env()->jvmti_can_examine_or_deopt_anywhere()) {
if (env()->jvmti_can_access_local_variables()) {
// At any safepoint, this method can get breakpointed, which would
// then require an immediate deoptimization.
full_info = true;
can_prune_locals = false; // do not prune locals
stack_slots_not_pruned = 0;
}
......@@ -890,7 +885,7 @@ void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) {
k = in_jvms->locoff();
l = in_jvms->loc_size();
out_jvms->set_locoff(p);
if (full_info && !can_prune_locals) {
if (!can_prune_locals) {
for (j = 0; j < l; j++)
call->set_req(p++, in_map->in(k+j));
} else {
......@@ -901,7 +896,7 @@ void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) {
k = in_jvms->stkoff();
l = in_jvms->sp();
out_jvms->set_stkoff(p);
if (full_info && !can_prune_locals) {
if (!can_prune_locals) {
for (j = 0; j < l; j++)
call->set_req(p++, in_map->in(k+j));
} else if (can_prune_locals && stack_slots_not_pruned != 0) {
......
......@@ -270,7 +270,6 @@ int JvmtiExport::_field_access_count = 0;
int JvmtiExport::_field_modification_count = 0;
bool JvmtiExport::_can_access_local_variables = false;
bool JvmtiExport::_can_examine_or_deopt_anywhere = false;
bool JvmtiExport::_can_hotswap_or_post_breakpoint = false;
bool JvmtiExport::_can_modify_any_class = false;
bool JvmtiExport::_can_walk_any_space = false;
......
......@@ -58,7 +58,6 @@ class JvmtiExport : public AllStatic {
static int _field_modification_count;
static bool _can_access_local_variables;
static bool _can_examine_or_deopt_anywhere;
static bool _can_hotswap_or_post_breakpoint;
static bool _can_modify_any_class;
static bool _can_walk_any_space;
......@@ -112,7 +111,6 @@ class JvmtiExport : public AllStatic {
// these should only be called by the friend class
friend class JvmtiManageCapabilities;
inline static void set_can_examine_or_deopt_anywhere(bool on) { _can_examine_or_deopt_anywhere = (on != 0); }
inline static void set_can_modify_any_class(bool on) { _can_modify_any_class = (on != 0); }
inline static void set_can_access_local_variables(bool on) { _can_access_local_variables = (on != 0); }
inline static void set_can_hotswap_or_post_breakpoint(bool on) { _can_hotswap_or_post_breakpoint = (on != 0); }
......@@ -220,7 +218,6 @@ class JvmtiExport : public AllStatic {
static void enter_live_phase();
// ------ can_* conditions (below) are set at OnLoad and never changed ------------
inline static bool can_examine_or_deopt_anywhere() { return _can_examine_or_deopt_anywhere; }
inline static bool can_modify_any_class() { return _can_modify_any_class; }
inline static bool can_access_local_variables() { return _can_access_local_variables; }
inline static bool can_hotswap_or_post_breakpoint() { return _can_hotswap_or_post_breakpoint; }
......
......@@ -332,16 +332,6 @@ void JvmtiManageCapabilities::update() {
}
JvmtiExport::set_can_get_source_debug_extension(avail.can_get_source_debug_extension);
JvmtiExport::set_can_examine_or_deopt_anywhere(
avail.can_generate_breakpoint_events ||
interp_events ||
avail.can_redefine_classes ||
avail.can_retransform_classes ||
avail.can_access_local_variables ||
avail.can_get_owned_monitor_info ||
avail.can_get_current_contended_monitor ||
avail.can_get_monitor_info ||
avail.can_get_owned_monitor_stack_depth_info);
JvmtiExport::set_can_maintain_original_method_order(avail.can_maintain_original_method_order);
JvmtiExport::set_can_post_interpreter_events(interp_events);
JvmtiExport::set_can_hotswap_or_post_breakpoint(
......@@ -353,10 +343,13 @@ void JvmtiManageCapabilities::update() {
avail.can_generate_all_class_hook_events);
JvmtiExport::set_can_walk_any_space(
avail.can_tag_objects); // disable sharing in onload phase
// This controls whether the compilers keep extra locals live to
// improve the debugging experience so only set them if the selected
// capabilities look like a debugger.
JvmtiExport::set_can_access_local_variables(
avail.can_access_local_variables ||
avail.can_redefine_classes ||
avail.can_retransform_classes);
avail.can_access_local_variables ||
avail.can_generate_breakpoint_events ||
avail.can_generate_frame_pop_events);
JvmtiExport::set_can_post_on_exceptions(
avail.can_generate_exception_events ||
avail.can_generate_frame_pop_events ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册