Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.

Commit 49ff204

Browse files
committed
[GR-5926] JVMCI support for libgraal.
PullRequest: graal-jvmci-8/52
2 parents 452657c + 60fca53 commit 49ff204

File tree

128 files changed

+10506
-4511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+10506
-4511
lines changed

hotspot/.project

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@
9090
<type>2</type>
9191
<locationURI>PARENT-1-PROJECT_LOC/agent</locationURI>
9292
</link>
93-
<link>
94-
<name>build</name>
95-
<type>2</type>
96-
<locationURI>PARENT-1-PROJECT_LOC/build</locationURI>
97-
</link>
9893
<link>
9994
<name>make</name>
10095
<type>2</type>

jvmci/jdk.vm.ci.code/snapshot.sigtest

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,16 +276,17 @@ meth public !varargs java.lang.Object executeVarargs(java.lang.Object[]) throws
276276
meth public boolean isAlive()
277277
meth public boolean isValid()
278278
meth public byte[] getCode()
279-
meth public final long getAddress()
280-
meth public final long getEntryPoint()
281279
meth public final long getVersion()
282280
meth public java.lang.String getName()
281+
meth public long getAddress()
282+
meth public long getEntryPoint()
283283
meth public long getStart()
284284
meth public void invalidate()
285285
supr java.lang.Object
286286

287287
CLSS public final jdk.vm.ci.code.InvalidInstalledCodeException
288288
cons public init()
289+
cons public init(java.lang.String)
289290
supr java.lang.Exception
290291
hfds serialVersionUID
291292

jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/Architecture.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ public final int requiredBarriers(int barriers) {
193193
public abstract PlatformKind getLargestStorableKind(RegisterCategory category);
194194

195195
/**
196-
* Return the {@link PlatformKind} that is used to store values of a given {@link JavaKind}.
196+
* Gets the {@link PlatformKind} that is used to store values of a given {@link JavaKind}.
197+
*
198+
* @return {@code null} if there no deterministic {@link PlatformKind} for {@code javaKind}
197199
*/
198200
public abstract PlatformKind getPlatformKind(JavaKind javaKind);
199201

jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeCacheProvider.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public interface CodeCacheProvider {
4646
* created.
4747
* @return a reference to the ready-to-run code
4848
* @throws BailoutException if the code installation failed
49+
* @throws IllegalArgumentException if {@code installedCode != null} and this object does not
50+
* support a predefined {@link InstalledCode} object
4951
*/
5052
default InstalledCode addCode(ResolvedJavaMethod method, CompiledCode compiledCode, SpeculationLog log, InstalledCode installedCode) {
5153
return installCode(method, compiledCode, installedCode, log, false);
@@ -60,6 +62,8 @@ default InstalledCode addCode(ResolvedJavaMethod method, CompiledCode compiledCo
6062
* @param compiledCode the compiled code to be added
6163
* @return a reference to the ready-to-run code
6264
* @throws BailoutException if the code installation failed
65+
* @throws IllegalArgumentException if {@code installedCode != null} and this object does not
66+
* support a predefined {@link InstalledCode} object
6367
*/
6468
default InstalledCode setDefaultCode(ResolvedJavaMethod method, CompiledCode compiledCode) {
6569
return installCode(method, compiledCode, null, null, true);

jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/InstalledCode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ public InstalledCode(String name) {
5454
/**
5555
* @return the address of entity representing this installed code.
5656
*/
57-
public final long getAddress() {
57+
public long getAddress() {
5858
return address;
5959
}
6060

6161
/**
6262
* @return the address of the normal entry point of the installed code.
6363
*/
64-
public final long getEntryPoint() {
64+
public long getEntryPoint() {
6565
return entryPoint;
6666
}
6767

jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/InvalidInstalledCodeException.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,12 @@
2929
*/
3030
public final class InvalidInstalledCodeException extends Exception {
3131

32+
public InvalidInstalledCodeException() {
33+
}
34+
35+
public InvalidInstalledCodeException(String message) {
36+
super(message);
37+
}
38+
3239
private static final long serialVersionUID = -3540232440794244844L;
3340
}

jvmci/jdk.vm.ci.common/snapshot.sigtest

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,12 @@ intf java.lang.annotation.Annotation
8080
meth public abstract java.lang.annotation.ElementType[] value()
8181

8282
CLSS public final jdk.vm.ci.common.InitTimer
83-
fld public final static java.lang.String SPACES = " "
84-
fld public final static java.util.concurrent.atomic.AtomicInteger nesting
8583
intf java.lang.AutoCloseable
8684
meth public static jdk.vm.ci.common.InitTimer timer(java.lang.String)
8785
meth public static jdk.vm.ci.common.InitTimer timer(java.lang.String,java.lang.Object)
8886
meth public void close()
8987
supr java.lang.Object
90-
hfds ENABLED,initializingThread,name,start
88+
hfds SPACES,enabledPropertyValue,initializingThread,name,nesting,start
9189

9290
CLSS public jdk.vm.ci.common.JVMCIError
9391
cons public !varargs init(java.lang.String,java.lang.Object[])

jvmci/jdk.vm.ci.common/src/jdk/vm/ci/common/InitTimer.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,32 @@ public void close() {
6060
}
6161

6262
public static InitTimer timer(String name) {
63-
return ENABLED ? new InitTimer(name) : null;
63+
return isEnabled() ? new InitTimer(name) : null;
6464
}
6565

6666
public static InitTimer timer(String name, Object suffix) {
67-
return ENABLED ? new InitTimer(name + suffix) : null;
67+
return isEnabled() ? new InitTimer(name + suffix) : null;
6868
}
6969

7070
/**
71-
* Specifies if initialization timing is enabled. Note: This property cannot use
71+
* Determines if initialization timing is enabled. Note: This property cannot use
7272
* {@code HotSpotJVMCIRuntime.Option} since that class is not visible from this package.
7373
*/
74-
private static final boolean ENABLED = Boolean.getBoolean("jvmci.InitTimer");
74+
private static boolean isEnabled() {
75+
if (enabledPropertyValue == null) {
76+
enabledPropertyValue = Boolean.getBoolean("jvmci.InitTimer");
77+
nesting = new AtomicInteger();
78+
}
79+
return enabledPropertyValue;
80+
}
81+
82+
/**
83+
* Cache for value of {@code jvmci.InitTimer} system property.
84+
*/
85+
@NativeImageReinitialize private static Boolean enabledPropertyValue;
7586

76-
public static final AtomicInteger nesting = ENABLED ? new AtomicInteger() : null;
77-
public static final String SPACES = " ";
87+
private static AtomicInteger nesting;
88+
private static final String SPACES = " ";
7889

7990
/**
8091
* Used to assert the invariant that all related initialization happens on the same thread.

jvmci/jdk.vm.ci.common/src/jdk/vm/ci/common/NativeImageReinitialize.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import java.lang.annotation.Target;
3131

3232
/**
33-
* Denotes a field that should have the default value for its type when building a native image.
33+
* Denotes a field that should have the default value for its type in an ahead of time image.
3434
*/
3535
@Retention(RetentionPolicy.RUNTIME)
3636
@Target({ElementType.FIELD})

jvmci/jdk.vm.ci.hotspot.jfr/src/jdk/vm/ci/hotspot/jfr/events/JFREventProvider.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
*/
2323
package jdk.vm.ci.hotspot.jfr.events;
2424

25+
import static jdk.vm.ci.services.Services.IS_IN_NATIVE_IMAGE;
26+
2527
import java.net.URISyntaxException;
2628

2729
import jdk.vm.ci.hotspot.EventProvider;
@@ -45,6 +47,11 @@ public static class Locator extends JVMCIServiceLocator {
4547

4648
@Override
4749
public <S> S getProvider(Class<S> service) {
50+
if (IS_IN_NATIVE_IMAGE) {
51+
// Currently too many features unsupported by SVM such
52+
// as Class.getDeclaredClasses0().
53+
return null;
54+
}
4855
if (service == EventProvider.class) {
4956
return service.cast(new JFREventProvider());
5057
}
@@ -89,7 +96,7 @@ public JFREventProvider() {
8996
* Register an event class with the {@link com.oracle.jrockit.jfr.Producer}.
9097
*
9198
* @param c event class
92-
* @return the {@link EventToken event token}
99+
* @return the {@link com.oracle.jrockit.jfr.EventToken event token}
93100
*/
94101
@SuppressWarnings({"javadoc", "unchecked"})
95102
private static com.oracle.jrockit.jfr.EventToken registerEvent(com.oracle.jrockit.jfr.Producer producer, Class<?> c) {

0 commit comments

Comments
 (0)