Skip to content

Commit a663301

Browse files
Renamed DiagnosticThunkRegister to DiagnosticThunkRegistry.
1 parent ed622d4 commit a663301

File tree

4 files changed

+23
-27
lines changed

4 files changed

+23
-27
lines changed

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/GreyToBlackObjectVisitor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.graalvm.word.WordFactory;
3535

3636
import com.oracle.svm.core.SubstrateDiagnostics.DiagnosticThunk;
37-
import com.oracle.svm.core.SubstrateDiagnostics.DiagnosticThunkRegister;
37+
import com.oracle.svm.core.SubstrateDiagnostics.DiagnosticThunkRegistry;
3838
import com.oracle.svm.core.SubstrateDiagnostics.ErrorContext;
3939
import com.oracle.svm.core.annotate.AlwaysInline;
4040
import com.oracle.svm.core.annotate.NeverInline;
@@ -62,7 +62,7 @@ public final class GreyToBlackObjectVisitor implements ObjectVisitor {
6262
this.objRefVisitor = greyToBlackObjRefVisitor;
6363
if (DiagnosticReporter.getHistoryLength() > 0) {
6464
this.diagnosticReporter = new DiagnosticReporter();
65-
DiagnosticThunkRegister.getSingleton().register(diagnosticReporter);
65+
DiagnosticThunkRegistry.singleton().register(diagnosticReporter);
6666
} else {
6767
this.diagnosticReporter = null;
6868
}

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/HeapImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.ArrayList;
2929
import java.util.List;
3030

31+
import com.oracle.svm.core.SubstrateDiagnostics.DiagnosticThunkRegistry;
3132
import com.oracle.svm.core.SubstrateDiagnostics.ErrorContext;
3233
import org.graalvm.compiler.api.replacements.Fold;
3334
import org.graalvm.compiler.core.common.NumUtil;
@@ -119,8 +120,8 @@ public HeapImpl(int pageSize) {
119120
this.gcImpl = new GCImpl();
120121
this.runtimeCodeInfoGcSupport = new RuntimeCodeInfoGCSupportImpl();
121122
HeapParameters.initialize();
122-
SubstrateDiagnostics.DiagnosticThunkRegister.getSingleton().register(new DumpHeapSettingsAndStatistics());
123-
SubstrateDiagnostics.DiagnosticThunkRegister.getSingleton().register(new DumpChunkInformation());
123+
DiagnosticThunkRegistry.singleton().register(new DumpHeapSettingsAndStatistics());
124+
DiagnosticThunkRegistry.singleton().register(new DumpChunkInformation());
124125
}
125126

126127
@Fold

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

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public static boolean isFatalErrorHandlingThread() {
106106

107107
public static int maxInvocations() {
108108
int result = 0;
109-
DiagnosticThunkRegister thunks = DiagnosticThunkRegister.getSingleton();
109+
DiagnosticThunkRegistry thunks = DiagnosticThunkRegistry.singleton();
110110
for (int i = 0; i < thunks.size(); i++) {
111111
result += thunks.getThunk(i).maxInvocationCount();
112112
}
@@ -142,10 +142,10 @@ public static void printInformation(Log log, Pointer sp, CodePointer ip, Registe
142142
errorContext.setFrameHasCalleeSavedRegisters(frameHasCalleeSavedRegisters);
143143

144144
// Print all thunks in a reasonably safe way.
145-
int numDiagnosticThunks = DiagnosticThunkRegister.getSingleton().size();
145+
int numDiagnosticThunks = DiagnosticThunkRegistry.singleton().size();
146146
for (int i = 0; i < numDiagnosticThunks; i++) {
147-
DiagnosticThunk thunk = DiagnosticThunkRegister.getSingleton().getThunk(i);
148-
int invocationCount = DiagnosticThunkRegister.getSingleton().getInitialInvocationCount(i);
147+
DiagnosticThunk thunk = DiagnosticThunkRegistry.singleton().getThunk(i);
148+
int invocationCount = DiagnosticThunkRegistry.singleton().getInitialInvocationCount(i);
149149
if (invocationCount <= thunk.maxInvocationCount()) {
150150
thunk.printDiagnostics(log, errorContext, DiagnosticLevel.SAFE, invocationCount);
151151
}
@@ -202,14 +202,14 @@ private static void printFatalErrorForCurrentState() {
202202
// Print the various sections of the diagnostics and skip all sections that were already
203203
// printed earlier.
204204
ErrorContext errorContext = fatalErrorState.getErrorContext();
205-
int numDiagnosticThunks = DiagnosticThunkRegister.getSingleton().size();
205+
int numDiagnosticThunks = DiagnosticThunkRegistry.singleton().size();
206206
while (fatalErrorState.diagnosticThunkIndex < numDiagnosticThunks) {
207207
int index = fatalErrorState.diagnosticThunkIndex;
208-
DiagnosticThunk thunk = DiagnosticThunkRegister.getSingleton().getThunk(index);
208+
DiagnosticThunk thunk = DiagnosticThunkRegistry.singleton().getThunk(index);
209209

210210
// Start at the configured initial invocation count.
211211
if (fatalErrorState.invocationCount == 0) {
212-
fatalErrorState.invocationCount = DiagnosticThunkRegister.getSingleton().getInitialInvocationCount(index) - 1;
212+
fatalErrorState.invocationCount = DiagnosticThunkRegistry.singleton().getInitialInvocationCount(index) - 1;
213213
}
214214

215215
while (++fatalErrorState.invocationCount <= thunk.maxInvocationCount()) {
@@ -322,13 +322,13 @@ private static void updateInitialInvocationCount(String entry) throws IllegalArg
322322
int initialInvocationCount = parseInvocationCount(entry, pos);
323323

324324
int matches = 0;
325-
int numDiagnosticThunks = DiagnosticThunkRegister.getSingleton().size();
325+
int numDiagnosticThunks = DiagnosticThunkRegistry.singleton().size();
326326
for (int i = 0; i < numDiagnosticThunks; i++) {
327-
DiagnosticThunk thunk = DiagnosticThunkRegister.getSingleton().getThunk(i);
327+
DiagnosticThunk thunk = DiagnosticThunkRegistry.singleton().getThunk(i);
328328
// Checkstyle: allow Class.getSimpleName
329329
if (matches(thunk.getClass().getSimpleName(), pattern)) {
330330
// Checkstyle: disallow Class.getSimpleName
331-
DiagnosticThunkRegister.getSingleton().setInitialInvocationCount(i, initialInvocationCount);
331+
DiagnosticThunkRegistry.singleton().setInitialInvocationCount(i, initialInvocationCount);
332332
matches++;
333333
}
334334
}
@@ -898,27 +898,22 @@ public abstract static class DiagnosticThunk {
898898
public abstract int maxInvocationCount();
899899
}
900900

901-
public static class DiagnosticThunkRegister {
901+
public static class DiagnosticThunkRegistry {
902902
private DiagnosticThunk[] diagnosticThunks;
903903
private int[] initialInvocationCount;
904904

905-
/**
906-
* Get the register.
907-
* <p>
908-
* This method is @Fold so anyone who uses it ensures there is a register.
909-
*/
910905
@Fold
911906
/* Checkstyle: allow synchronization. */
912-
public static synchronized DiagnosticThunkRegister getSingleton() {
913-
if (!ImageSingletons.contains(DiagnosticThunkRegister.class)) {
914-
ImageSingletons.add(DiagnosticThunkRegister.class, new DiagnosticThunkRegister());
907+
public static synchronized DiagnosticThunkRegistry singleton() {
908+
if (!ImageSingletons.contains(DiagnosticThunkRegistry.class)) {
909+
ImageSingletons.add(DiagnosticThunkRegistry.class, new DiagnosticThunkRegistry());
915910
}
916-
return ImageSingletons.lookup(DiagnosticThunkRegister.class);
911+
return ImageSingletons.lookup(DiagnosticThunkRegistry.class);
917912
}
918913
/* Checkstyle: disallow synchronization. */
919914

920915
@Platforms(Platform.HOSTED_ONLY.class)
921-
DiagnosticThunkRegister() {
916+
DiagnosticThunkRegistry() {
922917
this.diagnosticThunks = new DiagnosticThunk[]{new DumpRegisters(), new DumpInstructions(), new DumpTopOfCurrentThreadStack(), new DumpDeoptStubPointer(), new DumpTopFrame(),
923918
new DumpThreads(), new DumpCurrentThreadLocals(), new DumpCurrentVMOperation(), new DumpVMOperationHistory(), new DumpCodeCacheHistory(),
924919
new DumpRuntimeCodeInfoMemory(), new DumpRecentDeoptimizations(), new DumpCounters(), new DumpCurrentThreadFrameAnchors(), new DumpCurrentThreadDecodedStackTrace(),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.graalvm.nativeimage.hosted.Feature;
3131

3232
import com.oracle.graal.pointsto.meta.AnalysisField;
33-
import com.oracle.svm.core.SubstrateDiagnostics.DiagnosticThunkRegister;
33+
import com.oracle.svm.core.SubstrateDiagnostics.DiagnosticThunkRegistry;
3434
import com.oracle.svm.core.SubstrateDiagnostics.FatalErrorState;
3535
import com.oracle.svm.core.SubstrateOptions;
3636
import com.oracle.svm.core.annotate.AutomaticFeature;
@@ -44,7 +44,7 @@ public void duringSetup(DuringSetupAccess access) {
4444
ImageSingletons.add(FatalErrorState.class, new FatalErrorState());
4545

4646
// Ensure that the diagnostic thunks are initialized.
47-
DiagnosticThunkRegister.getSingleton();
47+
DiagnosticThunkRegistry.singleton();
4848
}
4949

5050
@Override

0 commit comments

Comments
 (0)