1 /*
2 * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
44 * @key randomness
45 * @requires vm.gc.Shenandoah
46 * @library /test/lib
47 *
48 * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx128m
49 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
50 * TestPinnedGarbage
51 */
52
53 /* @test id=verify
54 * @summary Test that garbage in the pinned region does not crash VM
55 * @key randomness
56 * @requires vm.gc.Shenandoah
57 * @library /test/lib
58 * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx128m
59 * -XX:+UseShenandoahGC
60 * -XX:+ShenandoahVerify
61 * TestPinnedGarbage
62 */
63
64 import java.util.Arrays;
65 import java.util.Random;
66 import jdk.test.lib.Utils;
67
68 public class TestPinnedGarbage {
69 static {
70 System.loadLibrary("TestPinnedGarbage");
71 }
72
73 private static final int NUM_RUNS = 1_000;
74 private static final int OBJS_COUNT = 1 << 10;
75 private static final int GARBAGE_COUNT = 1 << 18;
76
77 private static native void pin(int[] a);
78 private static native void unpin(int[] a);
79
80 public static void main(String[] args) {
81 Random rng = Utils.getRandomInstance();
82 for (int i = 0; i < NUM_RUNS; i++) {
83 test(rng);
|
1 /*
2 * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
3 * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
45 * @key randomness
46 * @requires vm.gc.Shenandoah
47 * @library /test/lib
48 *
49 * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx128m
50 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
51 * TestPinnedGarbage
52 */
53
54 /* @test id=verify
55 * @summary Test that garbage in the pinned region does not crash VM
56 * @key randomness
57 * @requires vm.gc.Shenandoah
58 * @library /test/lib
59 * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx128m
60 * -XX:+UseShenandoahGC
61 * -XX:+ShenandoahVerify
62 * TestPinnedGarbage
63 */
64
65 /* @test id=generational
66 * @summary Test that garbage in the pinned region does not crash VM
67 * @key randomness
68 * @requires vm.gc.Shenandoah
69 * @library /test/lib
70 *
71 * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx128m
72 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational
73 * -XX:+ShenandoahVerify
74 * TestPinnedGarbage
75 *
76 * @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx128m
77 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational
78 * TestPinnedGarbage
79 */
80
81 import java.util.Arrays;
82 import java.util.Random;
83 import jdk.test.lib.Utils;
84
85 public class TestPinnedGarbage {
86 static {
87 System.loadLibrary("TestPinnedGarbage");
88 }
89
90 private static final int NUM_RUNS = 1_000;
91 private static final int OBJS_COUNT = 1 << 10;
92 private static final int GARBAGE_COUNT = 1 << 18;
93
94 private static native void pin(int[] a);
95 private static native void unpin(int[] a);
96
97 public static void main(String[] args) {
98 Random rng = Utils.getRandomInstance();
99 for (int i = 0; i < NUM_RUNS; i++) {
100 test(rng);
|