mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-02 07:10:23 +00:00
8382135: AArch64: HotCodeCollectorMoveFunction.java fails intermittently
Reviewed-by: eastigeevich, aph
This commit is contained in:
parent
4bf4a60f76
commit
c7816b0b44
@ -61,15 +61,13 @@ bool ThreadSampler::sample_all_java_threads() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CodeCache::contains(pc)) {
|
||||
nmethod* nm = CodeCache::find_blob(pc)->as_nmethod_or_null();
|
||||
if (nm != nullptr) {
|
||||
bool created = false;
|
||||
int *count = _samples.put_if_absent(nm, 0, &created);
|
||||
(*count)++;
|
||||
if (created) {
|
||||
_samples.maybe_grow();
|
||||
}
|
||||
CodeBlob* cb = CodeCache::find_blob(pc);
|
||||
if (cb != nullptr && cb->is_nmethod()) {
|
||||
bool created = false;
|
||||
int *count = _samples.put_if_absent(cb->as_nmethod(), 0, &created);
|
||||
(*count)++;
|
||||
if (created) {
|
||||
_samples.maybe_grow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,6 +79,8 @@ public class HotCodeCollectorMoveFunction {
|
||||
private static final int C2_LEVEL = 4;
|
||||
private static final int FUNC_RUN_MILLIS = 60_000;
|
||||
|
||||
private static volatile int blackholeCount = 0;
|
||||
|
||||
static {
|
||||
try {
|
||||
method = Runner.class.getMethod("func");
|
||||
@ -111,7 +113,15 @@ public class HotCodeCollectorMoveFunction {
|
||||
|
||||
public static void func() {
|
||||
long start = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() - start < FUNC_RUN_MILLIS) {}
|
||||
while (System.currentTimeMillis() - start < FUNC_RUN_MILLIS) {
|
||||
// Perform multiplicative LCG to ensure the compiler does not optimize away the code.
|
||||
// Integer overflow is used for the modulus so the loop terminates after (2^32)/4 iterations
|
||||
int num = 1;
|
||||
do {
|
||||
blackholeCount++;
|
||||
num *= 69069;
|
||||
} while (num != 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user