Mercurial > hg > truffle
diff truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/CoverageTracker.java @ 22093:0f0e34039769
Truffle/instrumentation: remove SourceTag machinery, not used so far. It will eventually be restored in the new API framework.
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Mon, 17 Aug 2015 15:24:00 -0700 |
parents | b2d1c8ff592a |
children | dc83cc1f94f2 3aad794eec0e |
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/CoverageTracker.java Mon Aug 17 17:40:00 2015 +0200 +++ b/truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/CoverageTracker.java Mon Aug 17 15:24:00 2015 -0700 @@ -40,9 +40,6 @@ * is specified, {@linkplain StandardSyntaxTag#STATEMENT STATEMENT} is used, corresponding to * conventional behavior for code coverage tools. * <p> - * No counts will be kept for execution in sources that hold the {@link SourceTag} - * {@link Tags#NO_COVERAGE}. - * <p> * <b>Tool Life Cycle</b> * <p> * See {@link InstrumentationTool} for the life cycle common to all such tools. @@ -73,30 +70,6 @@ */ public final class CoverageTracker extends InstrumentationTool { - public enum Tags implements SourceTag { - - /** - * Report no counts for sources holding this tag. - */ - NO_COVERAGE("No Coverage", "Coverage Tracker will igore"); - - private final String name; - private final String description; - - private Tags(String name, String description) { - this.name = name; - this.description = description; - } - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - } - /** Counting data. */ private final Map<LineLocation, CoverageRecord> coverageMap = new HashMap<>(); @@ -291,28 +264,28 @@ final SourceSection srcSection = probe.getProbedSourceSection(); if (srcSection == null) { // TODO (mlvdv) report this? - } else if (!srcSection.getSource().isTaggedAs(Tags.NO_COVERAGE)) { - // Get the source line where the - final LineLocation lineLocation = srcSection.getLineLocation(); - CoverageRecord record = coverageMap.get(lineLocation); - if (record != null) { - // Another node starts on same line; count only the first (textually) - if (srcSection.getCharIndex() > record.srcSection.getCharIndex()) { - // Existing record, corresponds to code earlier on line - return; - } else { - // Existing record, corresponds to code at a later position; replace it - record.instrument.dispose(); - } + return; + } + // Get the source line where the + final LineLocation lineLocation = srcSection.getLineLocation(); + CoverageRecord record = coverageMap.get(lineLocation); + if (record != null) { + // Another node starts on same line; count only the first (textually) + if (srcSection.getCharIndex() > record.srcSection.getCharIndex()) { + // Existing record, corresponds to code earlier on line + return; + } else { + // Existing record, corresponds to code at a later position; replace it + record.instrument.dispose(); } + } - final CoverageRecord coverage = new CoverageRecord(srcSection); - final Instrument instrument = Instrument.create(coverage, CoverageTracker.class.getSimpleName()); - coverage.instrument = instrument; - instruments.add(instrument); - probe.attach(instrument); - coverageMap.put(lineLocation, coverage); - } + final CoverageRecord coverage = new CoverageRecord(srcSection); + final Instrument instrument = Instrument.create(coverage, CoverageTracker.class.getSimpleName()); + coverage.instrument = instrument; + instruments.add(instrument); + probe.attach(instrument); + coverageMap.put(lineLocation, coverage); } } }