diff --git a/src/share/vm/c1/c1_Compilation.cpp b/src/share/vm/c1/c1_Compilation.cpp index 5fd667cb7d0c014a8a3b08a28c1c2a816ad840cf..9543fc6642c24ef4987611ce877fbc3ccec2b5e7 100644 --- a/src/share/vm/c1/c1_Compilation.cpp +++ b/src/share/vm/c1/c1_Compilation.cpp @@ -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(); diff --git a/src/share/vm/c1/c1_Compilation.hpp b/src/share/vm/c1/c1_Compilation.hpp index c0332491bde6be28037c5e0fd7a3f8b2fcab2548..f347c8888a9988a6d62f5f11a67449f3b289c850 100644 --- a/src/share/vm/c1/c1_Compilation.hpp +++ b/src/share/vm/c1/c1_Compilation.hpp @@ -1,5 +1,5 @@ /* - * 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; } diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp index 808adc78cf4b2e9add467284f0517e7859bde108..5e622e4a8b665b814f1e55ae1f211305b9c35a79 100644 --- a/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/src/share/vm/c1/c1_GraphBuilder.cpp @@ -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(); } diff --git a/src/share/vm/c1/c1_LinearScan.cpp b/src/share/vm/c1/c1_LinearScan.cpp index 8460c65997ee874c11391f7ab00af6e330ad5e34..e6cc2f8ff6af61a1b9d4d2cd0bcb5bcff50415e1 100644 --- a/src/share/vm/c1/c1_LinearScan.cpp +++ b/src/share/vm/c1/c1_LinearScan.cpp @@ -1,5 +1,5 @@ /* - * 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(); diff --git a/src/share/vm/c1/c1_globals.hpp b/src/share/vm/c1/c1_globals.hpp index 87efd1b04dac7d5790c88e3cf4e54b0379615062..5ec5c7de013da637888ff49f92bdfda4fee6a8d6 100644 --- a/src/share/vm/c1/c1_globals.hpp +++ b/src/share/vm/c1/c1_globals.hpp @@ -1,5 +1,5 @@ /* - * 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") \ \ diff --git a/src/share/vm/ci/bcEscapeAnalyzer.cpp b/src/share/vm/ci/bcEscapeAnalyzer.cpp index 71cffdbd6daf51d78deae2400671d0ce4c4aac6e..b3be9b8eb57c9f75b8ca3af2ee06da76127ce1cf 100644 --- a/src/share/vm/ci/bcEscapeAnalyzer.cpp +++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp @@ -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(); diff --git a/src/share/vm/ci/ciEnv.cpp b/src/share/vm/ci/ciEnv.cpp index 5e3eee4f4050c350ac735d48e98d718630852cb0..b947e50ab8f045e57ab91e14c04641ea83ef4dcc 100644 --- a/src/share/vm/ci/ciEnv.cpp +++ b/src/share/vm/ci/ciEnv.cpp @@ -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() && diff --git a/src/share/vm/ci/ciEnv.hpp b/src/share/vm/ci/ciEnv.hpp index d20c1d1a380aece4858775d3aa28613c1e6045ea..22503fb2d72dd977334e7b0ff74468a7f6ab29ee 100644 --- a/src/share/vm/ci/ciEnv.hpp +++ b/src/share/vm/ci/ciEnv.hpp @@ -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; } diff --git a/src/share/vm/opto/c2compiler.cpp b/src/share/vm/opto/c2compiler.cpp index 4ee3a6f5d2c929c0ce0c8a8457b99ba05756e457..d4b6f2a162f8aa8d6ee98a4fb6765cdac02d1abe 100644 --- a/src/share/vm/opto/c2compiler.cpp +++ b/src/share/vm/opto/c2compiler.cpp @@ -1,5 +1,5 @@ /* - * 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); diff --git a/src/share/vm/opto/compile.cpp b/src/share/vm/opto/compile.cpp index 5ca0286b54550b64ff7b415173e7280caaf55ed5..595a6aa703399fe33410aa900c1678d32352eed9 100644 --- a/src/share/vm/opto/compile.cpp +++ b/src/share/vm/opto/compile.cpp @@ -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); diff --git a/src/share/vm/opto/compile.hpp b/src/share/vm/opto/compile.hpp index 7027d29d5337e9ad1e98eacec23131d34099f633..51361dc3f39605f33174cc207e9ae99002e3330b 100644 --- a/src/share/vm/opto/compile.hpp +++ b/src/share/vm/opto/compile.hpp @@ -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; } diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp index 3d550551451d430be339c7ddc4cc9305cbb1c7aa..780ac554bfefc33475cb9c2d3f5438add679ab50 100644 --- a/src/share/vm/opto/graphKit.cpp +++ b/src/share/vm/opto/graphKit.cpp @@ -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) { diff --git a/src/share/vm/prims/jvmtiExport.cpp b/src/share/vm/prims/jvmtiExport.cpp index 7d189e5beee9d3086cbab15a511bf91295941a92..d2a37c86494d1e851cef578a13eb76ede219417b 100644 --- a/src/share/vm/prims/jvmtiExport.cpp +++ b/src/share/vm/prims/jvmtiExport.cpp @@ -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; diff --git a/src/share/vm/prims/jvmtiExport.hpp b/src/share/vm/prims/jvmtiExport.hpp index a7e264ba78fde66d72725fe634bb9e63c97cd559..250b1adfdc9853b3abc2b1e912edcda8c8295437 100644 --- a/src/share/vm/prims/jvmtiExport.hpp +++ b/src/share/vm/prims/jvmtiExport.hpp @@ -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; } diff --git a/src/share/vm/prims/jvmtiManageCapabilities.cpp b/src/share/vm/prims/jvmtiManageCapabilities.cpp index 195607346c5e97f4a06278fa8ee9a7265c28b432..6ac7226f963ccdf43dc4e75dd0e69f1c24f5f7f2 100644 --- a/src/share/vm/prims/jvmtiManageCapabilities.cpp +++ b/src/share/vm/prims/jvmtiManageCapabilities.cpp @@ -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 ||