Skip to content

Commit

Permalink
[GR-28209] Try to fix regression by restoring original invalidate not…
Browse files Browse the repository at this point in the history
…ification behavior.

PullRequest: graal/8059
  • Loading branch information
axel22 committed Jan 18, 2021
2 parents e65b367 + b96a059 commit 326f58b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public void setInstalledCode(InstalledCode code) {
}
if (installedCode.isAlive()) {
installedCode.invalidate();
onInvalidate(null, null, true);
}
// A default nmethod can be called from entry points in the VM (e.g., Method::_code)
// and so allowing it to be installed here would invalidate the truth of
Expand Down Expand Up @@ -119,10 +120,12 @@ public long getCodeAddress() {

@Override
public void onAssumptionInvalidated(Object source, CharSequence reason) {
boolean wasAlive = false;
if (installedCode.isAlive()) {
installedCode.invalidate();
runtime().getListener().onCompilationInvalidated(this, source, reason);
wasAlive = true;
}
onInvalidate(source, reason, wasAlive);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,14 @@ public final boolean computeBlockCompilations() {
return false;
}

public final boolean onInvalidate(Object source, CharSequence reason, boolean wasActive) {
cachedNonTrivialNodeCount = -1;
if (wasActive) {
GraalTruffleRuntime.getRuntime().getListener().onCompilationInvalidated(this, source, reason);
}
return cancelCompilation(reason) || wasActive;
}

@Override
public final void onCompilationFailed(Supplier<String> serializedException, boolean silent, boolean bailout, boolean permanentBailout, boolean graphTooBig) {
if (graphTooBig) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.graalvm.compiler.truffle.common.CompilableTruffleAST;
import org.graalvm.compiler.truffle.common.OptimizedAssumptionDependency;
import org.graalvm.compiler.truffle.common.TruffleCompiler;
import org.graalvm.compiler.truffle.runtime.GraalTruffleRuntime;
import org.graalvm.word.WordFactory;

import com.oracle.svm.core.annotate.Uninterruptible;
Expand All @@ -41,7 +40,6 @@
import com.oracle.svm.core.snippets.KnownIntrinsics;
import com.oracle.svm.core.thread.VMOperation;
import com.oracle.svm.core.util.VMError;
import com.oracle.truffle.api.Truffle;

import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.meta.ResolvedJavaMethod;
Expand All @@ -61,20 +59,21 @@ protected SubstrateOptimizedCallTargetInstalledCode(SubstrateOptimizedCallTarget
}

@Override
public void invalidate() {
public final void invalidate() {
CodeInfoTable.invalidateInstalledCode(this); // calls clearAddress
callTarget.onInvalidate(null, null, true);
}

@Override
public void onAssumptionInvalidated(Object source, CharSequence reason) {
boolean wasActive = false;
if (isAlive()) {
invalidate();

GraalTruffleRuntime runtime = (GraalTruffleRuntime) Truffle.getRuntime();
runtime.getListener().onCompilationInvalidated(callTarget, source, reason);
CodeInfoTable.invalidateInstalledCode(this); // calls clearAddress
wasActive = true;
} else {
assert !isValid() : "Cannot be valid but not alive";
}
callTarget.onInvalidate(source, reason, wasActive);
}

/**
Expand Down

0 comments on commit 326f58b

Please sign in to comment.