Skip to content

Commit

Permalink
clarify we monitor call infopoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
teshull committed Oct 4, 2022
1 parent 5197abf commit d6cb820
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public String toString() {

private final DataSection dataSection = new DataSection();

private final EconomicSet<Infopoint> invalidDeoptimizationStates = EconomicSet.create(Equivalence.IDENTITY_WITH_SYSTEM_HASHCODE);
private final EconomicSet<Call> invalidCallDeoptimizationStates = EconomicSet.create(Equivalence.IDENTITY_WITH_SYSTEM_HASHCODE);
private final List<Infopoint> infopoints = new ArrayList<>();
private final List<SourceMapping> sourceMapping = new ArrayList<>();
private final List<DataPatch> dataPatches = new ArrayList<>();
Expand Down Expand Up @@ -318,7 +318,7 @@ public boolean equals(Object obj) {
Objects.equals(this.dataSection, that.dataSection) &&
Objects.equals(this.exceptionHandlers, that.exceptionHandlers) &&
Objects.equals(this.dataPatches, that.dataPatches) &&
Objects.equals(this.invalidDeoptimizationStates, that.invalidDeoptimizationStates) &&
Objects.equals(this.invalidCallDeoptimizationStates, that.invalidCallDeoptimizationStates) &&
Objects.equals(this.infopoints, that.infopoints) &&
Objects.equals(this.marks, that.marks) &&
Arrays.equals(this.assumptions, that.assumptions) &&
Expand Down Expand Up @@ -605,14 +605,14 @@ public void addInfopoint(Infopoint infopoint) {
}

/**
* Mark that the provided infopoint cannot be used as a deoptimization entrypoint.
* Mark that the provided call infopoint cannot be used as a deoptimization entrypoint.
*
* This distinction is necessary as native-image, in addition to deoptimization support, uses
* infopoints for stack traces and debugging information.
* call infopoints for stack traces and debugging information.
*/
public void recordInvalidForDeoptimization(Infopoint infopoint) {
public void recordCallInvalidForDeoptimization(Call call) {
checkOpen();
invalidDeoptimizationStates.add(infopoint);
invalidCallDeoptimizationStates.add(call);
}

public void recordSourceMapping(int startOffset, int endOffset, NodeSourcePosition sourcePosition) {
Expand Down Expand Up @@ -684,8 +684,8 @@ public void addAnnotation(CodeAnnotation annotation) {
annotations.add(annotation);
}

public boolean isValidDeoptimizationState(Infopoint infopoint) {
return infopoint != null && !invalidDeoptimizationStates.contains(infopoint);
public boolean isValidCallDeoptimizationState(Call call) {
return call != null && !invalidCallDeoptimizationStates.contains(call);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,27 +352,27 @@ public boolean hasImplicitException(int pcOffset) {
/**
* Helper to mark invalid deoptimization state as needed.
*/
private void recordIfInvalidForDeoptimization(LIRFrameState info, Call infopoint) {
private void recordIfCallInvalidForDeoptimization(LIRFrameState info, Call call) {
if (info != null && !info.validForDeoptimization && info.hasDebugInfo()) {
DebugInfo debugInfo = info.debugInfo();
assert debugInfo != null;
if (debugInfo.hasFrame()) {
compilationResult.recordInvalidForDeoptimization(infopoint);
compilationResult.recordCallInvalidForDeoptimization(call);
}
}
}

public Call recordDirectCall(int posBefore, int posAfter, InvokeTarget callTarget, LIRFrameState info) {
DebugInfo debugInfo = info != null ? info.debugInfo() : null;
Call infopoint = compilationResult.recordCall(posBefore, posAfter - posBefore, callTarget, debugInfo, true);
recordIfInvalidForDeoptimization(info, infopoint);
return infopoint;
Call call = compilationResult.recordCall(posBefore, posAfter - posBefore, callTarget, debugInfo, true);
recordIfCallInvalidForDeoptimization(info, call);
return call;
}

public void recordIndirectCall(int posBefore, int posAfter, InvokeTarget callTarget, LIRFrameState info) {
DebugInfo debugInfo = info != null ? info.debugInfo() : null;
Call infopoint = compilationResult.recordCall(posBefore, posAfter - posBefore, callTarget, debugInfo, false);
recordIfInvalidForDeoptimization(info, infopoint);
recordIfCallInvalidForDeoptimization(info, infopoint);
}

public void recordInfopoint(int pos, LIRFrameState info, InfopointReason reason) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ protected boolean isDeoptEntry(ResolvedJavaMethod method, CompilationResult comp
* During call entrypoints must always be linked to a call.
*/
VMError.guarantee(infopoint instanceof Call, String.format("Unexpected infopoint type: %s\nFrame: %s", infopoint, topFrame));
return compilation.isValidDeoptimizationState(infopoint);
return compilation.isValidCallDeoptimizationState((Call) infopoint);
} else {
/*
* Other deoptimization entrypoints correspond to an DeoptEntryOp.
Expand Down

0 comments on commit d6cb820

Please sign in to comment.