2424 */
2525package com .oracle .svm .core ;
2626
27+ import static com .oracle .svm .core .jvmstat .PerfManager .Options .PerfDataMemoryMappedFile ;
28+
2729import java .io .IOException ;
2830import java .util .HashSet ;
2931import java .util .List ;
@@ -78,14 +80,14 @@ public final class VMInspectionOptions {
7880 ", '" + MONITORING_JCMD_NAME + "' (experimental)" +
7981 ", or '" + MONITORING_ALL_NAME + "' (deprecated behavior: defaults to '" + MONITORING_ALL_NAME + "' if no argument is provided)" ;
8082
81- @ APIOption (name = ENABLE_MONITORING_OPTION , defaultValue = MONITORING_DEFAULT_NAME ) //
83+ @ APIOption (name = ENABLE_MONITORING_OPTION , defaultValue = MONITORING_DEFAULT_NAME )//
8284 @ Option (help = "Enable monitoring features that allow the VM to be inspected at run time. Comma-separated list can contain " + MONITORING_ALLOWED_VALUES_TEXT + ". " +
83- "For example: '--" + ENABLE_MONITORING_OPTION + "=" + MONITORING_HEAPDUMP_NAME + "," + MONITORING_JFR_NAME + "'." , type = OptionType .User ) //
85+ "For example: '--" + ENABLE_MONITORING_OPTION + "=" + MONITORING_HEAPDUMP_NAME + "," + MONITORING_JFR_NAME + "'." , type = OptionType .User )//
8486 public static final HostedOptionKey <AccumulatingLocatableMultiOptionValue .Strings > EnableMonitoringFeatures = new HostedOptionKey <>(
8587 AccumulatingLocatableMultiOptionValue .Strings .buildWithCommaDelimiter (),
8688 VMInspectionOptions ::validateEnableMonitoringFeatures );
8789
88- @ Option (help = "Dumps all runtime compiled methods on SIGUSR2." , type = OptionType .User ) //
90+ @ Option (help = "Dumps all runtime compiled methods on SIGUSR2." , type = OptionType .User )//
8991 public static final HostedOptionKey <Boolean > DumpRuntimeCompilationOnSignal = new HostedOptionKey <>(false , VMInspectionOptions ::notSupportedOnWindows );
9092
9193 static {
@@ -100,7 +102,7 @@ private static void notSupportedOnWindows(HostedOptionKey<Boolean> optionKey) {
100102 }
101103 }
102104
103- @ Option (help = "Print native memory tracking statistics on shutdown if native memory tracking is enabled." , type = OptionType .User ) //
105+ @ Option (help = "Print native memory tracking statistics on shutdown if native memory tracking is enabled." , type = OptionType .User )//
104106 public static final RuntimeOptionKey <Boolean > PrintNMTStatistics = new RuntimeOptionKey <>(false );
105107
106108 @ Platforms (Platform .HOSTED_ONLY .class )
@@ -122,6 +124,11 @@ public static void validateEnableMonitoringFeatures(@SuppressWarnings("unused")
122124 if (Platform .includedIn (WINDOWS_BASE .class )) {
123125 Set <String > notSupported = getEnabledMonitoringFeatures ();
124126 notSupported .retainAll (NOT_SUPPORTED_ON_WINDOWS );
127+ if (!PerfDataMemoryMappedFile .getValue ()) {
128+ /* Only not supported on Windows, if a memory-mapped file is needed. */
129+ notSupported .remove (MONITORING_JVMSTAT_NAME );
130+ }
131+
125132 if (!notSupported .isEmpty ()) {
126133 String msg = String .format ("the option '%s' contains value(s) that are not supported on Windows: %s. Those values will be ignored." , getDefaultMonitoringCommandArgument (),
127134 String .join (", " , notSupported ));
@@ -191,7 +198,8 @@ public static boolean hasJfrSupport() {
191198
192199 @ Fold
193200 public static boolean hasJvmstatSupport () {
194- return hasAllOrKeywordMonitoringSupport (MONITORING_JVMSTAT_NAME ) && !Platform .includedIn (WINDOWS_BASE .class );
201+ /* Only not supported on Windows, if a memory-mapped file is needed. */
202+ return hasAllOrKeywordMonitoringSupport (MONITORING_JVMSTAT_NAME ) && (!Platform .includedIn (WINDOWS_BASE .class ) || !PerfDataMemoryMappedFile .getValue ());
195203 }
196204
197205 @ Fold
@@ -221,7 +229,7 @@ public static boolean hasJCmdSupport() {
221229
222230 static class DeprecatedOptions {
223231 @ Option (help = "Enables features that allow the VM to be inspected during run time." , type = OptionType .User , //
224- deprecated = true , deprecationMessage = "Please use '--" + ENABLE_MONITORING_OPTION + "'" ) //
232+ deprecated = true , deprecationMessage = "Please use '--" + ENABLE_MONITORING_OPTION + "'" )//
225233 static final HostedOptionKey <Boolean > AllowVMInspection = new HostedOptionKey <>(false ) {
226234 @ Override
227235 protected void onValueUpdate (EconomicMap <OptionKey <?>, Object > values , Boolean oldValue , Boolean newValue ) {
@@ -232,7 +240,7 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Boolean o
232240 };
233241
234242 @ Option (help = "Dumps all thread stacktraces on SIGQUIT/SIGBREAK." , type = OptionType .User , //
235- deprecated = true , deprecationMessage = "Please use '--" + ENABLE_MONITORING_OPTION + "=" + MONITORING_THREADDUMP_NAME + "'" ) //
243+ deprecated = true , deprecationMessage = "Please use '--" + ENABLE_MONITORING_OPTION + "=" + MONITORING_THREADDUMP_NAME + "'" )//
236244 public static final HostedOptionKey <Boolean > DumpThreadStacksOnSignal = new HostedOptionKey <>(false );
237245 }
238246
0 commit comments