Skip to content

Commit 0fa27ca

Browse files
committed
moved implementation of LibGraalRuntimeSupport into its own class
1 parent 46bf4bb commit 0fa27ca

File tree

2 files changed

+60
-25
lines changed

2 files changed

+60
-25
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/RuntimeSupport.java

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@
2828
import java.util.Objects;
2929
import java.util.concurrent.atomic.AtomicReference;
3030

31-
import com.oracle.svm.core.heap.Heap;
32-
import jdk.graal.nativeimage.impl.LibGraalRuntimeSupport;
3331
import org.graalvm.nativeimage.ImageSingletons;
3432
import org.graalvm.nativeimage.Platform;
3533
import org.graalvm.nativeimage.Platforms;
3634
import org.graalvm.nativeimage.VMRuntime;
37-
import org.graalvm.nativeimage.impl.IsolateSupport;
3835
import org.graalvm.nativeimage.impl.VMRuntimeSupport;
3936

4037
import com.oracle.svm.core.IsolateArgumentParser;
@@ -45,28 +42,8 @@
4542

4643
import jdk.graal.compiler.api.replacements.Fold;
4744

48-
@AutomaticallyRegisteredImageSingleton({VMRuntimeSupport.class, RuntimeSupport.class, LibGraalRuntimeSupport.class})
49-
public final class RuntimeSupport implements VMRuntimeSupport, LibGraalRuntimeSupport {
50-
51-
@Override
52-
public void processReferences() {
53-
Heap.getHeap().doReferenceHandling();
54-
}
55-
56-
@Override
57-
public void notifyLowMemoryPoint(boolean suggestFullGC) {
58-
Heap.getHeap().getGC().collectionHint(suggestFullGC);
59-
}
60-
61-
@Override
62-
public long getIsolateID() {
63-
return ImageSingletons.lookup(IsolateSupport.class).getIsolateID();
64-
}
65-
66-
@Override
67-
public void fatalError(String message) {
68-
throw VMError.shouldNotReachHere(message);
69-
}
45+
@AutomaticallyRegisteredImageSingleton({VMRuntimeSupport.class, RuntimeSupport.class})
46+
public final class RuntimeSupport implements VMRuntimeSupport {
7047

7148
@FunctionalInterface
7249
public interface Hook {
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) 2025, 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package com.oracle.svm.core.libgraal;
26+
27+
import org.graalvm.nativeimage.ImageSingletons;
28+
import org.graalvm.nativeimage.impl.IsolateSupport;
29+
30+
import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton;
31+
import com.oracle.svm.core.heap.Heap;
32+
import com.oracle.svm.core.util.VMError;
33+
34+
import jdk.graal.nativeimage.impl.LibGraalRuntimeSupport;
35+
36+
@AutomaticallyRegisteredImageSingleton({LibGraalRuntimeSupport.class})
37+
public final class LibGraalRuntimeSupportImpl implements LibGraalRuntimeSupport {
38+
39+
@Override
40+
public void processReferences() {
41+
Heap.getHeap().doReferenceHandling();
42+
}
43+
44+
@Override
45+
public void notifyLowMemoryPoint(boolean suggestFullGC) {
46+
Heap.getHeap().getGC().collectionHint(suggestFullGC);
47+
}
48+
49+
@Override
50+
public long getIsolateID() {
51+
return ImageSingletons.lookup(IsolateSupport.class).getIsolateID();
52+
}
53+
54+
@Override
55+
public void fatalError(String message) {
56+
throw VMError.shouldNotReachHere(message);
57+
}
58+
}

0 commit comments

Comments
 (0)