use of com.oracle.svm.hosted.meta.HostedType in project graal by oracle.
the class GraalObjectReplacer method updateSubstrateDataAfterCompilation.
/**
* Updates all relevant data from universe building. Object replacement is done during analysis.
* Therefore all substrate VM related data has to be updated after building the substrate
* universe.
*/
@SuppressWarnings("try")
public void updateSubstrateDataAfterCompilation(HostedUniverse hUniverse) {
for (Map.Entry<AnalysisType, SubstrateType> entry : types.entrySet()) {
AnalysisType aType = entry.getKey();
SubstrateType sType = entry.getValue();
if (!hUniverse.contains(aType)) {
continue;
}
HostedType hType = hUniverse.lookup(aType);
DynamicHub uniqueImplementation = null;
if (hType.getUniqueConcreteImplementation() != null) {
uniqueImplementation = hType.getUniqueConcreteImplementation().getHub();
}
sType.setTypeCheckData(hType.getInstanceOfFromTypeID(), hType.getInstanceOfNumTypeIDs(), uniqueImplementation);
SubstrateField[] originalFields = sType.getInstanceFields(false);
if (originalFields != null) {
/*
* What we do here is just a reordering of the instance fields array. The fields
* array already contains all the fields, but in the order of the AnalysisType. As
* the UniverseBuilder reorders the fields, we re-construct the fields array in the
* order of the HostedType. The correct order is essential for materialization
* during deoptimization.
*/
SubstrateField[] newFields = createFields(hType);
sType.setInstanceFields(newFields);
}
}
for (Map.Entry<AnalysisField, SubstrateField> entry : fields.entrySet()) {
AnalysisField aField = entry.getKey();
SubstrateField sField = entry.getValue();
HostedField hField = hUniverse.lookup(aField);
sField.setSubstrateData(hField.getLocation(), hField.isAccessed(), hField.isWritten(), hField.getConstantValue());
}
}
use of com.oracle.svm.hosted.meta.HostedType in project graal by oracle.
the class GraalObjectReplacer method createType.
public SubstrateType createType(JavaType original) {
if (original == null) {
return null;
}
AnalysisType aType;
if (original instanceof AnalysisType) {
aType = (AnalysisType) original;
} else {
aType = ((HostedType) original).getWrapped();
}
SubstrateType sType = types.get(aType);
if (sType == null) {
assert !(original instanceof HostedType) : "too late to create new type";
DynamicHub hub = ((SVMHost) aUniverse.hostVM()).dynamicHub(aType);
sType = new SubstrateType(aType.getJavaKind(), hub);
types.put(aType, sType);
hub.setMetaType(sType);
sType.setInstanceFields(createFields(aType));
createType(aType.getSuperclass());
createType(aType.getComponentType());
for (AnalysisType aInterface : aType.getInterfaces()) {
createType(aInterface);
}
}
return sType;
}
Aggregations