Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ protected void verify(StructuredGraph graph, CoreProviders context) {
"org.graalvm.compiler.core.test.VerifyDebugUsageTest$InvalidConcatDumpUsagePhase.run",
"org.graalvm.compiler.core.test.VerifyDebugUsageTest$InvalidDumpUsagePhase.run",
"org.graalvm.compiler.hotspot.SymbolicSnippetEncoder.verifySnippetEncodeDecode",
"com.oracle.graal.pointsto.phases.InlineBeforeAnalysis.decodeGraph",
"org.graalvm.compiler.truffle.compiler.phases.inlining.CallTree.dumpBasic"));

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private PointsToAnalyzer(String mainEntryClass, OptionValues options) {

JavaKind wordKind = JavaKind.fromWordSize(wordSize);
AnalysisUniverse aUniverse = new AnalysisUniverse(standaloneHost, wordKind,
analysisPolicy, SubstitutionProcessor.IDENTITY, originalMetaAccess, snippetReflection, snippetReflection, new PointsToAnalysisFactory(), null);
analysisPolicy, SubstitutionProcessor.IDENTITY, originalMetaAccess, snippetReflection, new PointsToAnalysisFactory(), null);
AnalysisMetaAccess aMetaAccess = new AnalysisMetaAccess(aUniverse, originalMetaAccess);
StandaloneConstantReflectionProvider aConstantReflection = new StandaloneConstantReflectionProvider(aUniverse, HotSpotJVMCIRuntime.runtime());
StandaloneConstantFieldProvider aConstantFieldProvider = new StandaloneConstantFieldProvider(aMetaAccess);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private synchronized void linearizeGraph(boolean isRedo) {
int slotNum = flow.getSlot();
if (slotNum != -1) {
assert flow instanceof FormalParamTypeFlow || flow instanceof FormalReturnTypeFlow : "Unexpected flow " + flow;
AnalysisError.guarantee(isRedo && flow.getSlot() == resultFlows.size(), "Flow already discovered: " + flow);
AnalysisError.guarantee(isRedo && flow.getSlot() == resultFlows.size(), "Flow already discovered: %s", flow);
} else {
flow.setSlot(resultFlows.size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void ensureFlowsGraphCreated(PointsToAnalysis bb, InvokeTypeFlow reason)
private synchronized void createFlowsGraph(PointsToAnalysis bb, InvokeTypeFlow reason) {
if (flowsGraph == null) {
AnalysisError.guarantee(reason == null || reason.getSource() == null ||
!reason.getSource().getMethod().equals(method), "Parsing reason cannot be in the target method itself " + method.format("%H.%n"));
!reason.getSource().getMethod().equals(method), "Parsing reason cannot be in the target method itself: %s", method);

parsingReason = reason;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ private void insertPlaceholderParamAndReturnFlows() {
AnalysisType paramType = (AnalysisType) paramTypes[index];
FormalParamTypeFlow parameter;
if (!isStatic && index == 0) {
assert paramType == method.getDeclaringClass();
assert paramType.equals(method.getDeclaringClass());
parameter = new FormalReceiverTypeFlow(position, paramType);
} else {
parameter = new FormalParamTypeFlow(position, paramType, index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ private void ensureTypeScanned(JavaConstant typeConstant, AnalysisType type, Sca

@SuppressWarnings({"unchecked", "rawtypes"})
private void ensureTypeScanned(JavaConstant value, JavaConstant typeConstant, AnalysisType type, ScanReason reason) {
AnalysisError.guarantee(type.isReachable(), "The heap snapshot verifier discovered a type not marked as reachable " + type.toJavaName());
AnalysisError.guarantee(type.isReachable(), "The heap snapshot verifier discovered a type not marked as reachable: %s", type);
Object task = imageHeap.getTask(typeConstant);
/* Make sure the DynamicHub value is scanned. */
if (task == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,14 @@ JavaConstant onFieldValueReachable(AnalysisField field, ImageHeapInstance receiv
}

JavaConstant onFieldValueReachable(AnalysisField field, ImageHeapInstance receiver, ValueSupplier<JavaConstant> rawValue, ScanReason reason, Consumer<ScanReason> onAnalysisModified) {
AnalysisError.guarantee(field.isReachable(), "Field value is only reachable when field is reachable " + field.format("%H.%n"));
AnalysisError.guarantee(field.isReachable(), "Field value is only reachable when field is reachable: %s", field);

/*
* Check if the field value is available. If not, trying to access it is an error. This
* forces the callers to only trigger the execution of the future task when the value is
* ready to be materialized.
*/
AnalysisError.guarantee(rawValue.isAvailable(), "Value not yet available for " + field.format("%H.%n"));
AnalysisError.guarantee(rawValue.isAvailable(), "Value not yet available for %s", field);

JavaConstant transformedValue;
try {
Expand Down Expand Up @@ -544,7 +544,7 @@ public boolean isValueAvailable(@SuppressWarnings("unused") AnalysisField field)
@SuppressWarnings({"unchecked", "rawtypes"})
private void snapshotFieldValue(AnalysisField field, Object fieldTask) {
if (fieldTask instanceof AnalysisFuture<?>) {
AnalysisError.guarantee(field.isReachable(), "Field value snapshot computed for field not reachable " + field.format("%H.%n"));
AnalysisError.guarantee(field.isReachable(), "Field value snapshot computed for field not reachable: %s", field);
postTask((AnalysisFuture<JavaConstant>) fieldTask);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
import jdk.vm.ci.meta.ConstantPool;
import jdk.vm.ci.meta.JavaField;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType;

public class AnalysisConstantPool extends WrappedConstantPool {

public AnalysisConstantPool(Universe universe, ConstantPool wrapped, WrappedJavaType defaultAccessingClass) {
public AnalysisConstantPool(Universe universe, ConstantPool wrapped, ResolvedJavaType defaultAccessingClass) {
super(universe, wrapped, defaultAccessingClass);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
*/
package com.oracle.graal.pointsto.infrastructure;

import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
import com.oracle.graal.pointsto.util.GraalAccess;

import jdk.vm.ci.meta.ResolvedJavaType;

public interface OriginalClassProvider {

static Class<?> getJavaClass(SnippetReflectionProvider reflectionProvider, ResolvedJavaType javaType) {
static Class<?> getJavaClass(ResolvedJavaType javaType) {
if (javaType instanceof OriginalClassProvider) {
return ((OriginalClassProvider) javaType).getJavaClass();
} else {
return reflectionProvider.originalClass(javaType);
return GraalAccess.getOriginalSnippetReflection().originalClass(javaType);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@

import java.lang.reflect.Field;

import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
import com.oracle.graal.pointsto.util.GraalAccess;

import jdk.vm.ci.meta.ResolvedJavaField;

public interface OriginalFieldProvider {

static Field getJavaField(SnippetReflectionProvider reflectionProvider, ResolvedJavaField field) {
static Field getJavaField(ResolvedJavaField field) {
if (field instanceof OriginalFieldProvider) {
return ((OriginalFieldProvider) field).getJavaField();
} else {
return reflectionProvider.originalField(field);
return GraalAccess.getOriginalSnippetReflection().originalField(field);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@

import java.lang.reflect.Executable;

import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
import com.oracle.graal.pointsto.util.GraalAccess;

import jdk.vm.ci.meta.ResolvedJavaMethod;

public interface OriginalMethodProvider {

static Executable getJavaMethod(SnippetReflectionProvider reflectionProvider, ResolvedJavaMethod method) {
static Executable getJavaMethod(ResolvedJavaMethod method) {
if (method instanceof OriginalMethodProvider) {
return ((OriginalMethodProvider) method).getJavaMethod();
} else {
return reflectionProvider.originalMethod(method);
return GraalAccess.getOriginalSnippetReflection().originalMethod(method);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public interface Universe {

JavaMethod lookupAllowUnresolved(JavaMethod method);

WrappedSignature lookup(Signature signature, WrappedJavaType defaultAccessingClass);
WrappedSignature lookup(Signature signature, ResolvedJavaType defaultAccessingClass);

WrappedConstantPool lookup(ConstantPool constantPool, WrappedJavaType defaultAccessingClass);
WrappedConstantPool lookup(ConstantPool constantPool, ResolvedJavaType defaultAccessingClass);

JavaConstant lookup(JavaConstant constant);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public class WrappedConstantPool implements ConstantPool, ConstantPoolPatch {

protected final Universe universe;
protected final ConstantPool wrapped;
private final WrappedJavaType defaultAccessingClass;
private final ResolvedJavaType defaultAccessingClass;

public WrappedConstantPool(Universe universe, ConstantPool wrapped, WrappedJavaType defaultAccessingClass) {
public WrappedConstantPool(Universe universe, ConstantPool wrapped, ResolvedJavaType defaultAccessingClass) {
this.universe = universe;
this.wrapped = wrapped;
this.defaultAccessingClass = defaultAccessingClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@
public interface WrappedElement {

AnnotatedElement getWrapped();

default AnnotatedElement getWrappedWithoutResolve() {
return getWrapped();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public class WrappedSignature implements Signature {
private final Signature wrapped;
private final ResolvedJavaType defaultAccessingClass;

public WrappedSignature(Universe universe, Signature wrapped, WrappedJavaType defaultAccessingClass) {
public WrappedSignature(Universe universe, Signature wrapped, ResolvedJavaType defaultAccessingClass) {
this.universe = universe;
this.wrapped = wrapped;
this.defaultAccessingClass = defaultAccessingClass.getWrapped();
this.defaultAccessingClass = defaultAccessingClass;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,35 +49,31 @@ public abstract class AnalysisElement implements AnnotatedElement {

public abstract AnnotatedElement getWrapped();

public AnnotatedElement getWrappedWithoutResolve() {
return getWrapped();
}

protected abstract AnalysisUniverse getUniverse();

@Override
public final boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
return getUniverse().getAnnotationExtractor().hasAnnotation(getWrappedWithoutResolve(), annotationClass);
return getUniverse().getAnnotationExtractor().hasAnnotation(getWrapped(), annotationClass);
}

@Override
public final <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
return getUniverse().getAnnotationExtractor().extractAnnotation(getWrappedWithoutResolve(), annotationClass, false);
return getUniverse().getAnnotationExtractor().extractAnnotation(getWrapped(), annotationClass, false);
}

@Override
public final <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass) {
return getUniverse().getAnnotationExtractor().extractAnnotation(getWrappedWithoutResolve(), annotationClass, true);
return getUniverse().getAnnotationExtractor().extractAnnotation(getWrapped(), annotationClass, true);
}

@Override
public final Annotation[] getAnnotations() {
return getUniverse().getAnnotationExtractor().extractAnnotations(getWrappedWithoutResolve(), false);
return getUniverse().getAnnotationExtractor().extractAnnotations(getWrapped(), false);
}

@Override
public final Annotation[] getDeclaredAnnotations() {
return getUniverse().getAnnotationExtractor().extractAnnotations(getWrappedWithoutResolve(), true);
return getUniverse().getAnnotationExtractor().extractAnnotations(getWrapped(), true);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ public boolean isUsedInComparison() {

@Override
public Field getJavaField() {
return OriginalFieldProvider.getJavaField(getUniverse().getOriginalSnippetReflection(), wrapped);
return OriginalFieldProvider.getJavaField(wrapped);
}

public void addAnalysisFieldObserver(AnalysisFieldObserver observer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public boolean registerAsImplementationInvoked(Object reason) {
* the method as invoked, it would have an unwanted side effect, where this method could
* return before the class gets marked as reachable.
*/
getDeclaringClass().registerAsReachable("declared method " + this.format("%H.%n(%p)") + " is registered as implementation invoked");
getDeclaringClass().registerAsReachable("declared method " + qualifiedName + " is registered as implementation invoked");
return AtomicUtils.atomicSetAndRun(this, reason, isImplementationInvokedUpdater, this::onReachable);
}

Expand Down Expand Up @@ -387,15 +387,15 @@ public boolean isIntrinsicMethod() {
* as in {@link AnalysisMethod#registerAsImplementationInvoked(Object)}.
*/
public boolean registerAsVirtualRootMethod() {
getDeclaringClass().registerAsReachable("declared method " + this.format("%H.%n(%p)") + " is registered as virtual root");
getDeclaringClass().registerAsReachable("declared method " + qualifiedName + " is registered as virtual root");
return AtomicUtils.atomicMark(this, isVirtualRootMethodUpdater);
}

/**
* Registers this method as a direct (special or static) root for the analysis.
*/
public boolean registerAsDirectRootMethod() {
getDeclaringClass().registerAsReachable("declared method " + this.format("%H.%n(%p)") + " is registered as direct root");
getDeclaringClass().registerAsReachable("declared method " + qualifiedName + " is registered as direct root");
return AtomicUtils.atomicMark(this, isDirectRootMethodUpdater);
}

Expand Down Expand Up @@ -534,7 +534,7 @@ public String getName() {

@Override
public WrappedSignature getSignature() {
return getUniverse().lookup(wrapped.getSignature(), getDeclaringClass());
return getUniverse().lookup(wrapped.getSignature(), getDeclaringClass().getWrappedWithResolve());
}

@Override
Expand Down Expand Up @@ -650,7 +650,7 @@ public ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR)

@Override
public ConstantPool getConstantPool() {
return getUniverse().lookup(wrapped.getConstantPool(), getDeclaringClass());
return getUniverse().lookup(wrapped.getConstantPool(), getDeclaringClass().getWrappedWithResolve());
}

@Override
Expand Down Expand Up @@ -730,7 +730,7 @@ public boolean equals(Object obj) {

@Override
public Executable getJavaMethod() {
return OriginalMethodProvider.getJavaMethod(getUniverse().getOriginalSnippetReflection(), wrapped);
return OriginalMethodProvider.getJavaMethod(wrapped);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,17 +844,16 @@ public boolean isWordType() {

@Override
public ResolvedJavaType getWrapped() {
return universe.substitutions.resolve(wrapped);
return wrapped;
}

@Override
public ResolvedJavaType getWrappedWithoutResolve() {
return wrapped;
public ResolvedJavaType getWrappedWithResolve() {
return universe.substitutions.resolve(wrapped);
}

@Override
public Class<?> getJavaClass() {
return OriginalClassProvider.getJavaClass(universe.getOriginalSnippetReflection(), wrapped);
return OriginalClassProvider.getJavaClass(wrapped);
}

@Override
Expand Down Expand Up @@ -938,8 +937,7 @@ public int getModifiers() {

@Override
public boolean isAssignableFrom(ResolvedJavaType other) {
ResolvedJavaType subst = universe.substitutions.resolve(((AnalysisType) other).wrapped);
return wrapped.isAssignableFrom(subst);
return wrapped.isAssignableFrom(((AnalysisType) other).getWrappedWithResolve());
}

@Override
Expand Down Expand Up @@ -1000,8 +998,7 @@ private static void collectSubtypes(AnalysisType baseType, Set<AnalysisType> res

@Override
public AnalysisType findLeastCommonAncestor(ResolvedJavaType otherType) {
ResolvedJavaType subst = universe.substitutions.resolve(((AnalysisType) otherType).wrapped);
return universe.lookup(wrapped.findLeastCommonAncestor(subst));
return universe.lookup(wrapped.findLeastCommonAncestor(((AnalysisType) otherType).getWrappedWithResolve()));
}

@Override
Expand Down Expand Up @@ -1124,11 +1121,11 @@ private AnalysisField[] initializeInstanceFields(boolean includeSuperclasses) {
return result;
}

private AnalysisField[] convertFields(ResolvedJavaField[] original, List<AnalysisField> list, boolean listIncludesSuperClassesFields) {
for (int i = 0; i < original.length; i++) {
if (!original[i].isInternal()) {
private AnalysisField[] convertFields(ResolvedJavaField[] originals, List<AnalysisField> list, boolean listIncludesSuperClassesFields) {
for (ResolvedJavaField original : originals) {
if (!original.isInternal() && universe.hostVM.platformSupported(original)) {
try {
AnalysisField aField = universe.lookup(original[i]);
AnalysisField aField = universe.lookup(original);
if (aField != null) {
if (listIncludesSuperClassesFields || aField.isStatic()) {
/*
Expand Down
Loading