EVALUATION
Reproduced with VM upto HS23 b06, the test does not fail after HS23 b08. Failed only with enabled EA and lock elimination. Test passed if run with -XX:-EliminateLocks or -XX-DoEscapeAnalysis. It seems, EA incorrectly eliminated locks:
% /java/re/jdk/8/promoted/all/b15/binaries/solaris-amd64/fastdebug/bin/java -showversion -d64 -XX:+PrintCompilation -XX:+PrintInlining -XX:-TieredCompilation -Xbatch -XX:CICompilerCount=1 -XX:+PrintEliminateLocks -XX:+EliminateLocks StrangeRaceConditionTest
java version "1.8.0-ea-fastdebug"
Java(TM) SE Runtime Environment (build 1.8.0-ea-fastdebug-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b06-fastdebug, mixed mode)
...
5187 9 s b StrangeRaceConditionTest::remove (10 bytes)
s @ 1 StrangeRaceConditionTest::getBuffer (66 bytes) already compiled into a big method
s @ 6 StrangeRaceConditionTest$Buffer::remove (18 bytes) inline (hot)
++++ Eliminating: 105 Unlock
++++ Eliminating: 70 Lock
5196 10 s b StrangeRaceConditionTest$Buffer::remove (18 bytes)
5201 2 % b StrangeRaceConditionTest::strangeRaceConditionTest @ 36 (103 bytes)
s @ 46 StrangeRaceConditionTest::remove (10 bytes) inline (hot)
s @ 1 StrangeRaceConditionTest::getBuffer (66 bytes) already compiled into a big method
s @ 6 StrangeRaceConditionTest$Buffer::remove (18 bytes) inline (hot)
!m @ 59 java.util.Timer::cancel (40 bytes) too big
s @ 63 StrangeRaceConditionTest$Buffer::getErrorC (5 bytes) inline (hot)
++++ Eliminating: 263 Unlock
++++ Eliminating: 231 Lock
5308 2 % StrangeRaceConditionTest::strangeRaceConditionTest @ -2 (103 bytes) made not entrant
FAILED 515470 times
|
SUGGESTED FIX
Next part of 7112478 changes was enough for the test to pass. But I would suggest to backport full 7112478 fix.
diff -r 6078bcb7f798 src/share/vm/ci/bcEscapeAnalyzer.cpp
--- a/src/share/vm/ci/bcEscapeAnalyzer.cpp Mon Jun 25 21:25:09 2012 +0200
+++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp Wed Jun 27 18:16:49 2012 -0700
@@ -150,11 +150,23 @@
clear_bits(vars, _arg_local);
}
-void BCEscapeAnalyzer::set_global_escape(ArgumentMap vars) {
+void BCEscapeAnalyzer::set_global_escape(ArgumentMap vars, bool merge) {
clear_bits(vars, _arg_local);
clear_bits(vars, _arg_stack);
if (vars.contains_allocated())
_allocated_escapes = true;
+
+ if (merge && !vars.is_empty()) {
+ // Merge new state into already processed block.
+ // New state is not taken into account and
+ // it may invalidate set_returned() result.
+ if (vars.contains_unknown() || vars.contains_allocated()) {
+ _return_local = false;
+ }
+ if (vars.contains_unknown() || vars.contains_vars()) {
+ _return_allocated = false;
+ }
+ }
}
void BCEscapeAnalyzer::set_dirty(ArgumentMap vars) {
@@ -998,7 +1010,7 @@
t.set_difference(d_state->_stack[i]);
extra_vars.set_union(t);
}
- set_global_escape(extra_vars);
+ set_global_escape(extra_vars, true);
}
}
diff -r 6078bcb7f798 src/share/vm/ci/bcEscapeAnalyzer.hpp
--- a/src/share/vm/ci/bcEscapeAnalyzer.hpp Mon Jun 25 21:25:09 2012 +0200
+++ b/src/share/vm/ci/bcEscapeAnalyzer.hpp Wed Jun 27 18:16:49 2012 -0700
@@ -81,7 +81,7 @@
bool is_arg_stack(ArgumentMap vars);
void clear_bits(ArgumentMap vars, VectorSet &bs);
void set_method_escape(ArgumentMap vars);
- void set_global_escape(ArgumentMap vars);
+ void set_global_escape(ArgumentMap vars, bool merge = false);
void set_dirty(ArgumentMap vars);
void set_modified(ArgumentMap vars, int offs, int size);
|