Skip to content

Commit 44f1745

Browse files
[GR-64817] Small fixes.
PullRequest: graal/20775
2 parents 275b0d9 + 77f2119 commit 44f1745

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ protected SizeParameters computeSizeParameters(SizeParameters existing) {
337337
minYoungSpaces = minYoungSpaces.add(minSpaceSize().multiply(2)); // survivor from and to
338338
}
339339
UnsignedWord minAllSpaces = minYoungSpaces.add(minSpaceSize()); // old
340+
UnsignedWord heapSizeLimit = UnsignedUtils.max(alignDown(getHeapSizeLimit()), minAllSpaces);
340341

341342
UnsignedWord maxHeap;
342343
long optionMax = SubstrateGCOptions.MaxHeapSize.getValue();
@@ -346,7 +347,7 @@ protected SizeParameters computeSizeParameters(SizeParameters existing) {
346347
maxHeap = PhysicalMemory.size().unsignedDivide(100).multiply(HeapParameters.getMaximumHeapSizePercent());
347348
}
348349
UnsignedWord unadjustedMaxHeap = maxHeap;
349-
maxHeap = UnsignedUtils.clamp(alignDown(maxHeap), minAllSpaces, alignDown(getHeapSizeLimit()));
350+
maxHeap = UnsignedUtils.clamp(alignDown(maxHeap), minAllSpaces, heapSizeLimit);
350351

351352
UnsignedWord maxYoung;
352353
long optionMaxYoung = SubstrateGCOptions.MaxNewSize.getValue();
@@ -361,7 +362,7 @@ protected SizeParameters computeSizeParameters(SizeParameters existing) {
361362

362363
UnsignedWord maxOld = alignDown(maxHeap.subtract(maxYoung));
363364
maxHeap = maxYoung.add(maxOld);
364-
VMError.guarantee(maxOld.aboveOrEqual(minSpaceSize()) && maxHeap.belowOrEqual(getHeapSizeLimit()) &&
365+
VMError.guarantee(maxOld.aboveOrEqual(minSpaceSize()) && maxHeap.belowOrEqual(heapSizeLimit) &&
365366
(maxHeap.belowOrEqual(unadjustedMaxHeap) || unadjustedMaxHeap.belowThan(minAllSpaces)));
366367

367368
UnsignedWord minHeap = Word.zero();

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/c/function/CEntryPointErrors.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import java.util.Arrays;
3737
import java.util.Objects;
3838

39-
import jdk.graal.compiler.word.Word;
4039
import org.graalvm.nativeimage.AnnotationAccess;
4140
import org.graalvm.nativeimage.Platform;
4241
import org.graalvm.nativeimage.Platforms;
@@ -49,6 +48,8 @@
4948
import com.oracle.svm.core.util.HostedByteBufferPointer;
5049
import com.oracle.svm.core.util.VMError;
5150

51+
import jdk.graal.compiler.word.Word;
52+
5253
/**
5354
* Errors returned by {@link CEntryPointActions} and {@link CEntryPointNativeFunctions} and their
5455
* implementation, including snippets and foreign function calls. These are non-public API as
@@ -112,7 +113,7 @@ private CEntryPointErrors() {
112113
@Description("Some exception is not caught.") //
113114
public static final int UNCAUGHT_EXCEPTION = 12;
114115

115-
@Description("Initialization the isolate failed.") //
116+
@Description("Initializing the isolate failed.") //
116117
public static final int ISOLATE_INITIALIZATION_FAILED = 13;
117118

118119
@Description("Opening the located auxiliary image file failed.") //

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/UninterruptibleUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,13 @@ public static long max(long a, long b) {
429429

430430
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
431431
public static int clamp(int value, int min, int max) {
432+
assert min <= max;
432433
return min(max(value, min), max);
433434
}
434435

435436
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
436437
public static long clamp(long value, long min, long max) {
438+
assert min <= max;
437439
return min(max(value, min), max);
438440
}
439441

0 commit comments

Comments
 (0)