From f278cb74be64aa36d3014e37ab9bb661906ab48e Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Wed, 12 Jul 2023 11:50:31 -0700 Subject: [PATCH 1/5] Promote to long before shifting when computing array size (cherry picked from commit 463949bb94b815b93c491087a1fa8bb3ce5245da) --- .../org/graalvm/compiler/replacements/AllocationSnippets.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/AllocationSnippets.java b/compiler/src/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/AllocationSnippets.java index 805f9178d74c..2c1a4668d2fc 100644 --- a/compiler/src/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/AllocationSnippets.java +++ b/compiler/src/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/AllocationSnippets.java @@ -123,7 +123,7 @@ protected UnsignedWord arrayAllocationSize(int length, int arrayBaseOffset, int * We do an unsigned multiplication so that a negative array length will result in an array size * greater than Integer.MAX_VALUE. */ - public static long arrayAllocationSize(int length, int arrayBaseOffset, int log2ElementSize, int alignment) { + public static long arrayAllocationSize(long length, int arrayBaseOffset, int log2ElementSize, int alignment) { long size = ((length & 0xFFFFFFFFL) << log2ElementSize) + arrayBaseOffset + (alignment - 1); long mask = ~(alignment - 1); return size & mask; From 33bde2c722147f323abcef9eb74416702b0b7749 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Thu, 7 Sep 2023 22:47:46 -0700 Subject: [PATCH 2/5] Add HumongousReferenceObjectTest (cherry picked from commit b0945882acc87fcd592c05922c2ed718961b4a4a) --- compiler/mx.compiler/suite.py | 3 + .../test/HumongousReferenceObjectTest.java | 378 ++++++++++++++++++ 2 files changed, 381 insertions(+) create mode 100644 compiler/src/org.graalvm.compiler.jtt/src/org/graalvm/compiler/hotspot/test/HumongousReferenceObjectTest.java diff --git a/compiler/mx.compiler/suite.py b/compiler/mx.compiler/suite.py index db11b8c86c24..251e364c0f2c 100644 --- a/compiler/mx.compiler/suite.py +++ b/compiler/mx.compiler/suite.py @@ -290,6 +290,9 @@ "org.graalvm.compiler.options" ], "requiresConcealed" : { + "java.base" : [ + "jdk.internal.vm.annotation", + ], "jdk.internal.vm.ci" : [ "jdk.vm.ci.code", "jdk.vm.ci.common", diff --git a/compiler/src/org.graalvm.compiler.jtt/src/org/graalvm/compiler/hotspot/test/HumongousReferenceObjectTest.java b/compiler/src/org.graalvm.compiler.jtt/src/org/graalvm/compiler/hotspot/test/HumongousReferenceObjectTest.java new file mode 100644 index 000000000000..782b32091b59 --- /dev/null +++ b/compiler/src/org.graalvm.compiler.jtt/src/org/graalvm/compiler/hotspot/test/HumongousReferenceObjectTest.java @@ -0,0 +1,378 @@ +/* + * Copyright (c) 2016, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package org.graalvm.compiler.hotspot.test; + +import java.io.IOException; +import java.util.Arrays; + +import org.graalvm.compiler.core.test.SubprocessTest; +import org.junit.Test; + +import jdk.internal.vm.annotation.Contended; + +@SuppressWarnings("unused") +public class HumongousReferenceObjectTest extends SubprocessTest { + /* + * Due to 300 fields with 8K @Contended padding around each field, it takes 2.4M bytes per + * instance. With small G1 regions, it is bound to cross regions. G1 should properly (card) mark + * the object nevertheless. With 128M heap, it is enough to allocate ~100 of these objects to + * provoke at least one GC. + */ + + static volatile Object instance; + + public static void testSnippet() { + for (int c = 0; c < 100; c++) { + instance = new HumongousReferenceObjectTest(); + } + } + + public void runSubprocessTest(String... args) throws IOException, InterruptedException { + launchSubprocess(() -> { + test("testSnippet"); + }, args); + + // Test without assertions as well + String[] newArgs = Arrays.copyOf(args, args.length + 1); + newArgs[args.length] = "-da"; + launchSubprocess(() -> { + test("testSnippet"); + }, newArgs); + } + + @Test + public void testG1() throws IOException, InterruptedException { + String[] sizes = {"-XX:G1HeapRegionSize=1M", "-XX:G1HeapRegionSize=2M", "-XX:G1HeapRegionSize=4M", "-XX:G1HeapRegionSize=8M"}; + for (String size : sizes) { + runSubprocessTest("-XX:+UseG1GC", "-XX:+EnableContended", "-XX:-RestrictContended", "-Xmx128m", "-XX:ContendedPaddingWidth=8192", size); + } + } + + @Test + public void testParallel() throws IOException, InterruptedException { + runSubprocessTest("-XX:+UseParallelGC", "-XX:+EnableContended", "-XX:-RestrictContended", "-Xmx128m", "-XX:ContendedPaddingWidth=8192"); + } + + @Contended Integer int1 = 1; + @Contended Integer int2 = 2; + @Contended Integer int3 = 3; + @Contended Integer int4 = 4; + @Contended Integer int5 = 5; + @Contended Integer int6 = 6; + @Contended Integer int7 = 7; + @Contended Integer int8 = 8; + @Contended Integer int9 = 9; + @Contended Integer int10 = 10; + @Contended Integer int11 = 11; + @Contended Integer int12 = 12; + @Contended Integer int13 = 13; + @Contended Integer int14 = 14; + @Contended Integer int15 = 15; + @Contended Integer int16 = 16; + @Contended Integer int17 = 17; + @Contended Integer int18 = 18; + @Contended Integer int19 = 19; + @Contended Integer int20 = 20; + @Contended Integer int21 = 21; + @Contended Integer int22 = 22; + @Contended Integer int23 = 23; + @Contended Integer int24 = 24; + @Contended Integer int25 = 25; + @Contended Integer int26 = 26; + @Contended Integer int27 = 27; + @Contended Integer int28 = 28; + @Contended Integer int29 = 29; + @Contended Integer int30 = 30; + @Contended Integer int31 = 31; + @Contended Integer int32 = 32; + @Contended Integer int33 = 33; + @Contended Integer int34 = 34; + @Contended Integer int35 = 35; + @Contended Integer int36 = 36; + @Contended Integer int37 = 37; + @Contended Integer int38 = 38; + @Contended Integer int39 = 39; + @Contended Integer int40 = 40; + @Contended Integer int41 = 41; + @Contended Integer int42 = 42; + @Contended Integer int43 = 43; + @Contended Integer int44 = 44; + @Contended Integer int45 = 45; + @Contended Integer int46 = 46; + @Contended Integer int47 = 47; + @Contended Integer int48 = 48; + @Contended Integer int49 = 49; + @Contended Integer int50 = 50; + @Contended Integer int51 = 51; + @Contended Integer int52 = 52; + @Contended Integer int53 = 53; + @Contended Integer int54 = 54; + @Contended Integer int55 = 55; + @Contended Integer int56 = 56; + @Contended Integer int57 = 57; + @Contended Integer int58 = 58; + @Contended Integer int59 = 59; + @Contended Integer int60 = 60; + @Contended Integer int61 = 61; + @Contended Integer int62 = 62; + @Contended Integer int63 = 63; + @Contended Integer int64 = 64; + @Contended Integer int65 = 65; + @Contended Integer int66 = 66; + @Contended Integer int67 = 67; + @Contended Integer int68 = 68; + @Contended Integer int69 = 69; + @Contended Integer int70 = 70; + @Contended Integer int71 = 71; + @Contended Integer int72 = 72; + @Contended Integer int73 = 73; + @Contended Integer int74 = 74; + @Contended Integer int75 = 75; + @Contended Integer int76 = 76; + @Contended Integer int77 = 77; + @Contended Integer int78 = 78; + @Contended Integer int79 = 79; + @Contended Integer int80 = 80; + @Contended Integer int81 = 81; + @Contended Integer int82 = 82; + @Contended Integer int83 = 83; + @Contended Integer int84 = 84; + @Contended Integer int85 = 85; + @Contended Integer int86 = 86; + @Contended Integer int87 = 87; + @Contended Integer int88 = 88; + @Contended Integer int89 = 89; + @Contended Integer int90 = 90; + @Contended Integer int91 = 91; + @Contended Integer int92 = 92; + @Contended Integer int93 = 93; + @Contended Integer int94 = 94; + @Contended Integer int95 = 95; + @Contended Integer int96 = 96; + @Contended Integer int97 = 97; + @Contended Integer int98 = 98; + @Contended Integer int99 = 99; + @Contended Integer int100 = 100; + @Contended Integer int101 = 101; + @Contended Integer int102 = 102; + @Contended Integer int103 = 103; + @Contended Integer int104 = 104; + @Contended Integer int105 = 105; + @Contended Integer int106 = 106; + @Contended Integer int107 = 107; + @Contended Integer int108 = 108; + @Contended Integer int109 = 109; + @Contended Integer int110 = 110; + @Contended Integer int111 = 111; + @Contended Integer int112 = 112; + @Contended Integer int113 = 113; + @Contended Integer int114 = 114; + @Contended Integer int115 = 115; + @Contended Integer int116 = 116; + @Contended Integer int117 = 117; + @Contended Integer int118 = 118; + @Contended Integer int119 = 119; + @Contended Integer int120 = 120; + @Contended Integer int121 = 121; + @Contended Integer int122 = 122; + @Contended Integer int123 = 123; + @Contended Integer int124 = 124; + @Contended Integer int125 = 125; + @Contended Integer int126 = 126; + @Contended Integer int127 = 127; + @Contended Integer int128 = 128; + @Contended Integer int129 = 129; + @Contended Integer int130 = 130; + @Contended Integer int131 = 131; + @Contended Integer int132 = 132; + @Contended Integer int133 = 133; + @Contended Integer int134 = 134; + @Contended Integer int135 = 135; + @Contended Integer int136 = 136; + @Contended Integer int137 = 137; + @Contended Integer int138 = 138; + @Contended Integer int139 = 139; + @Contended Integer int140 = 140; + @Contended Integer int141 = 141; + @Contended Integer int142 = 142; + @Contended Integer int143 = 143; + @Contended Integer int144 = 144; + @Contended Integer int145 = 145; + @Contended Integer int146 = 146; + @Contended Integer int147 = 147; + @Contended Integer int148 = 148; + @Contended Integer int149 = 149; + @Contended Integer int150 = 150; + @Contended Integer int151 = 151; + @Contended Integer int152 = 152; + @Contended Integer int153 = 153; + @Contended Integer int154 = 154; + @Contended Integer int155 = 155; + @Contended Integer int156 = 156; + @Contended Integer int157 = 157; + @Contended Integer int158 = 158; + @Contended Integer int159 = 159; + @Contended Integer int160 = 160; + @Contended Integer int161 = 161; + @Contended Integer int162 = 162; + @Contended Integer int163 = 163; + @Contended Integer int164 = 164; + @Contended Integer int165 = 165; + @Contended Integer int166 = 166; + @Contended Integer int167 = 167; + @Contended Integer int168 = 168; + @Contended Integer int169 = 169; + @Contended Integer int170 = 170; + @Contended Integer int171 = 171; + @Contended Integer int172 = 172; + @Contended Integer int173 = 173; + @Contended Integer int174 = 174; + @Contended Integer int175 = 175; + @Contended Integer int176 = 176; + @Contended Integer int177 = 177; + @Contended Integer int178 = 178; + @Contended Integer int179 = 179; + @Contended Integer int180 = 180; + @Contended Integer int181 = 181; + @Contended Integer int182 = 182; + @Contended Integer int183 = 183; + @Contended Integer int184 = 184; + @Contended Integer int185 = 185; + @Contended Integer int186 = 186; + @Contended Integer int187 = 187; + @Contended Integer int188 = 188; + @Contended Integer int189 = 189; + @Contended Integer int190 = 190; + @Contended Integer int191 = 191; + @Contended Integer int192 = 192; + @Contended Integer int193 = 193; + @Contended Integer int194 = 194; + @Contended Integer int195 = 195; + @Contended Integer int196 = 196; + @Contended Integer int197 = 197; + @Contended Integer int198 = 198; + @Contended Integer int199 = 199; + @Contended Integer int200 = 200; + @Contended Integer int201 = 201; + @Contended Integer int202 = 202; + @Contended Integer int203 = 203; + @Contended Integer int204 = 204; + @Contended Integer int205 = 205; + @Contended Integer int206 = 206; + @Contended Integer int207 = 207; + @Contended Integer int208 = 208; + @Contended Integer int209 = 209; + @Contended Integer int210 = 210; + @Contended Integer int211 = 211; + @Contended Integer int212 = 212; + @Contended Integer int213 = 213; + @Contended Integer int214 = 214; + @Contended Integer int215 = 215; + @Contended Integer int216 = 216; + @Contended Integer int217 = 217; + @Contended Integer int218 = 218; + @Contended Integer int219 = 219; + @Contended Integer int220 = 220; + @Contended Integer int221 = 221; + @Contended Integer int222 = 222; + @Contended Integer int223 = 223; + @Contended Integer int224 = 224; + @Contended Integer int225 = 225; + @Contended Integer int226 = 226; + @Contended Integer int227 = 227; + @Contended Integer int228 = 228; + @Contended Integer int229 = 229; + @Contended Integer int230 = 230; + @Contended Integer int231 = 231; + @Contended Integer int232 = 232; + @Contended Integer int233 = 233; + @Contended Integer int234 = 234; + @Contended Integer int235 = 235; + @Contended Integer int236 = 236; + @Contended Integer int237 = 237; + @Contended Integer int238 = 238; + @Contended Integer int239 = 239; + @Contended Integer int240 = 240; + @Contended Integer int241 = 241; + @Contended Integer int242 = 242; + @Contended Integer int243 = 243; + @Contended Integer int244 = 244; + @Contended Integer int245 = 245; + @Contended Integer int246 = 246; + @Contended Integer int247 = 247; + @Contended Integer int248 = 248; + @Contended Integer int249 = 249; + @Contended Integer int250 = 250; + @Contended Integer int251 = 251; + @Contended Integer int252 = 252; + @Contended Integer int253 = 253; + @Contended Integer int254 = 254; + @Contended Integer int255 = 255; + @Contended Integer int256 = 256; + @Contended Integer int257 = 257; + @Contended Integer int258 = 258; + @Contended Integer int259 = 259; + @Contended Integer int260 = 260; + @Contended Integer int261 = 261; + @Contended Integer int262 = 262; + @Contended Integer int263 = 263; + @Contended Integer int264 = 264; + @Contended Integer int265 = 265; + @Contended Integer int266 = 266; + @Contended Integer int267 = 267; + @Contended Integer int268 = 268; + @Contended Integer int269 = 269; + @Contended Integer int270 = 270; + @Contended Integer int271 = 271; + @Contended Integer int272 = 272; + @Contended Integer int273 = 273; + @Contended Integer int274 = 274; + @Contended Integer int275 = 275; + @Contended Integer int276 = 276; + @Contended Integer int277 = 277; + @Contended Integer int278 = 278; + @Contended Integer int279 = 279; + @Contended Integer int280 = 280; + @Contended Integer int281 = 281; + @Contended Integer int282 = 282; + @Contended Integer int283 = 283; + @Contended Integer int284 = 284; + @Contended Integer int285 = 285; + @Contended Integer int286 = 286; + @Contended Integer int287 = 287; + @Contended Integer int288 = 288; + @Contended Integer int289 = 289; + @Contended Integer int290 = 290; + @Contended Integer int291 = 291; + @Contended Integer int292 = 292; + @Contended Integer int293 = 293; + @Contended Integer int294 = 294; + @Contended Integer int295 = 295; + @Contended Integer int296 = 296; + @Contended Integer int297 = 297; + @Contended Integer int298 = 298; + @Contended Integer int299 = 299; + @Contended Integer int300 = 300; +} From 7e2bd5c93493f680903e3a3e25cbcd8a5088a765 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Wed, 12 Jul 2023 22:47:04 -0700 Subject: [PATCH 3/5] Disable fast path allocation for types which must be slow path allocated (cherry picked from commit 6cbcc1a98a025c70ec706ebe097aed37a212411e) --- .../replacements/HotSpotAllocationSnippets.java | 16 +++++++--------- .../replacements/AllocationSnippets.java | 3 ++- .../hotspot/AbstractHotSpotTruffleRuntime.java | 2 +- .../snippets/SubstrateAllocationSnippets.java | 4 ++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/compiler/src/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotAllocationSnippets.java b/compiler/src/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotAllocationSnippets.java index a353a20ccfcd..d0329a14f3d3 100644 --- a/compiler/src/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotAllocationSnippets.java +++ b/compiler/src/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotAllocationSnippets.java @@ -146,10 +146,11 @@ public HotSpotAllocationSnippets(GraalHotSpotVMConfig config, HotSpotRegistersPr @Snippet protected Object allocateInstance(KlassPointer hub, @ConstantParameter long size, + @ConstantParameter boolean forceSlowPath, @ConstantParameter FillContent fillContents, @ConstantParameter boolean emitMemoryBarrier, @ConstantParameter HotSpotAllocationProfilingData profilingData) { - Object result = allocateInstanceImpl(hub.asWord(), WordFactory.unsigned(size), fillContents, emitMemoryBarrier, true, profilingData); + Object result = allocateInstanceImpl(hub.asWord(), WordFactory.unsigned(size), forceSlowPath, fillContents, emitMemoryBarrier, true, profilingData); return piCastToSnippetReplaceeStamp(result); } @@ -194,7 +195,7 @@ public Object allocateInstanceDynamic(@NonNullParameter Class type, * binding of parameters is not yet supported by the GraphBuilderPlugin system. */ UnsignedWord size = WordFactory.unsigned(layoutHelper); - return allocateInstanceImpl(nonNullHub.asWord(), size, fillContents, emitMemoryBarrier, false, profilingData); + return allocateInstanceImpl(nonNullHub.asWord(), size, false, fillContents, emitMemoryBarrier, false, profilingData); } } else { DeoptimizeNode.deopt(None, RuntimeConstraint); @@ -657,12 +658,14 @@ public void lower(NewInstanceNode node, LoweringTool tool) { HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) node.instanceClass(); assert !type.isArray(); ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), type.klass(), tool.getMetaAccess(), graph); - long size = instanceSize(type); + long size = type.instanceSize(); OptionValues localOptions = graph.getOptions(); Arguments args = new Arguments(allocateInstance, graph.getGuardsStage(), tool.getLoweringStage()); args.add("hub", hub); - args.addConst("size", size); + // instanceSize returns a negative number for types which should be slow path allocated + args.addConst("size", Math.abs(size)); + args.addConst("forceSlowPath", size < 0); args.addConst("fillContents", FillContent.fromBoolean(node.fillContents())); args.addConst("emitMemoryBarrier", node.emitMemoryBarrier()); args.addConst("profilingData", getProfilingData(localOptions, "instance", type)); @@ -794,11 +797,6 @@ private static HotSpotResolvedObjectType lookupArrayClass(LoweringTool tool, Jav return HotSpotAllocationSnippets.lookupArrayClass(tool.getMetaAccess(), kind); } - private static long instanceSize(HotSpotResolvedObjectType type) { - long size = type.instanceSize(); - assert size >= 0; - return size; - } } private static class HotSpotAllocationProfilingData extends AllocationProfilingData { diff --git a/compiler/src/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/AllocationSnippets.java b/compiler/src/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/AllocationSnippets.java index 2c1a4668d2fc..8e6b9a9125bf 100644 --- a/compiler/src/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/AllocationSnippets.java +++ b/compiler/src/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/AllocationSnippets.java @@ -49,6 +49,7 @@ public abstract class AllocationSnippets implements Snippets { protected Object allocateInstanceImpl(Word hub, UnsignedWord size, + boolean forceSlowPath, FillContent fillContents, boolean emitMemoryBarrier, boolean constantSize, @@ -58,7 +59,7 @@ protected Object allocateInstanceImpl(Word hub, Word top = readTlabTop(tlabInfo); Word end = readTlabEnd(tlabInfo); Word newTop = top.add(size); - if (useTLAB() && probability(FAST_PATH_PROBABILITY, shouldAllocateInTLAB(size, false)) && probability(FAST_PATH_PROBABILITY, newTop.belowOrEqual(end))) { + if (!forceSlowPath && useTLAB() && probability(FAST_PATH_PROBABILITY, shouldAllocateInTLAB(size, false)) && probability(FAST_PATH_PROBABILITY, newTop.belowOrEqual(end))) { writeTlabTop(tlabInfo, newTop); emitPrefetchAllocate(newTop, false); result = formatObject(hub, size, top, fillContents, emitMemoryBarrier, constantSize, profilingData.snippetCounters); diff --git a/compiler/src/org.graalvm.compiler.truffle.runtime.hotspot/src/org/graalvm/compiler/truffle/runtime/hotspot/AbstractHotSpotTruffleRuntime.java b/compiler/src/org.graalvm.compiler.truffle.runtime.hotspot/src/org/graalvm/compiler/truffle/runtime/hotspot/AbstractHotSpotTruffleRuntime.java index b5b5ffe08dd7..d2dfc2435aec 100644 --- a/compiler/src/org.graalvm.compiler.truffle.runtime.hotspot/src/org/graalvm/compiler/truffle/runtime/hotspot/AbstractHotSpotTruffleRuntime.java +++ b/compiler/src/org.graalvm.compiler.truffle.runtime.hotspot/src/org/graalvm/compiler/truffle/runtime/hotspot/AbstractHotSpotTruffleRuntime.java @@ -593,7 +593,7 @@ protected int getBaseInstanceSize(Class type) { HotSpotMetaAccessProvider meta = (HotSpotMetaAccessProvider) getMetaAccess(); HotSpotResolvedObjectType resolvedType = (HotSpotResolvedObjectType) meta.lookupJavaType(type); - return resolvedType.instanceSize(); + return Math.abs(resolvedType.instanceSize()); } private static boolean fieldIsNotEligible(Class clazz, ResolvedJavaField f) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/snippets/SubstrateAllocationSnippets.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/snippets/SubstrateAllocationSnippets.java index 470a82b65434..3e862eff4793 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/snippets/SubstrateAllocationSnippets.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/snippets/SubstrateAllocationSnippets.java @@ -131,7 +131,7 @@ protected Object allocateInstance(@NonNullParameter DynamicHub hub, @ConstantParameter FillContent fillContents, @ConstantParameter boolean emitMemoryBarrier, @ConstantParameter AllocationProfilingData profilingData) { - Object result = allocateInstanceImpl(encodeAsTLABObjectHeader(hub), WordFactory.unsigned(size), fillContents, emitMemoryBarrier, true, profilingData); + Object result = allocateInstanceImpl(encodeAsTLABObjectHeader(hub), WordFactory.unsigned(size), false, fillContents, emitMemoryBarrier, true, profilingData); return piCastToSnippetReplaceeStamp(result); } @@ -230,7 +230,7 @@ protected Object allocateInstanceDynamicImpl(DynamicHub hub, FillContent fillCon @SuppressWarnings("unused") boolean supportsOptimizedFilling, AllocationProfilingData profilingData) { // The hub was already verified by a ValidateNewInstanceClassNode. UnsignedWord size = LayoutEncoding.getPureInstanceAllocationSize(hub.getLayoutEncoding()); - Object result = allocateInstanceImpl(encodeAsTLABObjectHeader(hub), size, fillContents, emitMemoryBarrier, false, profilingData); + Object result = allocateInstanceImpl(encodeAsTLABObjectHeader(hub), size, false, fillContents, emitMemoryBarrier, false, profilingData); return piCastToSnippetReplaceeStamp(result); } From 003cca123fab910c9a837c808b00dbaea2ed0c6c Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Sat, 16 Sep 2023 11:37:18 -0700 Subject: [PATCH 4/5] Filter out explicitly selected GCs (cherry picked from commit f57c8f331bf9adc5f260e352adec6907f12a1f01) --- .../test/HumongousReferenceObjectTest.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/compiler/src/org.graalvm.compiler.jtt/src/org/graalvm/compiler/hotspot/test/HumongousReferenceObjectTest.java b/compiler/src/org.graalvm.compiler.jtt/src/org/graalvm/compiler/hotspot/test/HumongousReferenceObjectTest.java index 782b32091b59..57aee8cd52b6 100644 --- a/compiler/src/org.graalvm.compiler.jtt/src/org/graalvm/compiler/hotspot/test/HumongousReferenceObjectTest.java +++ b/compiler/src/org.graalvm.compiler.jtt/src/org/graalvm/compiler/hotspot/test/HumongousReferenceObjectTest.java @@ -25,7 +25,9 @@ package org.graalvm.compiler.hotspot.test; import java.io.IOException; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.graalvm.compiler.core.test.SubprocessTest; import org.junit.Test; @@ -50,16 +52,22 @@ public static void testSnippet() { } public void runSubprocessTest(String... args) throws IOException, InterruptedException { + List newArgs = new ArrayList<>(); + Collections.addAll(newArgs, args); + // Filter out any explicitly selected GC + newArgs.remove("-XX:+UseZGC"); + newArgs.remove("-XX:+UseG1GC"); + newArgs.remove("-XX:+UseParallelGC"); + launchSubprocess(() -> { test("testSnippet"); - }, args); + }, newArgs.toArray(new String[0])); // Test without assertions as well - String[] newArgs = Arrays.copyOf(args, args.length + 1); - newArgs[args.length] = "-da"; + newArgs.add("-da"); launchSubprocess(() -> { test("testSnippet"); - }, newArgs); + }, newArgs.toArray(new String[0])); } @Test From 59857a6bc8d33070620258ae9c728bb218d63a32 Mon Sep 17 00:00:00 2001 From: Marouane El Hallaoui Date: Tue, 3 Oct 2023 10:20:14 +0100 Subject: [PATCH 5/5] fix suite.py --- compiler/mx.compiler/suite.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/mx.compiler/suite.py b/compiler/mx.compiler/suite.py index 251e364c0f2c..240ba5fdccc7 100644 --- a/compiler/mx.compiler/suite.py +++ b/compiler/mx.compiler/suite.py @@ -290,9 +290,6 @@ "org.graalvm.compiler.options" ], "requiresConcealed" : { - "java.base" : [ - "jdk.internal.vm.annotation", - ], "jdk.internal.vm.ci" : [ "jdk.vm.ci.code", "jdk.vm.ci.common", @@ -1529,6 +1526,11 @@ "requires" : [ "jdk.unsupported", ], + "requiresConcealed" : { + "java.base" : [ + "jdk.internal.vm.annotation", + ] + }, "checkstyle" : "org.graalvm.compiler.graph", "javaCompliance" : "17+", "workingSets" : "Graal,Test",