Skip to content

Commit 54384f7

Browse files
committed
[GR-53670] Layered HelloWorld
PullRequest: graal/17650
2 parents 8b377f3 + 09ae8a8 commit 54384f7

File tree

12 files changed

+218
-35
lines changed

12 files changed

+218
-35
lines changed

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageLayerLoader.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.FIELD_READ_TAG;
4141
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.FIELD_WRITTEN_TAG;
4242
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.ID_TAG;
43+
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.IMAGE_HEAP_SIZE_TAG;
4344
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.INSTANCE_TAG;
4445
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.INTERFACES_TAG;
4546
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.IS_ENUM_TAG;
@@ -252,6 +253,8 @@ public class ImageLayerLoader {
252253

253254
protected EconomicMap<String, Object> jsonMap;
254255

256+
private long imageHeapSize;
257+
255258
public ImageLayerLoader() {
256259
this(new ImageLayerSnapshotUtil(), List.of());
257260
}
@@ -308,6 +311,8 @@ private void loadLayerAnalysis0() {
308311
int nextFieldId = get(jsonMap, NEXT_FIELD_ID_TAG);
309312
universe.setStartFieldId(nextFieldId);
310313

314+
imageHeapSize = Long.parseLong(get(jsonMap, IMAGE_HEAP_SIZE_TAG));
315+
311316
/* This mapping allows one to get the base layer information from a type id */
312317
EconomicMap<String, Object> typesMap = get(jsonMap, TYPES_TAG);
313318
MapCursor<String, Object> typesCursor = typesMap.getEntries();
@@ -985,4 +990,8 @@ private ImageHeapConstant getTaggedImageHeapConstant(String tag) {
985990
int id = get(jsonMap, tag);
986991
return constants.get(id);
987992
}
993+
994+
public long getImageHeapSize() {
995+
return imageHeapSize;
996+
}
988997
}

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageLayerSnapshotUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public class ImageLayerSnapshotUtil {
7474
public static final String NEXT_TYPE_ID_TAG = "next type id";
7575
public static final String NEXT_METHOD_ID_TAG = "next method id";
7676
public static final String NEXT_FIELD_ID_TAG = "next field id";
77+
public static final String IMAGE_HEAP_SIZE_TAG = "image heap size";
7778
public static final String VALUE_TAG = "value";
7879
public static final String ENUM_CLASS_TAG = "enum class";
7980
public static final String ENUM_NAME_TAG = "enum name";

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageLayerWriter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.FIELD_WRITTEN_TAG;
4242
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.IDENTITY_HASH_CODE_TAG;
4343
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.ID_TAG;
44+
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.IMAGE_HEAP_SIZE_TAG;
4445
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.INSTANCE_TAG;
4546
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.INTERFACES_TAG;
4647
import static com.oracle.graal.pointsto.heap.ImageLayerSnapshotUtil.IS_ENUM_TAG;
@@ -145,6 +146,10 @@ public void dumpFile() {
145146
FileDumpingUtil.dumpFile(fileInfo.layerSnapshotPath, fileInfo.fileName, fileInfo.suffix, writer -> JSONFormatter.printJSON(jsonMap, writer));
146147
}
147148

149+
public void persistImageHeapSize(long imageHeapSize) {
150+
jsonMap.put(IMAGE_HEAP_SIZE_TAG, String.valueOf(imageHeapSize));
151+
}
152+
148153
public void persistAnalysisInfo(Universe hostedUniverse, AnalysisUniverse analysisUniverse) {
149154
persistHook(hostedUniverse, analysisUniverse);
150155

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisMethod.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,9 +775,6 @@ public Type[] getGenericParameterTypes() {
775775

776776
@Override
777777
public boolean canBeInlined() {
778-
if (isInBaseLayer) {
779-
return false;
780-
}
781778
return !hasNeverInlineDirective();
782779
}
783780

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/HeapImpl.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,15 +433,28 @@ public int getPreferredAddressSpaceAlignment() {
433433
@Fold
434434
@Override
435435
public int getImageHeapOffsetInAddressSpace() {
436+
int imageHeapOffset = 0;
436437
if (SubstrateOptions.SpawnIsolates.getValue() && SubstrateOptions.UseNullRegion.getValue()) {
437438
/*
438439
* The image heap will be mapped in a way that there is a memory protected gap between
439440
* the heap base and the start of the image heap. The gap won't need any memory in the
440441
* native image file.
441442
*/
442-
return NumUtil.safeToInt(SerialAndEpsilonGCOptions.AlignedHeapChunkSize.getValue());
443+
imageHeapOffset = NumUtil.safeToInt(SerialAndEpsilonGCOptions.AlignedHeapChunkSize.getValue());
443444
}
444-
return 0;
445+
/*
446+
* GR-53993: With ImageLayerSupport, it would be possible to fetch the startOffset from the
447+
* loader instead of storing it in the Heap.
448+
*/
449+
if (SubstrateOptions.LoadImageLayer.hasBeenSet()) {
450+
/*
451+
* GR-53964: The page size used to round up the start offset should be the same as the
452+
* one used in run time.
453+
*/
454+
int runtimePageSize = 4096;
455+
imageHeapOffset = NumUtil.roundUp(imageHeapOffset + NumUtil.safeToInt(startOffset), runtimePageSize);
456+
}
457+
return imageHeapOffset;
445458
}
446459

447460
@Fold

substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/linux/LinuxImageHeapProvider.java

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,20 @@
3131
import static com.oracle.svm.core.Isolates.IMAGE_HEAP_RELOCATABLE_END;
3232
import static com.oracle.svm.core.Isolates.IMAGE_HEAP_WRITABLE_BEGIN;
3333
import static com.oracle.svm.core.Isolates.IMAGE_HEAP_WRITABLE_END;
34+
import static com.oracle.svm.core.layeredimage.LayeredImageHeapSymbols.SECOND_IMAGE_HEAP_A_RELOCATABLE_POINTER;
35+
import static com.oracle.svm.core.layeredimage.LayeredImageHeapSymbols.SECOND_IMAGE_HEAP_BEGIN;
36+
import static com.oracle.svm.core.layeredimage.LayeredImageHeapSymbols.SECOND_IMAGE_HEAP_END;
37+
import static com.oracle.svm.core.layeredimage.LayeredImageHeapSymbols.SECOND_IMAGE_HEAP_RELOCATABLE_BEGIN;
38+
import static com.oracle.svm.core.layeredimage.LayeredImageHeapSymbols.SECOND_IMAGE_HEAP_RELOCATABLE_END;
39+
import static com.oracle.svm.core.layeredimage.LayeredImageHeapSymbols.SECOND_IMAGE_HEAP_WRITABLE_BEGIN;
40+
import static com.oracle.svm.core.layeredimage.LayeredImageHeapSymbols.SECOND_IMAGE_HEAP_WRITABLE_END;
3441
import static com.oracle.svm.core.posix.linux.ProcFSSupport.findMapping;
3542
import static com.oracle.svm.core.util.PointerUtils.roundDown;
43+
import static com.oracle.svm.core.util.UnsignedUtils.isAMultiple;
3644
import static com.oracle.svm.core.util.UnsignedUtils.roundUp;
3745
import static org.graalvm.word.WordFactory.signed;
3846

47+
import java.nio.ByteBuffer;
3948
import java.util.concurrent.ThreadLocalRandom;
4049

4150
import org.graalvm.nativeimage.StackValue;
@@ -47,8 +56,10 @@
4756
import org.graalvm.word.PointerBase;
4857
import org.graalvm.word.SignedWord;
4958
import org.graalvm.word.UnsignedWord;
59+
import org.graalvm.word.WordBase;
5060
import org.graalvm.word.WordFactory;
5161

62+
import com.oracle.svm.core.SubstrateOptions;
5263
import com.oracle.svm.core.Uninterruptible;
5364
import com.oracle.svm.core.c.CGlobalData;
5465
import com.oracle.svm.core.c.CGlobalDataFactory;
@@ -68,6 +79,7 @@
6879
import com.oracle.svm.core.util.VMError;
6980

7081
import jdk.graal.compiler.word.Word;
82+
import jdk.vm.ci.code.Architecture;
7183

7284
/**
7385
* An optimal image heap provider for Linux which creates isolate image heaps that retain the
@@ -91,11 +103,41 @@ public class LinuxImageHeapProvider extends AbstractImageHeapProvider {
91103

92104
private static final SignedWord UNASSIGNED_FD = signed(-1);
93105
private static final SignedWord CANNOT_OPEN_FD = signed(-2);
94-
private static final CGlobalData<WordPointer> CACHED_IMAGE_FD = CGlobalDataFactory.createWord(UNASSIGNED_FD);
95-
private static final CGlobalData<WordPointer> CACHED_IMAGE_HEAP_OFFSET_IN_FILE = CGlobalDataFactory.createWord();
106+
107+
private static final int IMAGE_COUNT = 2;
108+
private static final CGlobalData<WordPointer> CACHED_IMAGE_FDS = CGlobalDataFactory.createBytes(() -> createWords(IMAGE_COUNT, UNASSIGNED_FD));
109+
private static final CGlobalData<WordPointer> CACHED_IMAGE_HEAP_OFFSETS = CGlobalDataFactory.createBytes(() -> createWords(IMAGE_COUNT, WordFactory.zero()));
96110

97111
private static final int MAX_PATHLEN = 4096;
98112

113+
private static byte[] createWords(int count, WordBase initialValue) {
114+
Architecture arch = ConfigurationValues.getTarget().arch;
115+
assert arch.getWordSize() == Long.BYTES : "currently hard-coded for 8 byte words";
116+
ByteBuffer buffer = ByteBuffer.allocate(count * Long.BYTES).order(arch.getByteOrder());
117+
for (int i = 0; i < count; i++) {
118+
buffer.putLong(initialValue.rawValue());
119+
}
120+
return buffer.array();
121+
}
122+
123+
@Override
124+
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
125+
protected UnsignedWord getImageHeapAddressSpaceSize() {
126+
if (SubstrateOptions.ImageLayer.hasBeenSet() || SubstrateOptions.LoadImageLayer.hasBeenSet()) {
127+
int imageHeapOffset = Heap.getHeap().getImageHeapOffsetInAddressSpace();
128+
assert imageHeapOffset >= 0;
129+
UnsignedWord size = WordFactory.unsigned(imageHeapOffset);
130+
UnsignedWord granularity = VirtualMemoryProvider.get().getGranularity();
131+
assert isAMultiple(size, granularity);
132+
size = size.add(getImageHeapSizeInFile(IMAGE_HEAP_BEGIN.get(), IMAGE_HEAP_END.get()));
133+
size = roundUp(size, granularity);
134+
size = size.add(getImageHeapSizeInFile(SECOND_IMAGE_HEAP_BEGIN.get(), SECOND_IMAGE_HEAP_END.get()));
135+
return size;
136+
} else {
137+
return super.getImageHeapAddressSpaceSize();
138+
}
139+
}
140+
99141
@Override
100142
@Uninterruptible(reason = "Called during isolate initialization.")
101143
public int initialize(Pointer reservedAddressSpace, UnsignedWord reservedSize, WordPointer basePointer, WordPointer endPointer) {
@@ -143,15 +185,30 @@ public int initialize(Pointer reservedAddressSpace, UnsignedWord reservedSize, W
143185

144186
int imageHeapOffsetInAddressSpace = Heap.getHeap().getImageHeapOffsetInAddressSpace();
145187
basePointer.write(heapBase);
146-
Pointer imageHeapStart = heapBase.add(imageHeapOffsetInAddressSpace);
188+
Pointer firstHeapStart = heapBase.add(imageHeapOffsetInAddressSpace);
147189
remainingSize = remainingSize.subtract(imageHeapOffsetInAddressSpace);
148-
int result = initializeImageHeap(imageHeapStart, remainingSize, endPointer,
149-
CACHED_IMAGE_FD.get(), CACHED_IMAGE_HEAP_OFFSET_IN_FILE.get(), MAGIC.get(),
190+
boolean layeredImage = SubstrateOptions.ImageLayer.hasBeenSet() || SubstrateOptions.LoadImageLayer.hasBeenSet();
191+
WordPointer firstEndPtr = layeredImage ? StackValue.get(WordPointer.class) : endPointer;
192+
int result = initializeImageHeap(firstHeapStart, remainingSize, firstEndPtr,
193+
CACHED_IMAGE_FDS.get().addressOf(0), CACHED_IMAGE_HEAP_OFFSETS.get().addressOf(0), MAGIC.get(),
150194
IMAGE_HEAP_BEGIN.get(), IMAGE_HEAP_END.get(),
151195
IMAGE_HEAP_RELOCATABLE_BEGIN.get(), IMAGE_HEAP_A_RELOCATABLE_POINTER.get(), IMAGE_HEAP_RELOCATABLE_END.get(),
152196
IMAGE_HEAP_WRITABLE_BEGIN.get(), IMAGE_HEAP_WRITABLE_END.get());
153197
if (result != CEntryPointErrors.NO_ERROR) {
154198
freeImageHeap(selfReservedHeapBase);
199+
return result;
200+
}
201+
if (SubstrateOptions.ImageLayer.hasBeenSet() || SubstrateOptions.LoadImageLayer.hasBeenSet()) {
202+
Pointer secondHeapStart = firstEndPtr.read(); // aligned
203+
remainingSize = remainingSize.subtract(secondHeapStart.subtract(firstHeapStart));
204+
result = initializeImageHeap(secondHeapStart, remainingSize, endPointer,
205+
CACHED_IMAGE_FDS.get().addressOf(1), CACHED_IMAGE_HEAP_OFFSETS.get().addressOf(1), MAGIC.get(),
206+
SECOND_IMAGE_HEAP_BEGIN.get(), SECOND_IMAGE_HEAP_END.get(),
207+
SECOND_IMAGE_HEAP_RELOCATABLE_BEGIN.get(), SECOND_IMAGE_HEAP_A_RELOCATABLE_POINTER.get(), SECOND_IMAGE_HEAP_RELOCATABLE_END.get(),
208+
SECOND_IMAGE_HEAP_WRITABLE_BEGIN.get(), SECOND_IMAGE_HEAP_WRITABLE_END.get());
209+
if (result != CEntryPointErrors.NO_ERROR) {
210+
freeImageHeap(selfReservedHeapBase);
211+
}
155212
}
156213
return result;
157214
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Boolean o
112112
ClosedTypeWorld.update(values, !newValue);
113113
PersistImageLayerAnalysis.update(values, newValue);
114114
PersistImageLayerSingletons.update(values, newValue);
115-
DeleteLocalSymbols.update(values, !newValue);
116115
StripDebugInfo.update(values, !newValue);
117-
InternalSymbolsAreGlobal.update(values, newValue);
118116
AOTTrivialInline.update(values, !newValue);
119117
if (imageLayerEnabledHandler != null) {
120118
imageLayerEnabledHandler.onOptionEnabled(values);
@@ -722,8 +720,6 @@ public static boolean useLIRBackend() {
722720
*/
723721
@Option(help = "Use linker option to prevent unreferenced symbols in image.")//
724722
public static final HostedOptionKey<Boolean> RemoveUnusedSymbols = new HostedOptionKey<>(OS.getCurrent() != OS.DARWIN);
725-
@Option(help = "Keep all undefined symbols.")//
726-
public static final HostedOptionKey<Boolean> PreserveUndefinedSymbols = new HostedOptionKey<>(false);
727723
@Option(help = "Ignore undefined symbols referenced from the built image.")//
728724
public static final HostedOptionKey<Boolean> IgnoreUndefinedReferences = new HostedOptionKey<>(false);
729725
@Option(help = "Use linker option to remove all local symbols from image.")//
@@ -1152,7 +1148,6 @@ public static boolean closedTypeWorld() {
11521148
public void update(EconomicMap<OptionKey<?>, Object> values, Object boxedValue) {
11531149
super.update(values, boxedValue);
11541150
ClosedTypeWorld.update(values, false);
1155-
PreserveUndefinedSymbols.update(values, true);
11561151
/* Ignore any potential undefined references caused by inlining in base layer. */
11571152
IgnoreUndefinedReferences.update(values, true);
11581153
AOTTrivialInline.update(values, false);

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/heap/Heap.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
import jdk.graal.compiler.api.replacements.Fold;
4949

5050
public abstract class Heap {
51+
protected long startOffset;
52+
5153
@Fold
5254
public static Heap getHeap() {
5355
return ImageSingletons.lookup(Heap.class);
@@ -250,4 +252,11 @@ public Pointer getImageHeapStart() {
250252
*/
251253
@Uninterruptible(reason = "Ensure that no GC can occur between this call and usage of the salt.", callerMustBe = true)
252254
public abstract long getIdentityHashSalt(Object obj);
255+
256+
/**
257+
* Sets the start offset of the heap.
258+
*/
259+
public void setStartOffset(long startOffset) {
260+
this.startOffset = startOffset;
261+
}
253262
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2024, 2024, 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. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package com.oracle.svm.core.layeredimage;
26+
27+
import com.oracle.svm.core.c.CGlobalData;
28+
import com.oracle.svm.core.c.CGlobalDataFactory;
29+
30+
import jdk.graal.compiler.word.Word;
31+
32+
/**
33+
* Stores the heap symbols for the application layer. This is a temporary solution and should be
34+
* fixed with GR-53995.
35+
*/
36+
public class LayeredImageHeapSymbols {
37+
public static final String SECOND_IMAGE_HEAP_BEGIN_SYMBOL_NAME = "__svm_second_heap_begin";
38+
public static final String SECOND_IMAGE_HEAP_END_SYMBOL_NAME = "__svm_second_heap_end";
39+
public static final String SECOND_IMAGE_HEAP_RELOCATABLE_BEGIN_SYMBOL_NAME = "__svm_second_heap_relocatable_begin";
40+
public static final String SECOND_IMAGE_HEAP_RELOCATABLE_END_SYMBOL_NAME = "__svm_second_heap_relocatable_end";
41+
public static final String SECOND_IMAGE_HEAP_A_RELOCATABLE_POINTER_SYMBOL_NAME = "__svm_second_heap_a_relocatable_pointer";
42+
public static final String SECOND_IMAGE_HEAP_WRITABLE_BEGIN_SYMBOL_NAME = "__svm_second_heap_writable_begin";
43+
public static final String SECOND_IMAGE_HEAP_WRITABLE_END_SYMBOL_NAME = "__svm_second_heap_writable_end";
44+
45+
public static final CGlobalData<Word> SECOND_IMAGE_HEAP_BEGIN = CGlobalDataFactory.forSymbol(SECOND_IMAGE_HEAP_BEGIN_SYMBOL_NAME);
46+
public static final CGlobalData<Word> SECOND_IMAGE_HEAP_END = CGlobalDataFactory.forSymbol(SECOND_IMAGE_HEAP_END_SYMBOL_NAME);
47+
public static final CGlobalData<Word> SECOND_IMAGE_HEAP_RELOCATABLE_BEGIN = CGlobalDataFactory.forSymbol(SECOND_IMAGE_HEAP_RELOCATABLE_BEGIN_SYMBOL_NAME);
48+
public static final CGlobalData<Word> SECOND_IMAGE_HEAP_RELOCATABLE_END = CGlobalDataFactory.forSymbol(SECOND_IMAGE_HEAP_RELOCATABLE_END_SYMBOL_NAME);
49+
public static final CGlobalData<Word> SECOND_IMAGE_HEAP_A_RELOCATABLE_POINTER = CGlobalDataFactory.forSymbol(SECOND_IMAGE_HEAP_A_RELOCATABLE_POINTER_SYMBOL_NAME);
50+
public static final CGlobalData<Word> SECOND_IMAGE_HEAP_WRITABLE_BEGIN = CGlobalDataFactory.forSymbol(SECOND_IMAGE_HEAP_WRITABLE_BEGIN_SYMBOL_NAME);
51+
public static final CGlobalData<Word> SECOND_IMAGE_HEAP_WRITABLE_END = CGlobalDataFactory.forSymbol(SECOND_IMAGE_HEAP_WRITABLE_END_SYMBOL_NAME);
52+
}

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
import com.oracle.svm.core.graal.word.SubstrateWordOperationPlugins;
169169
import com.oracle.svm.core.graal.word.SubstrateWordTypes;
170170
import com.oracle.svm.core.heap.BarrierSetProvider;
171+
import com.oracle.svm.core.heap.Heap;
171172
import com.oracle.svm.core.heap.RestrictHeapAccessCallees;
172173
import com.oracle.svm.core.hub.DynamicHub;
173174
import com.oracle.svm.core.hub.LayoutEncoding;
@@ -1044,6 +1045,10 @@ protected void setupNativeImage(OptionValues options, Map<Method, CEntryPointDat
10441045
featureHandler.forEachFeature(feature -> feature.duringSetup(config));
10451046
}
10461047

1048+
if (SVMImageLayerSupport.singleton().loadAnalysis()) {
1049+
Heap.getHeap().setStartOffset(SVMImageLayerSupport.singleton().getLoader().getImageHeapSize());
1050+
}
1051+
10471052
initializeBigBang(bb, options, featureHandler, nativeLibraries, debug, aMetaAccess, aUniverse.getSubstitutions(), loader, true,
10481053
new SubstrateClassInitializationPlugin((SVMHost) aUniverse.hostVM()), this.isStubBasedPluginsSupported(), aProviders);
10491054

0 commit comments

Comments
 (0)