Mercurial > hg > truffle
changeset 19491:4d66c000d253
Truffle/Instrumentation: more cleanup in Probe
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Wed, 18 Feb 2015 18:30:49 -0800 |
parents | 745ecef4c9cd |
children | 5a91549293df |
files | graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Probe.java |
diffstat | 1 files changed, 10 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Probe.java Wed Feb 18 18:07:48 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Probe.java Wed Feb 18 18:30:49 2015 -0800 @@ -81,6 +81,8 @@ */ private static final List<WeakReference<Probe>> probes = new ArrayList<>(); + @CompilationFinal private static SyntaxTagTrap tagTrap = null; + private static final class FindSourceVisitor implements NodeVisitor { Source source = null; @@ -184,7 +186,7 @@ for (WeakReference<Probe> ref : probes) { final Probe probe = ref.get(); if (probe != null) { - probe.setTrap(newTagTrap); + probe.notifyTrapSet(); } } } @@ -205,8 +207,7 @@ */ @CompilationFinal private Assumption probeStateUnchangedAssumption = probeStateUnchangedCyclic.getAssumption(); - // Must invalidate whenever either of these these changes. - @CompilationFinal private SyntaxTagTrap tagTrap = null; + // Must invalidate whenever this changes. @CompilationFinal private boolean isTrapActive = false; /** @@ -336,21 +337,13 @@ probeStateUnchangedCyclic.invalidate(); } - private void setTrap(SyntaxTagTrap newTagTrap) { - // No-op if same trap; traps are immutable - if (this.tagTrap != newTagTrap) { - if (newTagTrap == null) { - this.tagTrap = null; - if (isTrapActive) { - isTrapActive = false; - invalidateProbeUnchanged(); - } - } else { // new trap is non-null - this.tagTrap = newTagTrap; - this.isTrapActive = this.isTaggedAs(newTagTrap.getTag()); - invalidateProbeUnchanged(); - } + private void notifyTrapSet() { + if (tagTrap == null && !isTrapActive) { + // Special case, could be common, where we don't need to do anything. + return; } + this.isTrapActive = this.isTaggedAs(tagTrap.getTag()); + invalidateProbeUnchanged(); } private String getTagsDescription() {