Skip to content

Commit 4221665

Browse files
committed
Merge remote-tracking branch 'origin/master' into cwi/GR-38909-substitutions-move
2 parents c99e27b + d5c17e7 commit 4221665

File tree

76 files changed

+2148
-718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2148
-718
lines changed

compiler/src/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/HotSpotAllocationSnippets.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ static boolean useNullAllocationStubs(@InjectedParameter GraalHotSpotVMConfig co
352352
}
353353

354354
@Override
355-
protected final Object callNewArrayStub(Word hub, int length, int fillStartOffset) {
355+
protected final Object callNewArrayStub(Word hub, int length) {
356356
KlassPointer klassPtr = KlassPointer.fromWord(hub);
357357
if (useNullAllocationStubs(INJECTED_VMCONFIG)) {
358358
return nonNullOrDeopt(newArrayOrNull(NEW_ARRAY_OR_NULL, klassPtr, length));

compiler/src/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/AllocationSnippets.java

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ public Object allocateArrayImpl(Word hub,
9393
if (useTLAB() && probability(FAST_PATH_PROBABILITY, shouldAllocateInTLAB(allocationSize, true)) && probability(FAST_PATH_PROBABILITY, newTop.belowOrEqual(end))) {
9494
writeTlabTop(thread, newTop);
9595
emitPrefetchAllocate(newTop, true);
96-
result = formatArray(hub, allocationSize, length, top, fillContents, fillStartOffset, emitMemoryBarrier, maybeUnroll, supportsBulkZeroing, supportsOptimizedFilling,
96+
result = formatArray(hub, allocationSize, length, top, fillContents, emitMemoryBarrier, fillStartOffset, maybeUnroll, supportsBulkZeroing, supportsOptimizedFilling,
9797
profilingData.snippetCounters);
9898
} else {
9999
profilingData.snippetCounters.stub.inc();
100-
result = callNewArrayStub(hub, length, fillStartOffset);
100+
result = callNewArrayStub(hub, length);
101101
}
102102
profileAllocation(profilingData, allocationSize);
103103
return verifyOop(result);
@@ -124,8 +124,7 @@ protected UnsignedWord arrayAllocationSize(int length, int arrayBaseOffset, int
124124
public static long arrayAllocationSize(int length, int arrayBaseOffset, int log2ElementSize, int alignment) {
125125
long size = ((length & 0xFFFFFFFFL) << log2ElementSize) + arrayBaseOffset + (alignment - 1);
126126
long mask = ~(alignment - 1);
127-
long result = size & mask;
128-
return result;
127+
return size & mask;
129128
}
130129

131130
/**
@@ -268,11 +267,7 @@ public Object formatObject(Word hub,
268267
AllocationSnippetCounters snippetCounters) {
269268
initializeObjectHeader(memory, hub, false);
270269
int headerSize = instanceHeaderSize();
271-
if (fillContents == FillContent.WITH_ZEROES) {
272-
zeroMemory(memory, headerSize, size, constantSize, false, false, false, snippetCounters);
273-
} else if (REPLACEMENTS_ASSERTIONS_ENABLED && fillContents == FillContent.WITH_GARBAGE_IF_ASSERTIONS_ENABLED) {
274-
fillWithGarbage(memory, headerSize, size, constantSize, false, false, snippetCounters);
275-
}
270+
fillContents(memory, fillContents, headerSize, size, constantSize, false, false, false, snippetCounters);
276271
emitMemoryBarrierIf(emitMemoryBarrier);
277272
return memory.toObjectNonNull();
278273
}
@@ -285,23 +280,33 @@ public Object formatArray(Word hub,
285280
int length,
286281
Word memory,
287282
FillContent fillContents,
288-
int fillStartOffset,
289283
boolean emitMemoryBarrier,
284+
int fillStartOffset,
290285
boolean maybeUnroll,
291286
boolean supportsBulkZeroing,
292287
boolean supportsOptimizedFilling,
293288
AllocationSnippetCounters snippetCounters) {
294-
memory.writeInt(arrayLengthOffset(), length, LocationIdentity.init());
295-
// Store hub last as the concurrent garbage collectors assume length is valid if hub field
296-
// is not null.
289+
/*
290+
* For TLAB allocations, the initialization order does not matter. Therefore, it is also not
291+
* necessary to use STORE_RELEASE semantics when storing the hub into the newly allocated
292+
* object. This is a major difference to the slow-path allocation where the initialization
293+
* order and the STORE_RELEASE semantics are crucial for concurrent GCs (the slow-path
294+
* allocation can directly allocate in the old generation).
295+
*/
297296
initializeObjectHeader(memory, hub, true);
297+
memory.writeInt(arrayLengthOffset(), length, LocationIdentity.init());
298+
fillContents(memory, fillContents, fillStartOffset, allocationSize, false, maybeUnroll, supportsBulkZeroing, supportsOptimizedFilling, snippetCounters);
299+
emitMemoryBarrierIf(emitMemoryBarrier);
300+
return memory.toObjectNonNull();
301+
}
302+
303+
private void fillContents(Word memory, FillContent fillContents, int startOffset, UnsignedWord endOffset, boolean isEndOffsetConstant, boolean maybeUnroll, boolean supportsBulkZeroing,
304+
boolean supportsOptimizedFilling, AllocationSnippetCounters snippetCounters) {
298305
if (fillContents == FillContent.WITH_ZEROES) {
299-
zeroMemory(memory, fillStartOffset, allocationSize, false, maybeUnroll, supportsBulkZeroing, supportsOptimizedFilling, snippetCounters);
306+
zeroMemory(memory, startOffset, endOffset, isEndOffsetConstant, maybeUnroll, supportsBulkZeroing, supportsOptimizedFilling, snippetCounters);
300307
} else if (REPLACEMENTS_ASSERTIONS_ENABLED && fillContents == FillContent.WITH_GARBAGE_IF_ASSERTIONS_ENABLED) {
301-
fillWithGarbage(memory, fillStartOffset, allocationSize, false, maybeUnroll, supportsOptimizedFilling, snippetCounters);
308+
fillWithGarbage(memory, startOffset, endOffset, isEndOffsetConstant, maybeUnroll, supportsOptimizedFilling, snippetCounters);
302309
}
303-
emitMemoryBarrierIf(emitMemoryBarrier);
304-
return memory.toObjectNonNull();
305310
}
306311

307312
protected void emitMemoryBarrierIf(boolean emitMemoryBarrier) {
@@ -351,7 +356,7 @@ public void emitPrefetchAllocate(Word address, boolean isArray) {
351356

352357
protected abstract Object callNewInstanceStub(Word hub);
353358

354-
protected abstract Object callNewArrayStub(Word hub, int length, int fillStartOffset);
359+
protected abstract Object callNewArrayStub(Word hub, int length);
355360

356361
protected abstract Object callNewMultiArrayStub(Word hub, int rank, Word dims);
357362

compiler/src/org.graalvm.compiler.truffle.runtime.serviceprovider/src/org/graalvm/compiler/truffle/runtime/serviceprovider/TruffleRuntimeServices.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,17 @@ public final class TruffleRuntimeServices {
3737
* @param service the service whose provider is being requested
3838
*/
3939
public static <S> Iterable<S> load(Class<S> service) {
40-
return ServiceLoader.load(service);
40+
Class<?> lookupClass = TruffleRuntimeServices.class;
41+
ModuleLayer moduleLayer = lookupClass.getModule().getLayer();
42+
Iterable<S> services;
43+
if (moduleLayer != null) {
44+
services = ServiceLoader.load(moduleLayer, service);
45+
} else {
46+
services = ServiceLoader.load(service, lookupClass.getClassLoader());
47+
}
48+
if (!services.iterator().hasNext()) {
49+
services = ServiceLoader.load(service);
50+
}
51+
return services;
4152
}
4253
}

sdk/llvm-patches/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ LLVM Upstream Patches
44
This directory contains patches which were used to build this
55
LLVM distribution but are not yet upstream or have been backported
66
to LLVM 14. To build this LLVM distribution yourself, apply the patches
7-
on top of an LLVM [14.0.3](https://github.com/llvm/llvm-project/tree/llvmorg-14.0.3) source tree.
7+
on top of an LLVM [14.0.6](https://github.com/llvm/llvm-project/tree/llvmorg-14.0.6) source tree.

sdk/llvm-patches/native-image/0001-GR-17692-Statepoints-Support-for-compressed-pointers.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 0122431d63266f033e4fd8abf78e950c124f027f Mon Sep 17 00:00:00 2001
1+
From b9902a9d9f57ea78d4b11bdfd7295738ef3547fb Mon Sep 17 00:00:00 2001
22
From: Loic Ottet <loic.ottet@oracle.com>
33
Date: Mon, 23 Sep 2019 16:55:33 +0200
4-
Subject: [PATCH 1/2] [GR-17692] [Statepoints] Support for compressed pointers
4+
Subject: [PATCH 1/3] [GR-17692] [Statepoints] Support for compressed pointers
55
in the statepoint emission pass
66

77
---
@@ -424,5 +424,5 @@ index b795ad3899bc..5a5d1d67e5f4 100644
424424
Out.insert(LiveOut.begin(), LiveOut.end());
425425
}
426426
--
427-
2.33.1
427+
2.36.0
428428

sdk/llvm-patches/native-image/0002-GR-23578-AArch64-Introduce-option-to-force-placement.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 772a7a659e7f2f231920cff828cff00fab198af0 Mon Sep 17 00:00:00 2001
1+
From ca6facf3f34d646783d082776378da40d06e9035 Mon Sep 17 00:00:00 2001
22
From: Loic Ottet <loic.ottet@oracle.com>
33
Date: Tue, 8 Sep 2020 13:03:06 +0200
4-
Subject: [PATCH 2/2] [GR-23578][AArch64] Introduce option to force placement
4+
Subject: [PATCH 2/3] [GR-23578][AArch64] Introduce option to force placement
55
of the frame record on top of the stack frame
66

77
---
@@ -34,5 +34,5 @@ index d1b901e58d27..96038fbb8f28 100644
3434
}
3535

3636
--
37-
2.33.1
37+
2.36.0
3838

0 commit comments

Comments
 (0)