Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into cwi/GR-38909-substi…
Browse files Browse the repository at this point in the history
…tutions-move
  • Loading branch information
olpaw committed Aug 31, 2022
2 parents c99e27b + d5c17e7 commit 4221665
Show file tree
Hide file tree
Showing 76 changed files with 2,148 additions and 718 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static boolean useNullAllocationStubs(@InjectedParameter GraalHotSpotVMConfig co
}

@Override
protected final Object callNewArrayStub(Word hub, int length, int fillStartOffset) {
protected final Object callNewArrayStub(Word hub, int length) {
KlassPointer klassPtr = KlassPointer.fromWord(hub);
if (useNullAllocationStubs(INJECTED_VMCONFIG)) {
return nonNullOrDeopt(newArrayOrNull(NEW_ARRAY_OR_NULL, klassPtr, length));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ public Object allocateArrayImpl(Word hub,
if (useTLAB() && probability(FAST_PATH_PROBABILITY, shouldAllocateInTLAB(allocationSize, true)) && probability(FAST_PATH_PROBABILITY, newTop.belowOrEqual(end))) {
writeTlabTop(thread, newTop);
emitPrefetchAllocate(newTop, true);
result = formatArray(hub, allocationSize, length, top, fillContents, fillStartOffset, emitMemoryBarrier, maybeUnroll, supportsBulkZeroing, supportsOptimizedFilling,
result = formatArray(hub, allocationSize, length, top, fillContents, emitMemoryBarrier, fillStartOffset, maybeUnroll, supportsBulkZeroing, supportsOptimizedFilling,
profilingData.snippetCounters);
} else {
profilingData.snippetCounters.stub.inc();
result = callNewArrayStub(hub, length, fillStartOffset);
result = callNewArrayStub(hub, length);
}
profileAllocation(profilingData, allocationSize);
return verifyOop(result);
Expand All @@ -124,8 +124,7 @@ protected UnsignedWord arrayAllocationSize(int length, int arrayBaseOffset, int
public static long arrayAllocationSize(int length, int arrayBaseOffset, int log2ElementSize, int alignment) {
long size = ((length & 0xFFFFFFFFL) << log2ElementSize) + arrayBaseOffset + (alignment - 1);
long mask = ~(alignment - 1);
long result = size & mask;
return result;
return size & mask;
}

/**
Expand Down Expand Up @@ -268,11 +267,7 @@ public Object formatObject(Word hub,
AllocationSnippetCounters snippetCounters) {
initializeObjectHeader(memory, hub, false);
int headerSize = instanceHeaderSize();
if (fillContents == FillContent.WITH_ZEROES) {
zeroMemory(memory, headerSize, size, constantSize, false, false, false, snippetCounters);
} else if (REPLACEMENTS_ASSERTIONS_ENABLED && fillContents == FillContent.WITH_GARBAGE_IF_ASSERTIONS_ENABLED) {
fillWithGarbage(memory, headerSize, size, constantSize, false, false, snippetCounters);
}
fillContents(memory, fillContents, headerSize, size, constantSize, false, false, false, snippetCounters);
emitMemoryBarrierIf(emitMemoryBarrier);
return memory.toObjectNonNull();
}
Expand All @@ -285,23 +280,33 @@ public Object formatArray(Word hub,
int length,
Word memory,
FillContent fillContents,
int fillStartOffset,
boolean emitMemoryBarrier,
int fillStartOffset,
boolean maybeUnroll,
boolean supportsBulkZeroing,
boolean supportsOptimizedFilling,
AllocationSnippetCounters snippetCounters) {
memory.writeInt(arrayLengthOffset(), length, LocationIdentity.init());
// Store hub last as the concurrent garbage collectors assume length is valid if hub field
// is not null.
/*
* For TLAB allocations, the initialization order does not matter. Therefore, it is also not
* necessary to use STORE_RELEASE semantics when storing the hub into the newly allocated
* object. This is a major difference to the slow-path allocation where the initialization
* order and the STORE_RELEASE semantics are crucial for concurrent GCs (the slow-path
* allocation can directly allocate in the old generation).
*/
initializeObjectHeader(memory, hub, true);
memory.writeInt(arrayLengthOffset(), length, LocationIdentity.init());
fillContents(memory, fillContents, fillStartOffset, allocationSize, false, maybeUnroll, supportsBulkZeroing, supportsOptimizedFilling, snippetCounters);
emitMemoryBarrierIf(emitMemoryBarrier);
return memory.toObjectNonNull();
}

private void fillContents(Word memory, FillContent fillContents, int startOffset, UnsignedWord endOffset, boolean isEndOffsetConstant, boolean maybeUnroll, boolean supportsBulkZeroing,
boolean supportsOptimizedFilling, AllocationSnippetCounters snippetCounters) {
if (fillContents == FillContent.WITH_ZEROES) {
zeroMemory(memory, fillStartOffset, allocationSize, false, maybeUnroll, supportsBulkZeroing, supportsOptimizedFilling, snippetCounters);
zeroMemory(memory, startOffset, endOffset, isEndOffsetConstant, maybeUnroll, supportsBulkZeroing, supportsOptimizedFilling, snippetCounters);
} else if (REPLACEMENTS_ASSERTIONS_ENABLED && fillContents == FillContent.WITH_GARBAGE_IF_ASSERTIONS_ENABLED) {
fillWithGarbage(memory, fillStartOffset, allocationSize, false, maybeUnroll, supportsOptimizedFilling, snippetCounters);
fillWithGarbage(memory, startOffset, endOffset, isEndOffsetConstant, maybeUnroll, supportsOptimizedFilling, snippetCounters);
}
emitMemoryBarrierIf(emitMemoryBarrier);
return memory.toObjectNonNull();
}

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

protected abstract Object callNewInstanceStub(Word hub);

protected abstract Object callNewArrayStub(Word hub, int length, int fillStartOffset);
protected abstract Object callNewArrayStub(Word hub, int length);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, 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
Expand Down Expand Up @@ -37,6 +37,17 @@ public final class TruffleRuntimeServices {
* @param service the service whose provider is being requested
*/
public static <S> Iterable<S> load(Class<S> service) {
return ServiceLoader.load(service);
Class<?> lookupClass = TruffleRuntimeServices.class;
ModuleLayer moduleLayer = lookupClass.getModule().getLayer();
Iterable<S> services;
if (moduleLayer != null) {
services = ServiceLoader.load(moduleLayer, service);
} else {
services = ServiceLoader.load(service, lookupClass.getClassLoader());
}
if (!services.iterator().hasNext()) {
services = ServiceLoader.load(service);
}
return services;
}
}
2 changes: 1 addition & 1 deletion sdk/llvm-patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ LLVM Upstream Patches
This directory contains patches which were used to build this
LLVM distribution but are not yet upstream or have been backported
to LLVM 14. To build this LLVM distribution yourself, apply the patches
on top of an LLVM [14.0.3](https://github.com/llvm/llvm-project/tree/llvmorg-14.0.3) source tree.
on top of an LLVM [14.0.6](https://github.com/llvm/llvm-project/tree/llvmorg-14.0.6) source tree.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 0122431d63266f033e4fd8abf78e950c124f027f Mon Sep 17 00:00:00 2001
From b9902a9d9f57ea78d4b11bdfd7295738ef3547fb Mon Sep 17 00:00:00 2001
From: Loic Ottet <[email protected]>
Date: Mon, 23 Sep 2019 16:55:33 +0200
Subject: [PATCH 1/2] [GR-17692] [Statepoints] Support for compressed pointers
Subject: [PATCH 1/3] [GR-17692] [Statepoints] Support for compressed pointers
in the statepoint emission pass

---
Expand Down Expand Up @@ -424,5 +424,5 @@ index b795ad3899bc..5a5d1d67e5f4 100644
Out.insert(LiveOut.begin(), LiveOut.end());
}
--
2.33.1
2.36.0

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 772a7a659e7f2f231920cff828cff00fab198af0 Mon Sep 17 00:00:00 2001
From ca6facf3f34d646783d082776378da40d06e9035 Mon Sep 17 00:00:00 2001
From: Loic Ottet <[email protected]>
Date: Tue, 8 Sep 2020 13:03:06 +0200
Subject: [PATCH 2/2] [GR-23578][AArch64] Introduce option to force placement
Subject: [PATCH 2/3] [GR-23578][AArch64] Introduce option to force placement
of the frame record on top of the stack frame

---
Expand Down Expand Up @@ -34,5 +34,5 @@ index d1b901e58d27..96038fbb8f28 100644
}

--
2.33.1
2.36.0

Loading

0 comments on commit 4221665

Please sign in to comment.