Skip to content

Commit

Permalink
Improve primitiveFlushCacheByMethod
Browse files Browse the repository at this point in the history
Invalidate the callTargetStable assumption to ensure that the method is removed from various caches.

Fixes https://twitter.com/trufflesqueak/status/1416064187030294530
  • Loading branch information
fniephaus committed Jul 17, 2021
1 parent 923798c commit 61d1957
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ protected void initializeCallTargetUnsafe() {
callTarget = Truffle.getRuntime().createCallTarget(rootNode);
}

public void flushCache() {
/* Invalidate callTargetStable assumption to ensure this method is released from caches. */
callTargetStable.invalidate("primitive 116");
}

public Assumption getCallTargetStable() {
return callTargetStable.getAssumption();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ protected abstract static class PrimFlushCacheByMethodNode extends AbstractPrimi
@Specialization(guards = "receiver.hasMethodClass(readNode)")
protected final CompiledCodeObject doFlush(final CompiledCodeObject receiver,
@CachedContext(SqueakLanguage.class) final SqueakImageContext image) {
receiver.flushCache();
image.flushMethodCacheForMethod(receiver);
/*
* TODO: maybe the method's callTarget could be invalidated to remove it from any PIC
Expand Down

0 comments on commit 61d1957

Please sign in to comment.