< prev index next >
test/gc/TestBigObj.java
Print this page
@@ -1,13 +1,35 @@
/*
- @test
- @bug 6845368
- @summary ensure gc updates references > 64K bytes from the start of the obj
- @author John Coomes
- @run main/othervm/timeout=720 -Xmx64m bigobj
-*/
+ * Copyright (c) 2009, 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test TestBigObj
+ * @bug 6845368
+ * @summary ensure gc updates references > 64K bytes from the start of the obj
+ * @run main/othervm/timeout=720 -Xmx64m -verbose:gc TestBigObj
+ */
+
// Allocate an object with a block of reference fields that starts more
// than 64K bytes from the start of the object. This is done with
// inheritance because VMs typically rearrange the order fields appear in
// memory, and group fields of the same type together within an object (i.e.,
// in a single object, all reference fields could be put into a block near the
@@ -19,17 +41,20 @@
//
// After allocating the big object, set a reference field within the
// block to a known object, provoke GC, then make sure the field was
// updated properly.
-public class bigobj extends bigparent {
+public class TestBigObj extends BigParent {
+ public static Object trash;
public static void main(String argv[]) {
- bigobj c = new bigobj();
+ TestBigObj c = new TestBigObj();
Object o = c.o = new Object();
// Provoke GC so o is moved (if this is a moving collector).
- for (int i = 0; i < 64 * 1024 * 1024; i++) new Object();
+ for (int i = 0; i < 64 * 1024 * 1024; i++) {
+ trash = new Object();
+ }
if (o != c.o) {
System.out.println("failed: o=" + o + " != c.o=" + c.o);
throw new RuntimeException("failed - c.o was not updated");
}
@@ -36,11 +61,11 @@
}
Object o;
}
-class bigparent {
+class BigParent {
public long l00001;
public long l00002;
public long l00003;
public long l00004;
public long l00005;
< prev index next >