Skip to content

Commit

Permalink
svm: ignore calltargets that are not in the image during lowering
Browse files Browse the repository at this point in the history
They must fold away later.
  • Loading branch information
zapster committed Jul 28, 2021
1 parent 2ae38c1 commit 06b409b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ public void lower(FixedNode node, LoweringTool tool) {
if (!SubstrateBackend.shouldEmitOnlyIndirectCalls()) {
loweredCallTarget = graph.add(new DirectCallTargetNode(parameters.toArray(new ValueNode[parameters.size()]),
callTarget.returnStamp(), signature, targetMethod, callType, invokeKind));
} else if (!targetMethod.hasCodeOffsetInImage()) {
/*
* The target method is not included in the image. This means that it was
* also not needed for the deoptimization entry point. Thus, we are certain
* that this branch will fold away. If not, we will fail later on.
*/
return;
} else {
/*
* In runtime-compiled code, we emit indirect calls via the respective heap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public interface SharedMethod extends ResolvedJavaMethod {
*/
Deoptimizer.StubType getDeoptStubType();

boolean hasCodeOffsetInImage();

int getCodeOffsetInImage();

int getDeoptOffsetInImage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ public void setSubstrateData(int vTableIndex, int codeOffsetInImage, int deoptOf
this.deoptOffsetInImage = deoptOffsetInImage;
}

@Override
public boolean hasCodeOffsetInImage() {
return codeOffsetInImage != 0;
}

@Override
public int getCodeOffsetInImage() {
assert codeOffsetInImage != 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ public void clear() {
staticAnalysisResults = null;
}

@Override
public boolean hasCodeOffsetInImage() {
throw unimplemented();
}

@Override
public int getCodeOffsetInImage() {
throw unimplemented();
Expand Down

0 comments on commit 06b409b

Please sign in to comment.