use of com.oracle.svm.graal.meta.SubstrateMethod in project graal by oracle.
the class RuntimeStrengthenStampsPhase method requireFrameInformationForMethod.
public SubstrateMethod requireFrameInformationForMethod(ResolvedJavaMethod method) {
AnalysisMethod aMethod = (AnalysisMethod) method;
SubstrateMethod sMethod = objectReplacer.createMethod(aMethod);
CompilationInfoSupport.singleton().registerFrameInformationRequired(aMethod);
return sMethod;
}
use of com.oracle.svm.graal.meta.SubstrateMethod in project graal by oracle.
the class RuntimeStrengthenStampsPhase method duringAnalysis.
@Override
public void duringAnalysis(DuringAnalysisAccess c) {
DuringAnalysisAccessImpl config = (DuringAnalysisAccessImpl) c;
GraalSupport.registerPhaseStatistics(config);
Deque<CallTreeNode> worklist = new ArrayDeque<>();
worklist.addAll(methods.values());
while (!worklist.isEmpty()) {
processMethod(worklist.removeFirst(), worklist, config.getBigBang());
}
SubstrateMethod[] methodsToCompileArr = new SubstrateMethod[methods.size()];
int idx = 0;
for (CallTreeNode node : methods.values()) {
methodsToCompileArr[idx++] = objectReplacer.createMethod(node.implementationMethod);
}
if (GraalSupport.setMethodsToCompile(methodsToCompileArr)) {
config.requireAnalysisIteration();
}
graphEncoder.finishPrepare();
AnalysisMetaAccess metaAccess = config.getMetaAccess();
NodeClass<?>[] nodeClasses = graphEncoder.getNodeClasses();
for (NodeClass<?> nodeClass : nodeClasses) {
metaAccess.lookupJavaType(nodeClass.getClazz()).registerAsAllocated(null);
}
if (GraalSupport.setGraphEncoding(graphEncoder.getEncoding(), graphEncoder.getObjects(), nodeClasses)) {
config.requireAnalysisIteration();
}
if (objectReplacer.updateDataDuringAnalysis(config.getMetaAccess())) {
config.requireAnalysisIteration();
}
}
use of com.oracle.svm.graal.meta.SubstrateMethod in project graal by oracle.
the class RuntimeStrengthenStampsPhase method prepareMethodForRuntimeCompilation.
public SubstrateMethod prepareMethodForRuntimeCompilation(ResolvedJavaMethod method, BeforeAnalysisAccessImpl config) {
AnalysisMethod aMethod = (AnalysisMethod) method;
SubstrateMethod sMethod = objectReplacer.createMethod(aMethod);
assert !methods.containsKey(aMethod);
methods.put(aMethod, new CallTreeNode(aMethod, aMethod, null, 0, ""));
config.registerAsInvoked(aMethod);
return sMethod;
}
use of com.oracle.svm.graal.meta.SubstrateMethod in project graal by oracle.
the class GraalObjectReplacer method createMethod.
public SubstrateMethod createMethod(ResolvedJavaMethod original) {
AnalysisMethod aMethod;
if (original instanceof AnalysisMethod) {
aMethod = (AnalysisMethod) original;
} else if (original instanceof HostedMethod) {
aMethod = ((HostedMethod) original).wrapped;
} else {
aMethod = aUniverse.lookup(original);
}
SubstrateMethod sMethod = methods.get(aMethod);
if (sMethod == null) {
assert !(original instanceof HostedMethod) : "too late to create new method";
sMethod = new SubstrateMethod(aMethod, stringTable);
methods.put(aMethod, sMethod);
/*
* The links to other meta objects must be set after adding to the methods to avoid
* infinite recursion.
*/
sMethod.setLinks(createSignature(aMethod.getSignature()), createType(aMethod.getDeclaringClass()));
/*
* Annotations are updated in every analysis iteration, but this is a starting point. It
* also ensures that all types used by annotations are created eagerly.
*/
sMethod.setAnnotationsEncoding(Inflation.encodeAnnotations(aMetaAccess, aMethod.getAnnotations(), null));
}
return sMethod;
}
use of com.oracle.svm.graal.meta.SubstrateMethod in project graal by oracle.
the class GraalObjectReplacer method registerImmutableObjects.
public void registerImmutableObjects(CompilationAccess access) {
for (SubstrateMethod method : methods.values()) {
access.registerAsImmutable(method);
access.registerAsImmutable(method.getRawImplementations());
access.registerAsImmutable(method.getEncodedLineNumberTable());
}
for (SubstrateField field : fields.values()) {
access.registerAsImmutable(field);
}
for (FieldLocationIdentity fieldLocationIdentity : fieldLocationIdentities.values()) {
access.registerAsImmutable(fieldLocationIdentity);
}
for (SubstrateType type : types.values()) {
access.registerAsImmutable(type);
access.registerAsImmutable(type.getRawInstanceFields());
}
for (SubstrateSignature signature : signatures.values()) {
access.registerAsImmutable(signature);
access.registerAsImmutable(signature.getRawParameterTypes());
}
}
Aggregations