Skip to content

Commit b516b2d

Browse files
Further review feedback.
1 parent a3696b1 commit b516b2d

File tree

10 files changed

+34
-31
lines changed

10 files changed

+34
-31
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
import static com.oracle.svm.core.Containers.Options.PreferContainerQuotaForCPUCount;
2828
import static com.oracle.svm.core.Containers.Options.UseContainerSupport;
29-
import static com.oracle.svm.core.option.RuntimeOptionKey.RelevantForCompilationIsolates;
29+
import static com.oracle.svm.core.option.RuntimeOptionKey.RuntimeOptionKeyFlag.RelevantForCompilationIsolates;
3030

3131
import org.graalvm.compiler.options.Option;
3232
import org.graalvm.compiler.serviceprovider.JavaVersionUtil;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
*/
2525
package com.oracle.svm.core;
2626

27+
import static com.oracle.svm.core.option.RuntimeOptionKey.RuntimeOptionKeyFlag.RelevantForCompilationIsolates;
28+
2729
import java.util.Arrays;
2830

29-
import com.oracle.svm.core.option.RuntimeOptionKey;
3031
import org.graalvm.collections.EconomicMap;
3132
import org.graalvm.compiler.api.replacements.Fold;
3233
import org.graalvm.compiler.core.common.NumUtil;
@@ -69,6 +70,7 @@
6970
import com.oracle.svm.core.jdk.UninterruptibleUtils.AtomicWord;
7071
import com.oracle.svm.core.locks.VMLockSupport;
7172
import com.oracle.svm.core.log.Log;
73+
import com.oracle.svm.core.option.RuntimeOptionKey;
7274
import com.oracle.svm.core.stack.JavaFrameAnchor;
7375
import com.oracle.svm.core.stack.JavaFrameAnchors;
7476
import com.oracle.svm.core.stack.JavaStackWalker;
@@ -86,8 +88,6 @@
8688
import com.oracle.svm.core.threadlocal.VMThreadLocalInfos;
8789
import com.oracle.svm.core.util.Counter;
8890

