Skip to content

Commit bdd3c69

Browse files
Style and test fixes.
1 parent 745d079 commit bdd3c69

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import com.oracle.svm.core.option.APIOption;
4141
import com.oracle.svm.core.option.HostedOptionKey;
4242
import com.oracle.svm.core.option.LocatableMultiOptionValue;
43+
import com.oracle.svm.core.option.RuntimeOptionKey;
4344
import com.oracle.svm.core.option.SubstrateOptionsParser;
4445
import com.oracle.svm.core.util.UserError;
4546
import com.oracle.svm.util.LogUtils;
@@ -77,6 +78,13 @@ public final class VMInspectionOptions {
7778
public static final HostedOptionKey<LocatableMultiOptionValue.Strings> EnableMonitoringFeatures = new HostedOptionKey<>(LocatableMultiOptionValue.Strings.buildWithCommaDelimiter(),
7879
VMInspectionOptions::validateEnableMonitoringFeatures);
7980

81+
@Option(help = "Dumps all runtime compiled methods on SIGUSR2.", type = OptionType.User) //
82+
public static final HostedOptionKey<Boolean> DumpRuntimeCompilationOnSignal = new HostedOptionKey<>(false);
83+
84+
// TEMP (chaeubl): change default to true.
85+
@Option(help = "Print native memory tracking statistics on shutdown.", type = OptionType.User) //
86+
public static final RuntimeOptionKey<Boolean> PrintNMTStatistics = new RuntimeOptionKey<>(false);
87+
8088
@Platforms(Platform.HOSTED_ONLY.class)
8189
public static void validateEnableMonitoringFeatures(@SuppressWarnings("unused") OptionKey<?> optionKey) {
8290
Set<String> enabledFeatures = getEnabledMonitoringFeatures();
@@ -173,9 +181,6 @@ public static boolean hasNativeMemoryTrackingSupport() {
173181
// return hasAllOrKeywordMonitoringSupport(MONITORING_NMT_NAME);
174182
}
175183

176-
@Option(help = "Dumps all runtime compiled methods on SIGUSR2.", type = OptionType.User) //
177-
public static final HostedOptionKey<Boolean> DumpRuntimeCompilationOnSignal = new HostedOptionKey<>(false);
178-
179184
static class DeprecatedOptions {
180185
@Option(help = "Enables features that allow the VM to be inspected during run time.", type = OptionType.User, //
181186
deprecated = true, deprecationMessage = "Please use '--" + ENABLE_MONITORING_OPTION + "'") //

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/headers/LibC.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535

3636
import jdk.graal.compiler.api.replacements.Fold;
3737

38-
import jdk.graal.compiler.api.replacements.Fold;
39-
4038
/** Platform-independent LibC support. */
4139
public class LibC {
4240
public static final int EXIT_CODE_ABORT = 99;

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/nmt/NativeMemoryTracking.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
import org.graalvm.word.UnsignedWord;
3838
import org.graalvm.word.WordFactory;
3939

40-
import com.oracle.svm.core.SubstrateOptions;
4140
import com.oracle.svm.core.Uninterruptible;
41+
import com.oracle.svm.core.VMInspectionOptions;
4242
import com.oracle.svm.core.jdk.RuntimeSupport;
4343
import com.oracle.svm.core.memory.NativeMemory;
4444
import com.oracle.svm.core.util.UnsignedUtils;
@@ -147,8 +147,7 @@ public static RuntimeSupport.Hook shutdownHook() {
147147
}
148148

149149
public void printStatistics() {
150-
// TEMP (chaeubl): disable for now
151-
if (!SubstrateOptions.DiagnosticDetails.getValue().isEmpty()) {
150+
if (VMInspectionOptions.PrintNMTStatistics.getValue()) {
152151
System.out.println();
153152
System.out.println("Native memory tracking");
154153
System.out.println(" Total used memory: " + mallocMemorySnapshot.getTotalInfo().getUsed() + " bytes");

substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/debug/CStructTests.java

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

27+
import org.graalvm.nativeimage.UnmanagedMemory;
2728
import org.graalvm.nativeimage.c.CContext;
2829
import org.graalvm.nativeimage.c.struct.CField;
2930
import org.graalvm.nativeimage.c.struct.CFieldAddress;
@@ -37,8 +38,6 @@
3738
import org.graalvm.word.SignedWord;
3839

3940
import com.oracle.svm.core.NeverInline;
40-
import com.oracle.svm.core.memory.NativeMemory;
41-
import com.oracle.svm.core.nmt.NmtCategory;
4241

4342
import jdk.graal.compiler.api.directives.GraalDirectives;
4443

@@ -120,7 +119,7 @@ interface Weird extends PointerBase {
120119
])
121120
*/
122121
public static void weird() {
123-
Weird wd = NativeMemory.malloc(SizeOf.get(Weird.class), NmtCategory.Other);
122+
Weird wd = UnmanagedMemory.malloc(SizeOf.get(Weird.class));
124123

125124
wd.setf_short((short) 42);
126125
wd.setf_int(43);
@@ -209,7 +208,7 @@ interface CompositeStruct extends PointerBase {
209208
])
210209
*/
211210
public static void composite() {
212-
CompositeStruct cs = NativeMemory.malloc(3 * SizeOf.get(CompositeStruct.class), NmtCategory.Other);
211+
CompositeStruct cs = UnmanagedMemory.malloc(3 * SizeOf.get(CompositeStruct.class));
213212
cs.setC1((byte) 7);
214213
cs.setC3(13);
215214
cs.setC5((short) 32000);
@@ -221,8 +220,8 @@ public static void composite() {
221220
}
222221

223222
public static void mixedArguments() {
224-
SimpleStruct ss1 = NativeMemory.malloc(SizeOf.get(SimpleStruct.class), NmtCategory.Other);
225-
SimpleStruct2 ss2 = NativeMemory.malloc(SizeOf.get(SimpleStruct2.class), NmtCategory.Other);
223+
SimpleStruct ss1 = UnmanagedMemory.malloc(SizeOf.get(SimpleStruct.class));
224+
SimpleStruct2 ss2 = UnmanagedMemory.malloc(SizeOf.get(SimpleStruct2.class));
226225
String m1 = "a message in a bottle";
227226
String m2 = "a ship in a bottle";
228227
String m3 = "courage in a bottle";
@@ -252,6 +251,6 @@ public static void main(String[] args) {
252251

253252
@NeverInline("Used as a hook to inspect the caller frame in GDB")
254253
static void free(PointerBase ptr) {
255-
NativeMemory.free(ptr);
254+
UnmanagedMemory.free(ptr);
256255
}
257256
}

substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/nmt/NativeMemoryTrackingTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939

4040
public class NativeMemoryTrackingTests {
4141
private static final int ALLOCATION_SIZE = 1024 * 16;
42-
private static final int RESERVE_SIZE = ALLOCATION_SIZE;
4342
private static final int REALLOC_SIZE = ALLOCATION_SIZE / 2;
4443

4544
@Test

0 commit comments

Comments
 (0)