use of org.graalvm.compiler.graph.VerificationError in project graal by oracle.
the class VerifyFrameDoesNotEscapePhase method run.
@Override
protected void run(StructuredGraph graph) {
for (NewFrameNode virtualFrame : graph.getNodes(NewFrameNode.TYPE)) {
for (MethodCallTargetNode callTarget : virtualFrame.usages().filter(MethodCallTargetNode.class)) {
if (callTarget.invoke() != null) {
String properties = callTarget.getDebugProperties().toString();
String arguments = callTarget.arguments().toString();
Throwable exception = new VerificationError("Frame escapes at: %s#%s\nproperties:%s\narguments: %s", callTarget, callTarget.targetMethod(), properties, arguments);
throw GraphUtil.approxSourceException(callTarget, exception);
}
}
}
}
use of org.graalvm.compiler.graph.VerificationError in project graal by oracle.
the class EnsureVirtualizedNode method virtualize.
@Override
public void virtualize(VirtualizerTool tool) {
ValueNode alias = tool.getAlias(object);
if (alias instanceof VirtualObjectNode) {
VirtualObjectNode virtual = (VirtualObjectNode) alias;
if (virtual instanceof VirtualBoxingNode) {
Throwable exception = new VerificationError("ensureVirtual is not valid for boxing objects: %s", virtual.type().getName());
throw GraphUtil.approxSourceException(this, exception);
}
if (!localOnly) {
tool.setEnsureVirtualized(virtual, true);
}
tool.delete();
}
}
use of org.graalvm.compiler.graph.VerificationError in project graal by oracle.
the class NodeCostUtil method phaseFulfillsSizeContract.
public static void phaseFulfillsSizeContract(StructuredGraph graph, int codeSizeBefore, int codeSizeAfter, PhaseSizeContract contract) {
sizeVerificationCount.increment(graph.getDebug());
final double codeSizeIncrease = contract.codeSizeIncrease();
final double graphSizeDelta = codeSizeBefore * DELTA;
if (deltaCompare(codeSizeAfter, codeSizeBefore * codeSizeIncrease, graphSizeDelta) > 0) {
ResolvedJavaMethod method = graph.method();
double increase = (double) codeSizeAfter / (double) codeSizeBefore;
throw new VerificationError("Phase %s expects to increase code size by at most a factor of %.2f but an increase of %.2f was seen (code size before: %d, after: %d)%s", contract.contractorName(), codeSizeIncrease, increase, codeSizeBefore, codeSizeAfter, method != null ? " when compiling method " + method.format("%H.%n(%p)") + "." : ".");
}
}
use of org.graalvm.compiler.graph.VerificationError in project graal by oracle.
the class EnsureVirtualizedNode method ensureVirtualFailure.
public static void ensureVirtualFailure(Node location, Stamp stamp) {
String additionalReason = "";
if (location instanceof FixedWithNextNode && !(location instanceof EnsureVirtualizedNode)) {
FixedWithNextNode fixedWithNextNode = (FixedWithNextNode) location;
FixedNode next = fixedWithNextNode.next();
if (next instanceof StoreFieldNode) {
additionalReason = " (must not store virtual object into a field)";
} else if (next instanceof Invoke) {
additionalReason = " (must not pass virtual object into an invoke that cannot be inlined)";
} else {
additionalReason = " (must not let virtual object escape at node " + next + ")";
}
}
Throwable exception = new VerificationError("Object of type %s should not be materialized%s:", StampTool.typeOrNull(stamp).getName(), additionalReason);
Node pos;
if (location instanceof FixedWithNextNode) {
pos = ((FixedWithNextNode) location).next();
} else if (location instanceof AbstractEndNode) {
pos = ((AbstractEndNode) location).merge();
} else {
pos = location;
}
throw GraphUtil.approxSourceException(pos, exception);
}
Aggregations