8320534: fatal error for the NMTBenchmark test run for the mainline build

Reviewed-by: stuefe, aboldtch
This commit is contained in:
Afshin Zafari 2024-03-15 14:52:15 +00:00
parent bfba4894e1
commit 71f9c4e7fd

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. 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
@ -35,7 +35,7 @@ import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
@State(Scope.Thread)
@Warmup(iterations = 2, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
public abstract class NMTBenchmark {
@ -85,10 +85,12 @@ public abstract class NMTBenchmark {
if (i % 3 == 1) alloc1(i);
if (i % 3 == 2) alloc2(i);
}
private void alloc0(int i) {
if (unsafe == null) return;
addresses[i] = unsafe.allocateMemory(S);
}
private void alloc1(int i) { alloc0(i); }
private void alloc2(int i) { alloc1(i); }