forked from oracle/graal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'oracle/master' into causality-export_wi…
…th-evaluation # Conflicts: # substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/SourceTypeFlow.java # substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisElement.java # substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisMethod.java
- Loading branch information
Showing
665 changed files
with
16,909 additions
and
10,695 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/VerifyGuardsStageUsages.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright (c) 2024, 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 jdk.graal.compiler.core.test; | ||
|
||
import jdk.graal.compiler.nodes.GraphState; | ||
import jdk.graal.compiler.nodes.GraphState.GuardsStage; | ||
import jdk.graal.compiler.nodes.StructuredGraph; | ||
import jdk.graal.compiler.nodes.java.LoadFieldNode; | ||
import jdk.graal.compiler.nodes.spi.CoreProviders; | ||
import jdk.graal.compiler.phases.VerifyPhase; | ||
import jdk.vm.ci.meta.MetaAccessProvider; | ||
import jdk.vm.ci.meta.ResolvedJavaMethod; | ||
import jdk.vm.ci.meta.ResolvedJavaType; | ||
|
||
/** | ||
* Verify that {@link GuardsStage} enums are encapsulated. | ||
*/ | ||
public class VerifyGuardsStageUsages extends VerifyPhase<CoreProviders> { | ||
|
||
@Override | ||
public boolean checkContract() { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected void verify(StructuredGraph graph, CoreProviders context) { | ||
MetaAccessProvider metaAccess = context.getMetaAccess(); | ||
ResolvedJavaMethod caller = graph.method(); | ||
|
||
if (caller.getDeclaringClass().equals(metaAccess.lookupJavaType(GraphState.class))) { | ||
return; | ||
} | ||
if (caller.getDeclaringClass().equals(metaAccess.lookupJavaType(GraphState.GuardsStage.class))) { | ||
return; | ||
} | ||
|
||
String callerName = caller.format("%H.%n"); | ||
|
||
switch (callerName) { | ||
case "jdk.graal.compiler.phases.common.GuardLoweringPhase.updateGraphState": | ||
case "jdk.graal.compiler.replacements.arraycopy.ArrayCopySnippets.delayedCheckcastArraycopySnippet": | ||
case "jdk.graal.compiler.replacements.arraycopy.ArrayCopySnippets.delayedExactArraycopyWithExpandedLoopSnippet": | ||
case "jdk.graal.compiler.replacements.arraycopy.ArrayCopySnippets.delayedGenericArraycopySnippet": | ||
// Exempted cases | ||
return; | ||
default: | ||
} | ||
|
||
final ResolvedJavaType typeGuardsStage = metaAccess.lookupJavaType(GraphState.GuardsStage.class); | ||
|
||
for (LoadFieldNode t : graph.getNodes().filter(LoadFieldNode.class)) { | ||
if (typeGuardsStage.equals(t.field().getDeclaringClass())) { | ||
throw new VerificationError("Access to %s fields at callsite %s is prohibited. Use API methods provided in %s.", | ||
typeGuardsStage.toJavaName(true), | ||
caller.format("%H.%n(%p)"), | ||
typeGuardsStage.toJavaName(true)); | ||
} | ||
} | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/VerifyRuntimeVersionFeature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (c) 2024, 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 jdk.graal.compiler.core.test; | ||
|
||
import java.lang.Runtime.Version; | ||
|
||
import jdk.graal.compiler.nodes.StructuredGraph; | ||
import jdk.graal.compiler.nodes.java.MethodCallTargetNode; | ||
import jdk.graal.compiler.nodes.spi.CoreProviders; | ||
import jdk.graal.compiler.phases.VerifyPhase; | ||
import jdk.graal.compiler.serviceprovider.JavaVersionUtil; | ||
import jdk.vm.ci.meta.MetaAccessProvider; | ||
import jdk.vm.ci.meta.ResolvedJavaMethod; | ||
import jdk.vm.ci.meta.ResolvedJavaType; | ||
|
||
/** | ||
* Verify that Graal fetches {@link Version#feature} only via {@link JavaVersionUtil}. | ||
*/ | ||
public class VerifyRuntimeVersionFeature extends VerifyPhase<CoreProviders> { | ||
|
||
@Override | ||
public boolean checkContract() { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected void verify(StructuredGraph graph, CoreProviders context) { | ||
MetaAccessProvider metaAccess = context.getMetaAccess(); | ||
ResolvedJavaMethod caller = graph.method(); | ||
|
||
if ("jdk.graal.compiler.serviceprovider.JavaVersionUtil.<clinit>()".equals(caller.format("%H.%n(%p)"))) { | ||
// JavaVersionUtil.JAVA_SPEC | ||
return; | ||
} | ||
|
||
final ResolvedJavaType typeRuntimeVersion = metaAccess.lookupJavaType(Runtime.Version.class); | ||
|
||
for (MethodCallTargetNode t : graph.getNodes(MethodCallTargetNode.TYPE)) { | ||
ResolvedJavaMethod callee = t.targetMethod(); | ||
if (typeRuntimeVersion.equals(callee.getDeclaringClass()) && "feature".equals(callee.getName())) { | ||
throw new VerificationError("Call to %s at callsite %s is prohibited, use JavaVersionUtil.JAVA_SPEC", callee.format("%H.%n(%p)"), caller.format("%H.%n(%p)")); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.