Skip to content
Snippets Groups Projects
Commit 25537e9c authored by Amos Shi's avatar Amos Shi
Browse files

8298596: vmTestbase/nsk/sysdict/vm/stress/chain/chain008/chain008.java fails...

8298596: vmTestbase/nsk/sysdict/vm/stress/chain/chain008/chain008.java fails with "NoClassDefFoundError: Could not initialize class java.util.concurrent.ThreadLocalRandom"

Reviewed-by: mbaesken
Backport-of: c3242ee452c25b5038283c68e65541122a10df0d
parent d642a137
No related branches found
No related tags found
No related merge requests found
/*
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2023, 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
......@@ -234,11 +234,21 @@ public final class GarbageUtils {
long.class,
OOM_TYPE.class);
private static MethodHandle eat;
static {
try {
eat = MethodHandles.lookup().findStatic(GarbageUtils.class, "eatMemoryImpl", mt);
} catch (Exception nsme) {
// Can't run the test for some unexpected reason
throw new RuntimeException(nsme);
}
}
public static int eatMemory(ExecutionController stresser, GarbageProducer gp, long initialFactor, long minMemoryChunk, long factor, OOM_TYPE type) {
try {
// Using a methodhandle invoke of eatMemoryImpl to prevent inlining of it
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodHandle eat = lookup.findStatic(GarbageUtils.class, "eatMemoryImpl", mt);
return (int) eat.invoke(stresser, gp, initialFactor, minMemoryChunk, factor, type);
} catch (OutOfMemoryError e) {
return numberOfOOMEs++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment