8340081: Test java/foreign/TestLinker.java failed failed: missing permission java.lang.foreign.native.threshold.power.fill
Reviewed-by: dholmes
This commit is contained in:
parent
b88ff9c986
commit
5709c37940
@ -29,6 +29,7 @@ import jdk.internal.misc.ScopedMemoryAccess;
|
||||
import jdk.internal.util.Architecture;
|
||||
import jdk.internal.util.ArraysSupport;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
import java.lang.foreign.MemorySegment;
|
||||
|
||||
@ -309,8 +310,15 @@ public final class SegmentBulkOperations {
|
||||
|
||||
// The returned value is in the interval [0, 2^30]
|
||||
static int powerOfPropertyOr(String name, int defaultPower) {
|
||||
final int power = Integer.getInteger(PROPERTY_PATH + name, defaultPower);
|
||||
return 1 << Math.clamp(power, 0, Integer.SIZE - 2);
|
||||
final String property = GetPropertyAction.privilegedGetProperty(PROPERTY_PATH + name);
|
||||
if (property != null) {
|
||||
try {
|
||||
return 1 << Math.clamp(Integer.parseInt(property), 0, Integer.SIZE - 2);
|
||||
} catch (NumberFormatException _) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return defaultPower;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user