Skip to content

Commit

Permalink
Merge branch 'master' into resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandar Gradinac committed Jun 11, 2021
2 parents 00bf646 + 513ae6e commit 71fba02
Show file tree
Hide file tree
Showing 121 changed files with 9,606 additions and 206 deletions.
Expand Up @@ -1404,7 +1404,7 @@ public void formatTo(Formatter formatter, int flags, int width, int precision) {
* @param other a node of exactly the same type as this node
* @return true if the data fields of this object and {@code other} are equal
*/
public boolean valueEquals(Node other) {
public final boolean valueEquals(Node other) {
return getNodeClass().dataEquals(this, other);
}

Expand All @@ -1413,7 +1413,7 @@ public boolean valueEquals(Node other) {
* {@linkplain Successor control-flow} edges.
*
*/
public boolean dataFlowEquals(Node other) {
public final boolean dataFlowEquals(Node other) {
return this == other || nodeClass == other.getNodeClass() && this.valueEquals(other) && nodeClass.equalInputs(this, other);
}

Expand Down
Expand Up @@ -33,6 +33,7 @@
import org.graalvm.compiler.core.common.type.StampFactory;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.graph.spi.NodeWithIdentity;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.FixedWithNextNode;
import org.graalvm.compiler.nodes.LoopBeginNode;
Expand All @@ -44,7 +45,7 @@
* @see VarargsParameter
*/
@NodeInfo(cycles = CYCLES_0, size = SIZE_0)
public final class ExplodeLoopNode extends FixedWithNextNode {
public final class ExplodeLoopNode extends FixedWithNextNode implements NodeWithIdentity {
public static final NodeClass<ExplodeLoopNode> TYPE = NodeClass.create(ExplodeLoopNode.class);

public ExplodeLoopNode() {
Expand Down
Expand Up @@ -33,8 +33,17 @@
import org.openjdk.jmh.annotations.TearDown;

import com.oracle.truffle.api.dsl.test.AOTSupportTest;
import com.oracle.truffle.api.dsl.test.AOTSupportTest.AOTDynamicDispatch;
import com.oracle.truffle.api.dsl.test.AOTSupportTest.AOTDynamicDispatchTarget;
import com.oracle.truffle.api.dsl.test.AOTSupportTest.AOTInitializable;
import com.oracle.truffle.api.dsl.test.AOTSupportTest.BaseNode;
import com.oracle.truffle.api.dsl.test.AOTSupportTest.TestLanguage;
import com.oracle.truffle.api.dsl.test.AOTSupportTest.TestRootNode;
import com.oracle.truffle.api.dsl.test.AOTSupportTestFactory.AOTAutoLibraryNodeGen;
import com.oracle.truffle.api.dsl.test.AOTSupportTestFactory.AOTManualLibraryNodeGen;
import com.oracle.truffle.api.dsl.test.AOTSupportTestFactory.AOTManualLibrarySingleLimitNodeGen;
import com.oracle.truffle.api.dsl.test.AOTSupportTestFactory.TestNodeGen;
import com.oracle.truffle.api.test.polyglot.ProxyLanguage;

public class AOTSupportCompilationTest extends PartialEvaluationTest {

Expand All @@ -46,8 +55,22 @@ public AOTSupportCompilationTest() {

@Test
public void testAOTCompilation() {
TestRootNode root = setup();
assertValidCompilation(TestNodeGen.create(false), null);

assertValidCompilation(AOTAutoLibraryNodeGen.create(), new AOTInitializable());
assertValidCompilation(AOTManualLibraryNodeGen.create(), new AOTInitializable());
assertValidCompilation(AOTManualLibrarySingleLimitNodeGen.create(), new AOTInitializable());

assertValidCompilation(AOTAutoLibraryNodeGen.create(), new AOTDynamicDispatch(AOTDynamicDispatchTarget.class));
assertValidCompilation(AOTManualLibraryNodeGen.create(), new AOTDynamicDispatch(AOTDynamicDispatchTarget.class));
assertValidCompilation(AOTManualLibrarySingleLimitNodeGen.create(), new AOTDynamicDispatch(AOTDynamicDispatchTarget.class));
}

private void assertValidCompilation(BaseNode node, Object receiver) {
TestRootNode root = setup(node, receiver);
OptimizedCallTarget target = (OptimizedCallTarget) root.getCallTarget();
target.prepareForAOT();

context.enter();
target.compile(true);
assertTrue(target.isValidLastTier());
Expand All @@ -58,7 +81,19 @@ public void testAOTCompilation() {

@Test
public void testGraph() {
TestRootNode root = setup();
assertGraphNoCalls(TestNodeGen.create(false), null);

assertGraphNoCalls(AOTAutoLibraryNodeGen.create(), new AOTInitializable());
assertGraphNoCalls(AOTManualLibraryNodeGen.create(), new AOTInitializable());
assertGraphNoCalls(AOTManualLibrarySingleLimitNodeGen.create(), new AOTInitializable());

assertGraphNoCalls(AOTManualLibrarySingleLimitNodeGen.create(), new AOTDynamicDispatch(AOTDynamicDispatchTarget.class));
assertGraphNoCalls(AOTAutoLibraryNodeGen.create(), new AOTDynamicDispatch(AOTDynamicDispatchTarget.class));
assertGraphNoCalls(AOTManualLibraryNodeGen.create(), new AOTDynamicDispatch(AOTDynamicDispatchTarget.class));
}

private void assertGraphNoCalls(BaseNode node, Object receiver) throws AssertionError {
TestRootNode root = setup(node, receiver);
OptimizedCallTarget target = (OptimizedCallTarget) root.getCallTarget();
context.enter();
StructuredGraph graph = partialEval(target, new Object[0]);
Expand All @@ -68,13 +103,18 @@ public void testGraph() {
context.leave();
}

private TestRootNode setup() {
private TestRootNode setup(BaseNode node, Object receiver) {
if (context != null) {
context.close();
context = null;
}
context = Context.newBuilder().allowExperimentalOptions(true) //
.option("engine.CompileImmediately", "true") //
.option("engine.BackgroundCompilation", "false").build();
context.initialize(AOTSupportTest.LANGUAGE_ID);
context.initialize(ProxyLanguage.ID);
context.enter();
TestRootNode root = new TestRootNode(TestLanguage.getCurrentLanguage());
TestRootNode root = new TestRootNode(TestLanguage.getCurrentLanguage(), node, receiver);
GraalTruffleRuntime.getRuntime().createCallTarget(root);
context.leave();
return root;
Expand Down
1 change: 1 addition & 0 deletions substratevm/mx.substratevm/mx_substratevm.py
Expand Up @@ -418,6 +418,7 @@ def native_unittests_task():
additional_build_args = [
'-H:AdditionalSecurityProviders=com.oracle.svm.test.SecurityServiceTest$NoOpProvider',
'-H:AdditionalSecurityServiceTypes=com.oracle.svm.test.SecurityServiceTest$JCACompliantNoOpService',
'-H:+AllowVMInspection'
]

native_unittest(['--build-args', _native_unittest_features] + additional_build_args)
Expand Down
46 changes: 45 additions & 1 deletion substratevm/mx.substratevm/suite.py
Expand Up @@ -542,6 +542,46 @@
"spotbugs": "false",
},

"com.oracle.svm.jfr": {
"subDir": "src",
"sourceDirs": ["src"],
"dependencies": [
"com.oracle.svm.hosted",
],
"checkstyle": "com.oracle.svm.core",
"javaCompliance": "11+",
"requires": [
"jdk.jfr",
"jdk.management",
"jdk.unsupported"
],
"requiresConcealed": {
"jdk.jfr": [
"jdk.jfr.internal",
"jdk.jfr.internal.consumer",
"jdk.jfr.internal.jfc",
"jdk.jfr.internal.handlers",
"jdk.jfr.events"
],
"jdk.internal.vm.ci": [
"jdk.vm.ci.meta",
"jdk.vm.ci.code",
"jdk.vm.ci.hotspot"
],
"java.base": [
"jdk.internal.event",
"jdk.internal.misc",
"jdk.internal.util.xml",
"jdk.internal.util.xml.impl",
"jdk.internal.org.xml.sax.helpers"
]
},
"annotationProcessors": [
"compiler:GRAAL_PROCESSOR",
],
"workingSets": "SVM",
},

"com.oracle.svm.driver": {
"subDir": "src",
"sourceDirs": [
Expand Down Expand Up @@ -627,7 +667,10 @@
"mx:JUNIT_TOOL",
"sdk:GRAAL_SDK",
],
"requires" : ["java.compiler"],
"requires" : [
"java.compiler",
"jdk.jfr",
],
"checkstyle": "com.oracle.svm.core",
"workingSets": "SVM",
"annotationProcessors": [
Expand Down Expand Up @@ -1026,6 +1069,7 @@
"com.oracle.svm.core.windows",
"com.oracle.svm.core.genscavenge",
"com.oracle.svm.jni",
"com.oracle.svm.jfr",
"com.oracle.svm.reflect",
"com.oracle.svm.methodhandles"
],
Expand Down
Expand Up @@ -65,10 +65,12 @@ public RawFileDescriptor open(File file, FileAccessMode mode) {
}
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
@Override
public boolean isValid(RawFileDescriptor fd) {
int posixFd = getPosixFileDescriptor(fd);
return posixFd >= 0;
// > 0 to ensure the default value 0 is invalid on all platforms
return posixFd > 0;
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
Expand Down
Expand Up @@ -563,4 +563,13 @@ public Boolean getValue(OptionValues values) {
return getValueOrDefault(values.getMap());
}
};

@Option(help = "Enable Java Flight Recorder.")//
public static final RuntimeOptionKey<Boolean> FlightRecorder = new RuntimeOptionKey<>(false);

@Option(help = "Start flight recording with options.")//
public static final RuntimeOptionKey<String> StartFlightRecording = new RuntimeOptionKey<>("");

@Option(help = "file:doc-files/FlightRecorderLoggingHelp.txt")//
public static final RuntimeOptionKey<String> FlightRecorderLogging = new RuntimeOptionKey<>("all=warning");
}
@@ -0,0 +1,21 @@
Usage: -XX:FlightRecorderLogging=[tag1[+tag2...][*][=level][,...]]

When this option is not set, logging is enabled at a level of WARNING.
When this option is set to the empty string, logging is enabled at a level of INFO.
When this option is set to "disable", logging is disabled entirely.

Otherwise, this option expects a comma separated list of tag combinations, each with an optional wildcard (*) and level.
A tag combination without a level is given a default level of INFO.
Messages with tags that match a given tag combination are set to log at that tag combination's level.
If a tag combination does not have a wildcard, then only messages with exactly the same tags are matched.
Otherwise, messages whose tags are a subset of the tag combination are matched.
Specifying "all" instead of a tag combination matches all tag combinations.
If more than one tag combination matches a message's tags, the rightmost one will apply.
Messages with tags that do not have any matching tag combinations are set to log at a default level of WARNING.
This option is case insensitive.

Available log levels:
[trace, debug, info, warning, error, off]

Available log tags:
[jfr, system, event, setting, bytecode, parser, metadata, dcmd]
Expand Up @@ -560,6 +560,7 @@ public int getLayoutEncoding() {
return layoutEncoding;
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public int getTypeID() {
return typeID;
}
Expand Down Expand Up @@ -600,6 +601,7 @@ public boolean isInstantiated() {
return isFlagSet(IS_INSTANTIATED_FLAG_BIT);
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public static DynamicHub fromClass(Class<?> clazz) {
return SubstrateUtil.cast(clazz, DynamicHub.class);
}
Expand Down
@@ -0,0 +1,72 @@
/*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.core.jdk;

import org.graalvm.nativeimage.c.struct.RawField;
import org.graalvm.nativeimage.c.struct.RawStructure;
import org.graalvm.word.PointerBase;

/**
* The common interface for the LinkedList entries that can be used in an
* {@link UninterruptibleHashtable}.
*/
@RawStructure
public interface UninterruptibleEntry<T extends UninterruptibleEntry<T>> extends PointerBase {
/**
* Gets the next entry.
*/
@RawField
T getNext();

/**
* Sets the next entry.
*/
@RawField
void setNext(T value);

/**
* Gets the id for the entry.
*/
@RawField
long getId();

/**
* Sets the id for the entry.
*/
@RawField
void setId(long value);

/**
* Get the hashcode for the entry.
*/
@RawField
int getHash();

/**
* Sets the hashcode for the entry.
*/
@RawField
void setHash(int value);
}

0 comments on commit 71fba02

Please sign in to comment.