< prev index next >

test/hotspot/jtreg/gc/TestHumongousReferenceObject.java

Print this page
rev 59879 : [mq]: 8249000
   1 /*
   2  * Copyright (c) 2016, 2019, Oracle and/or its affiliates. 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  */


  32  * @bug 8151499 8153734
  33  * @modules java.base/jdk.internal.vm.annotation
  34  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseParallelGC -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  35  */
  36 
  37 /*
  38  * @test TestHumongousReferenceObjectG1
  39  * @summary Test that verifies that iteration over large, plain Java objects, that potentially cross region boundaries on G1, with references in them works.
  40  * @requires vm.gc.G1
  41  * @bug 8151499 8153734
  42  * @modules java.base/jdk.internal.vm.annotation
  43  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseG1GC -XX:G1HeapRegionSize=1M -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  44  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseG1GC -XX:G1HeapRegionSize=2M -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  45  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  46  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseG1GC -XX:G1HeapRegionSize=8M -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  47  */
  48 
  49 /*
  50  * @test TestHumongousReferenceObjectShenandoah
  51  * @summary Test that verifies that iteration over large, plain Java objects, that potentially cross region boundaries, with references in them works.
  52  * @requires vm.gc.Shenandoah & !vm.graal.enabled
  53  * @bug 8151499 8153734
  54  * @modules java.base/jdk.internal.vm.annotation
  55  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xms128m -Xmx128m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahRegionSize=8M -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  56  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xms128m -Xmx128m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahRegionSize=8M -XX:ContendedPaddingWidth=8192 -XX:+UnlockDiagnosticVMOptions -XX:+ShenandoahVerify gc.TestHumongousReferenceObject
  57  */
  58 public class TestHumongousReferenceObject {
  59 
  60     /*
  61       Due to 300 fields with 8K @Contended padding around each field, it takes 2.4M bytes per instance.
  62       With small G1 regions, it is bound to cross regions. G1 should properly (card) mark the object nevertheless.
  63       With 128M heap, it is enough to allocate ~100 of these objects to provoke at least one GC.
  64      */
  65 
  66     static volatile Object instance;
  67 
  68     public static void main(String[] args) {
  69         for (int c = 0; c < 100; c++) {
  70             instance = new TestHumongousReferenceObject();
  71         }
  72     }


   1 /*
   2  * Copyright (c) 2016, 2020, Oracle and/or its affiliates. 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  */


  32  * @bug 8151499 8153734
  33  * @modules java.base/jdk.internal.vm.annotation
  34  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseParallelGC -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  35  */
  36 
  37 /*
  38  * @test TestHumongousReferenceObjectG1
  39  * @summary Test that verifies that iteration over large, plain Java objects, that potentially cross region boundaries on G1, with references in them works.
  40  * @requires vm.gc.G1
  41  * @bug 8151499 8153734
  42  * @modules java.base/jdk.internal.vm.annotation
  43  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseG1GC -XX:G1HeapRegionSize=1M -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  44  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseG1GC -XX:G1HeapRegionSize=2M -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  45  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  46  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xmx128m -XX:+UseG1GC -XX:G1HeapRegionSize=8M -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  47  */
  48 
  49 /*
  50  * @test TestHumongousReferenceObjectShenandoah
  51  * @summary Test that verifies that iteration over large, plain Java objects, that potentially cross region boundaries, with references in them works.
  52  * @requires vm.gc.Shenandoah
  53  * @bug 8151499 8153734
  54  * @modules java.base/jdk.internal.vm.annotation
  55  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xms128m -Xmx128m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahRegionSize=8M -XX:ContendedPaddingWidth=8192 gc.TestHumongousReferenceObject
  56  * @run main/othervm -XX:+EnableContended -XX:-RestrictContended -Xms128m -Xmx128m -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahRegionSize=8M -XX:ContendedPaddingWidth=8192 -XX:+UnlockDiagnosticVMOptions -XX:+ShenandoahVerify gc.TestHumongousReferenceObject
  57  */
  58 public class TestHumongousReferenceObject {
  59 
  60     /*
  61       Due to 300 fields with 8K @Contended padding around each field, it takes 2.4M bytes per instance.
  62       With small G1 regions, it is bound to cross regions. G1 should properly (card) mark the object nevertheless.
  63       With 128M heap, it is enough to allocate ~100 of these objects to provoke at least one GC.
  64      */
  65 
  66     static volatile Object instance;
  67 
  68     public static void main(String[] args) {
  69         for (int c = 0; c < 100; c++) {
  70             instance = new TestHumongousReferenceObject();
  71         }
  72     }


< prev index next >