Skip to content

Commit e57aeed

Browse files
committed
Filter semantic modifying features in compatibility mode
1 parent 9a1294a commit e57aeed

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/darwin/DarwinSystemPropertiesSupport.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
package com.oracle.svm.core.posix.darwin;
2626

2727
import com.oracle.svm.core.jdk.SystemPropertiesSupport;
28+
import com.oracle.svm.hosted.NativeImageOptions;
2829
import org.graalvm.nativeimage.ImageSingletons;
2930
import org.graalvm.nativeimage.Platform;
3031
import org.graalvm.nativeimage.c.function.CLibrary;
@@ -48,13 +49,16 @@
4849
import com.oracle.svm.core.traits.BuiltinTraits.NoLayeredCallbacks;
4950
import com.oracle.svm.core.traits.SingletonLayeredInstallationKind.Disallowed;
5051
import com.oracle.svm.core.traits.SingletonTraits;
51-
52-
import jdk.graal.compiler.word.Word;
52+
import org.graalvm.word.impl.Word;
5353

5454
@SingletonTraits(access = AllAccess.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
5555
@CLibrary(value = "darwin", requireStatic = true)
5656
public class DarwinSystemPropertiesSupport extends PosixSystemPropertiesSupport {
5757

58+
public DarwinSystemPropertiesSupport(boolean compatibilityMode) {
59+
super(compatibilityMode);
60+
}
61+
5862
@Override
5963
protected String javaIoTmpdirValue() {
6064
/* Darwin has a per-user temp dir */
@@ -144,7 +148,7 @@ protected String jvmLibSuffix() {
144148
class DarwinSystemPropertiesFeature implements InternalFeature {
145149
@Override
146150
public void duringSetup(DuringSetupAccess access) {
147-
ImageSingletons.add(RuntimeSystemPropertiesSupport.class, new DarwinSystemPropertiesSupport());
151+
ImageSingletons.add(RuntimeSystemPropertiesSupport.class, new DarwinSystemPropertiesSupport(NativeImageOptions.compatibilityMode()));
148152
ImageSingletons.add(SystemPropertiesSupport.class, (SystemPropertiesSupport) ImageSingletons.lookup(RuntimeSystemPropertiesSupport.class));
149153
}
150154
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import com.oracle.svm.core.option.APIOption;
5252
import com.oracle.svm.core.option.AccumulatingLocatableMultiOptionValue;
5353
import com.oracle.svm.core.option.HostedOptionKey;
54+
import com.oracle.svm.core.option.LocatableMultiOptionValue;
5455
import com.oracle.svm.core.option.SubstrateOptionsParser;
5556
import com.oracle.svm.core.util.InterruptImageBuilding;
5657
import com.oracle.svm.core.util.UserError;
@@ -78,7 +79,10 @@ public static class Options {
7879
public static final HostedOptionKey<AccumulatingLocatableMultiOptionValue.Strings> Features = new HostedOptionKey<>(AccumulatingLocatableMultiOptionValue.Strings.buildWithCommaDelimiter());
7980

8081
private static List<String> userEnabledFeatures() {
81-
return Options.Features.getValue().values();
82+
return Options.Features.getValue().getValuesWithOrigins()
83+
.filter(v -> !(v.origin().commandLineLike() && NativeImageOptions.compatibilityMode()))
84+
.map(LocatableMultiOptionValue.ValueWithOrigin::value)
85+
.collect(Collectors.toList());
8286
}
8387

8488
@Option(help = "Allow using deprecated @AutomaticFeature annotation. If set to false, an error is shown instead of a warning.", //

0 commit comments

Comments
 (0)