89-
import static com.oracle.svm.core.option.RuntimeOptionKey.RelevantForCompilationIsolates;
90-
9191
public class SubstrateDiagnostics {
9292
private static final FastThreadLocalBytes<CCharPointer> threadOnlyAttachedForCrashHandler = FastThreadLocalFactory.createBytes(() -> 1, "SubstrateDiagnostics.threadOnlyAttachedForCrashHandler");
9393
private static volatile boolean loopOnFatalError;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
package com.oracle.svm.core;
2626

27-
import static com.oracle.svm.core.option.RuntimeOptionKey.RelevantForCompilationIsolates;
27+
import static com.oracle.svm.core.option.RuntimeOptionKey.RuntimeOptionKeyFlag.RelevantForCompilationIsolates;
2828
import static org.graalvm.compiler.core.common.GraalOptions.TrackNodeSourcePosition;
2929
import static org.graalvm.compiler.core.common.SpectrePHTMitigations.None;
3030
import static org.graalvm.compiler.core.common.SpectrePHTMitigations.Options.SpectrePHTBarriers;
@@ -36,8 +36,6 @@
3636
import java.nio.file.Path;
3737
import java.nio.file.Paths;
3838

39-
import com.oracle.svm.core.heap.ReferenceHandler;
40-
import com.oracle.svm.core.thread.VMOperationControl;
4139
import org.graalvm.collections.EconomicMap;
4240
import org.graalvm.collections.UnmodifiableEconomicMap;
4341
import org.graalvm.compiler.api.replacements.Fold;
@@ -53,12 +51,14 @@
5351
import org.graalvm.nativeimage.ImageSingletons;
5452

5553
import com.oracle.svm.core.deopt.DeoptimizationSupport;
54+
import com.oracle.svm.core.heap.ReferenceHandler;
5655
import com.oracle.svm.core.option.APIOption;
5756
import com.oracle.svm.core.option.APIOptionGroup;
5857
import com.oracle.svm.core.option.HostedOptionKey;
5958
import com.oracle.svm.core.option.ImmutableRuntimeOptionKey;
6059
import com.oracle.svm.core.option.LocatableMultiOptionValue;
6160
import com.oracle.svm.core.option.RuntimeOptionKey;
61+
import com.oracle.svm.core.thread.VMOperationControl;
6262
import com.oracle.svm.core.util.UserError;
6363

6464
public class SubstrateOptions {

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/code/RuntimeCodeCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
package com.oracle.svm.core.code;
2626

27-
import static com.oracle.svm.core.option.RuntimeOptionKey.RelevantForCompilationIsolates;
27+
import static com.oracle.svm.core.option.RuntimeOptionKey.RuntimeOptionKeyFlag.RelevantForCompilationIsolates;
2828
import static com.oracle.svm.core.snippets.KnownIntrinsics.readCallerStackPointer;
2929

3030
import org.graalvm.compiler.options.Option;

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/GCRuntimeOptionKey.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
* Notifies the {@link Heap} implementation after the value of the option has changed.
3232
*/
3333
public class GCRuntimeOptionKey<T> extends RuntimeOptionKey<T> {
34-
public GCRuntimeOptionKey(T defaultValue) {
35-
super(defaultValue);
34+
public GCRuntimeOptionKey(T defaultValue, RuntimeOptionKeyFlag... flags) {
35+
super(defaultValue, flags);
3636
}
3737

3838
@Override

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/ImmutableGCRuntimeOptionKey.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
* option was set.
3333
*/
3434
public class ImmutableGCRuntimeOptionKey<T> extends ImmutableRuntimeOptionKey<T> {
35-
public ImmutableGCRuntimeOptionKey(T defaultValue) {
36-
super(defaultValue);
35+
public ImmutableGCRuntimeOptionKey(T defaultValue, RuntimeOptionKeyFlag... flags) {
36+
super(defaultValue, flags);
3737
}
3838

3939
@Override

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/ImmutableRuntimeOptionKey.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,8 @@
3737
* A runtime option that can only be modified as long as the VM is not fully initialized yet.
3838
*/
3939
public class ImmutableRuntimeOptionKey<T> extends RuntimeOptionKey<T> {
40-
public ImmutableRuntimeOptionKey(T defaultValue) {
41-
super(defaultValue);
42-
}
43-
44-
public ImmutableRuntimeOptionKey(T defaultValue, boolean isRelevantForCompilationIsolate) {
45-
super(defaultValue, isRelevantForCompilationIsolate);
40+
public ImmutableRuntimeOptionKey(T defaultValue, RuntimeOptionKeyFlag... flags) {
41+
super(defaultValue, flags);
4642
}
4743

4844
@Override

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/RuntimeOptionKey.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,11 @@
3434
* @see com.oracle.svm.core.option
3535
*/
3636
public class RuntimeOptionKey<T> extends OptionKey<T> {
37-
public static final boolean RelevantForCompilationIsolates = true;
37+
private final int flags;
3838

39-
private final boolean copyToCompilationIsolate;
40-
41-
public RuntimeOptionKey(T defaultValue) {
42-
this(defaultValue, false);
43-
}
44-
45-
public RuntimeOptionKey(T defaultValue, boolean isRelevantForCompilationIsolate) {
39+
public RuntimeOptionKey(T defaultValue, RuntimeOptionKeyFlag... flags) {
4640
super(defaultValue);
47-
this.copyToCompilationIsolate = isRelevantForCompilationIsolate;
41+
this.flags = computeFlags(flags);
4842
}
4943

5044
/**
@@ -63,11 +57,24 @@ public boolean hasBeenSet() {
6357
}
6458

6559
public boolean shouldCopyToCompilationIsolate() {
66-
return copyToCompilationIsolate;
60+
return (flags & RuntimeOptionKeyFlag.RelevantForCompilationIsolates.ordinal()) != 0;
6761
}
6862

6963
@Fold
7064
public T getHostedValue() {
7165
return getValue(RuntimeOptionValues.singleton());
7266
}
67+
68+
private static int computeFlags(RuntimeOptionKeyFlag[] flags) {
69+
int result = 0;
70+
for (RuntimeOptionKeyFlag flag : flags) {
71+
assert flag.ordinal() <= Integer.SIZE - 1;
72+
result |= 1 << flag.ordinal();
73+
}
74+
return result;
75+
}
76+
77+
public enum RuntimeOptionKeyFlag {
78+
RelevantForCompilationIsolates
79+
}
7380
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Safepoint.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525
package com.oracle.svm.core.thread;
2626

27+
import static com.oracle.svm.core.option.RuntimeOptionKey.RuntimeOptionKeyFlag.RelevantForCompilationIsolates;
28+
2729
import java.util.concurrent.atomic.AtomicInteger;
2830

2931
import org.graalvm.compiler.api.replacements.Fold;
@@ -77,8 +79,6 @@
7779
import com.oracle.svm.core.util.TimeUtils;
7880
import com.oracle.svm.core.util.VMError;
7981

80-
import static com.oracle.svm.core.option.RuntimeOptionKey.RelevantForCompilationIsolates;
81-
8282
/**
8383
* Support for initiating safepoints, which are a global state in which all threads are paused so
8484
* that an invasive operation (such as garbage collection) can execute without interferences.

substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/SubstrateGraalUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
package com.oracle.svm.graal;
2626

27-
import static com.oracle.svm.core.option.RuntimeOptionKey.RelevantForCompilationIsolates;
27+
import static com.oracle.svm.core.option.RuntimeOptionKey.RuntimeOptionKeyFlag.RelevantForCompilationIsolates;
2828
import static com.oracle.svm.core.util.VMError.shouldNotReachHere;
2929

3030
import java.io.PrintStream;

0 commit comments

Comments
 (0)