From 9f12cf393eaadde3341db16bcbd4326956ba7ce8 Mon Sep 17 00:00:00 2001 From: never Date: Wed, 16 Sep 2009 11:06:10 -0700 Subject: [PATCH] 6854812: 6.0_14-b08 crashes with a SIGSEGV Reviewed-by: kvn, twisti --- src/share/vm/ci/ciMethod.cpp | 16 +++++++++++++--- src/share/vm/ci/ciMethod.hpp | 6 ++++++ src/share/vm/ci/ciTypeFlow.cpp | 9 +++++++-- src/share/vm/opto/parse1.cpp | 4 +++- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/share/vm/ci/ciMethod.cpp b/src/share/vm/ci/ciMethod.cpp index c32582f4d..f83429c1a 100644 --- a/src/share/vm/ci/ciMethod.cpp +++ b/src/share/vm/ci/ciMethod.cpp @@ -325,10 +325,10 @@ ciTypeFlow* ciMethod::get_osr_flow_analysis(int osr_bci) { } // ------------------------------------------------------------------ -// ciMethod::liveness_at_bci +// ciMethod::raw_liveness_at_bci // // Which local variables are live at a specific bci? -MethodLivenessResult ciMethod::liveness_at_bci(int bci) { +MethodLivenessResult ciMethod::raw_liveness_at_bci(int bci) { check_is_loaded(); if (_liveness == NULL) { // Create the liveness analyzer. @@ -336,7 +336,17 @@ MethodLivenessResult ciMethod::liveness_at_bci(int bci) { _liveness = new (arena) MethodLiveness(arena, this); _liveness->compute_liveness(); } - MethodLivenessResult result = _liveness->get_liveness_at(bci); + return _liveness->get_liveness_at(bci); +} + +// ------------------------------------------------------------------ +// ciMethod::liveness_at_bci +// +// Which local variables are live at a specific bci? When debugging +// will return true for all locals in some cases to improve debug +// information. +MethodLivenessResult ciMethod::liveness_at_bci(int bci) { + MethodLivenessResult result = raw_liveness_at_bci(bci); if (CURRENT_ENV->jvmti_can_access_local_variables() || DeoptimizeALot || CompileTheWorld) { // Keep all locals live for the user's edification and amusement. result.at_put_range(0, result.size(), true); diff --git a/src/share/vm/ci/ciMethod.hpp b/src/share/vm/ci/ciMethod.hpp index c04e0351e..1b65bc90c 100644 --- a/src/share/vm/ci/ciMethod.hpp +++ b/src/share/vm/ci/ciMethod.hpp @@ -149,6 +149,12 @@ class ciMethod : public ciObject { bool has_monitor_bytecodes() const { return _uses_monitors; } bool has_balanced_monitors(); + // Returns a bitmap indicating which locals are required to be + // maintained as live for deopt. raw_liveness_at_bci is always the + // direct output of the liveness computation while liveness_at_bci + // may mark all locals as live to improve support for debugging Java + // code by maintaining the state of as many locals as possible. + MethodLivenessResult raw_liveness_at_bci(int bci); MethodLivenessResult liveness_at_bci(int bci); // Get the interpreters viewpoint on oop liveness. MethodLiveness is diff --git a/src/share/vm/ci/ciTypeFlow.cpp b/src/share/vm/ci/ciTypeFlow.cpp index cc6cc6679..d21ea761a 100644 --- a/src/share/vm/ci/ciTypeFlow.cpp +++ b/src/share/vm/ci/ciTypeFlow.cpp @@ -2486,8 +2486,13 @@ void ciTypeFlow::build_loop_tree(Block* blk) { // Assume irreducible entries need more data flow add_to_work_list(succ); } - lp = lp->parent(); - assert(lp != NULL, "nested loop must have parent by now"); + Loop* plp = lp->parent(); + if (plp == NULL) { + // This only happens for some irreducible cases. The parent + // will be updated during a later pass. + break; + } + lp = plp; } // Merge loop tree branch for all successors. diff --git a/src/share/vm/opto/parse1.cpp b/src/share/vm/opto/parse1.cpp index 222a2f35a..9633c5e27 100644 --- a/src/share/vm/opto/parse1.cpp +++ b/src/share/vm/opto/parse1.cpp @@ -229,7 +229,9 @@ void Parse::load_interpreter_state(Node* osr_buf) { } } - MethodLivenessResult live_locals = method()->liveness_at_bci(osr_bci()); + // Use the raw liveness computation to make sure that unexpected + // values don't propagate into the OSR frame. + MethodLivenessResult live_locals = method()->raw_liveness_at_bci(osr_bci()); if (!live_locals.is_valid()) { // Degenerate or breakpointed method. C->record_method_not_compilable("OSR in empty or breakpointed method"); -- GitLab