|
30 | 30 | import org.graalvm.nativeimage.ImageInfo;
|
31 | 31 | import org.graalvm.word.UnsignedWord;
|
32 | 32 |
|
33 |
| -import com.oracle.svm.core.SubstrateOptions; |
34 | 33 | import com.oracle.svm.core.SubstrateUtil;
|
35 | 34 | import com.oracle.svm.core.config.ConfigurationValues;
|
36 | 35 | import com.oracle.svm.core.genscavenge.ChunkedImageHeapAllocator.AlignedChunk;
|
@@ -96,7 +95,7 @@ public ChunkedImageHeapLayouter(ImageHeapInfo heapInfo, long startOffset) {
|
96 | 95 | this.partitions[WRITABLE_PATCHED] = new ChunkedImageHeapPartition("writablePatched", true, false, alignment, alignment);
|
97 | 96 | this.partitions[WRITABLE_REGULAR] = new ChunkedImageHeapPartition("writable", true, false, alignment, alignment);
|
98 | 97 | this.partitions[WRITABLE_HUGE] = new ChunkedImageHeapPartition("writableHuge", true, true, alignment, alignment);
|
99 |
| - this.partitions[READ_ONLY_HUGE] = new ChunkedImageHeapPartition("readOnlyHuge", false, true, alignment, SubstrateOptions.getPageSize()); |
| 98 | + this.partitions[READ_ONLY_HUGE] = new ChunkedImageHeapPartition("readOnlyHuge", false, true, alignment, alignment); |
100 | 99 |
|
101 | 100 | this.heapInfo = heapInfo;
|
102 | 101 | this.startOffset = startOffset;
|
@@ -219,7 +218,9 @@ private ImageHeapLayoutInfo populateInfoObjects(int dynamicHubCount, int pageSiz
|
219 | 218 |
|
220 | 219 | long writableEnd = getWritableHuge().getStartOffset() + getWritableHuge().getSize();
|
221 | 220 | long writableSize = writableEnd - offsetOfFirstWritableAlignedChunk;
|
222 |
| - long imageHeapSize = getReadOnlyHuge().getStartOffset() + getReadOnlyHuge().getSize() - startOffset; |
| 221 | + /* Aligning the end to the page size can be required for mapping into memory. */ |
| 222 | + long imageHeapEnd = NumUtil.roundUp(getReadOnlyHuge().getStartOffset() + getReadOnlyHuge().getSize(), pageSize); |
| 223 | + long imageHeapSize = imageHeapEnd - startOffset; |
223 | 224 | return new ImageHeapLayoutInfo(startOffset, imageHeapSize, offsetOfFirstWritableAlignedChunk, writableSize, getReadOnlyRelocatable().getStartOffset(), getReadOnlyRelocatable().getSize(),
|
224 | 225 | getWritablePatched().getStartOffset(), getWritablePatched().getSize());
|
225 | 226 | }
|
|
0 commit comments