use of com.oracle.svm.core.graal.nodes.SubstrateFieldLocationIdentity in project graal by oracle.
the class GraalObjectReplacer method apply.
@Override
public Object apply(Object source) {
if (source == null) {
return null;
}
Object dest = source;
if (source instanceof RelocatedPointer) {
return dest;
}
if (source instanceof MetaAccessProvider) {
dest = sMetaAccess;
} else if (source instanceof GraalRuntime) {
dest = sGraalRuntime;
} else if (source instanceof AnalysisConstantReflectionProvider) {
dest = sConstantReflectionProvider;
} else if (source instanceof AnalysisConstantFieldProvider) {
dest = sConstantFieldProvider;
} else if (source instanceof ForeignCallsProvider) {
dest = GraalSupport.getRuntimeConfig().getProviders().getForeignCalls();
} else if (source instanceof HostedSnippetReflectionProvider) {
dest = GraalSupport.getRuntimeConfig().getSnippetReflection();
} else if (shouldBeReplaced(source)) {
/*
* The hash maps must be synchronized, because replace() may be called from
* BigBang.finish(), which is multi-threaded.
*/
synchronized (this) {
if (source instanceof ResolvedJavaMethod) {
dest = createMethod((ResolvedJavaMethod) source);
} else if (source instanceof ResolvedJavaField) {
dest = createField((ResolvedJavaField) source);
} else if (source instanceof ResolvedJavaType) {
dest = createType((ResolvedJavaType) source);
} else if (source instanceof Signature) {
dest = createSignature((Signature) source);
} else if (source instanceof FieldLocationIdentity) {
dest = fieldLocationIdentities.get(source);
if (dest == null) {
SubstrateField destField = (SubstrateField) apply(((FieldLocationIdentity) source).getField());
dest = new SubstrateFieldLocationIdentity(destField);
fieldLocationIdentities.put((FieldLocationIdentity) source, (FieldLocationIdentity) dest);
}
}
}
}
assert dest != null;
String className = dest.getClass().getName();
assert !className.contains(".hotspot.") || className.contains(".svm.jtt.hotspot.") : "HotSpot object in image " + className;
assert !className.contains(".analysis.meta.") : "Analysis meta object in image " + className;
assert !className.contains(".hosted.meta.") : "Hosted meta object in image " + className;
return dest;
}
Aggregations