use of org.graalvm.compiler.hotspot.SnippetResolvedJavaMethod 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 SnippetResolvedJavaMethod || source instanceof SnippetResolvedJavaType) {
return source;
}
if (source instanceof MetaAccessProvider) {
dest = providerReplacements.getMetaAccessProvider();
} else if (source instanceof HotSpotJVMCIRuntime) {
throw new UnsupportedFeatureException("HotSpotJVMCIRuntime should not appear in the image: " + source);
} else if (source instanceof GraalHotSpotVMConfig) {
throw new UnsupportedFeatureException("GraalHotSpotVMConfig should not appear in the image: " + source);
} else if (source instanceof HotSpotBackendFactory) {
HotSpotBackendFactory factory = (HotSpotBackendFactory) source;
Architecture hostArch = HotSpotJVMCIRuntime.runtime().getHostJVMCIBackend().getTarget().arch;
if (!factory.getArchitecture().equals(hostArch.getClass())) {
throw new UnsupportedFeatureException("Non-host archtecture HotSpotBackendFactory should not appear in the image: " + source);
}
} else if (source instanceof GraalRuntime) {
dest = sGraalRuntime;
} else if (source instanceof AnalysisConstantReflectionProvider) {
dest = providerReplacements.getConstantReflectionProvider();
} else if (source instanceof AnalysisConstantFieldProvider) {
dest = providerReplacements.getConstantFieldProvider();
} else if (source instanceof ForeignCallsProvider) {
dest = providerReplacements.getForeignCallsProvider();
} else if (source instanceof SnippetReflectionProvider) {
dest = providerReplacements.getSnippetReflectionProvider();
} else if (source instanceof MetricKey) {
/* Ensure lazily initialized name fields are computed. */
((MetricKey) source).getName();
} else if (source instanceof NodeClass) {
/* Ensure lazily initialized shortName field is computed. */
((NodeClass<?>) source).shortName();
} else if (source instanceof HotSpotResolvedJavaMethod) {
throw new UnsupportedFeatureException(source.toString());
} else if (source instanceof HotSpotResolvedJavaField) {
throw new UnsupportedFeatureException(source.toString());
} else if (source instanceof HotSpotResolvedJavaType) {
throw new UnsupportedFeatureException(source.toString());
} else if (source instanceof HotSpotSignature) {
throw new UnsupportedFeatureException(source.toString());
} else if (source instanceof HotSpotObjectConstant) {
throw new UnsupportedFeatureException(source.toString());
} else if (source instanceof ResolvedJavaMethod && !(source instanceof SubstrateMethod)) {
dest = createMethod((ResolvedJavaMethod) source);
} else if (source instanceof ResolvedJavaField && !(source instanceof SubstrateField)) {
dest = createField((ResolvedJavaField) source);
} else if (source instanceof ResolvedJavaType && !(source instanceof SubstrateType)) {
dest = createType((ResolvedJavaType) source);
} else if (source instanceof FieldLocationIdentity && !(source instanceof SubstrateFieldLocationIdentity)) {
dest = createFieldLocationIdentity((FieldLocationIdentity) source);
}
assert dest != null;
String className = dest.getClass().getName();
assert SubstrateUtil.isBuildingLibgraal() || !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;
assert !SubstrateUtil.isBuildingLibgraal() || !className.contains(".svm.hosted.snippets.") : "Hosted snippet object in image " + className;
return dest;
}
Aggregations