Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove instrument(ClassReader) and analyzeClass(ClassReader) #850

Merged
merged 1 commit into from
Mar 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.jacoco.core.runtime.LoggerRuntime;
import org.jacoco.core.runtime.RuntimeData;
import org.jacoco.core.test.TargetLoader;
import org.objectweb.asm.ClassReader;

/**
* This scenario runs a given scenario twice and reports the execution time:
Expand All @@ -37,11 +36,11 @@ protected ExecuteInstrumentedCodeScenario(String description,
@Override
@SuppressWarnings("unchecked")
protected Callable<Void> getInstrumentedCallable() throws Exception {
ClassReader reader = new ClassReader(TargetLoader.getClassData(target));
IRuntime runtime = new LoggerRuntime();
runtime.startup(new RuntimeData());
final Instrumenter instr = new Instrumenter(runtime);
final byte[] instrumentedBuffer = instr.instrument(reader);
final byte[] original = TargetLoader.getClassDataAsBytes(target);
final byte[] instrumentedBuffer = instr.instrument(original, "");
final TargetLoader loader = new TargetLoader();

return (Callable<Void>) loader.add(target, instrumentedBuffer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.jacoco.core.runtime.IRuntime;
import org.jacoco.core.runtime.LoggerRuntime;
import org.jacoco.core.test.TargetLoader;
import org.objectweb.asm.ClassReader;

/**
* Scenario to measure the overhead in terms of additional byte code size
Expand All @@ -31,11 +30,11 @@ public InstrumentationSizeSzenario(Class<?> target) {

public void run(IPerfOutput output) throws Exception {
final IRuntime runtime = new LoggerRuntime();
ClassReader reader = new ClassReader(TargetLoader.getClassData(target));
final Instrumenter instr = new Instrumenter(runtime);
instr.instrument(reader);
output.writeByteResult("instrumented class",
instr.instrument(reader).length, reader.b.length);
final byte[] original = TargetLoader.getClassDataAsBytes(target);
final byte[] instrumented = instr.instrument(original, "");
output.writeByteResult("instrumented class", instrumented.length,
original.length);
}

}
10 changes: 0 additions & 10 deletions org.jacoco.core/src/org/jacoco/core/analysis/Analyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,6 @@ public void visitEnd() {
return new ClassProbesAdapter(analyzer, false);
}

/**
* Analyzes the class given as a ASM reader.
*
* @param reader
* reader with class definitions
*/
public void analyzeClass(final ClassReader reader) {
analyzeClass(reader.b);
}

private void analyzeClass(final byte[] source) {
final long classId = CRC64.classId(source);
final ClassReader reader = InstrSupport.classReaderFor(source);
Expand Down
12 changes: 0 additions & 12 deletions org.jacoco.core/src/org/jacoco/core/instr/Instrumenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,6 @@ public void setRemoveSignatures(final boolean flag) {
signatureRemover.setActive(flag);
}

/**
* Creates a instrumented version of the given class if possible.
*
* @param reader
* definition of the class as ASM reader
* @return instrumented definition
*
*/
public byte[] instrument(final ClassReader reader) {
return instrument(reader.b);
}

private byte[] instrument(final byte[] source) {
final long classId = CRC64.classId(source);
final ClassReader reader = InstrSupport.classReaderFor(source);
Expand Down
9 changes: 8 additions & 1 deletion org.jacoco.doc/docroot/doc/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@ <h1>Change History</h1>
<h2>Snapshot Build @qualified.bundle.version@ (@build.date@)</h2>

<h3>New Features</h3>

<ul>
<li>Branches added by the Kotlin compiler version 1.3.30 for suspending lambdas
and functions are filtered out during generation of report
(GitHub <a href="https://github.com/jacoco/jacoco/issues/849">#849</a>).</li>
</ul>

<h3>API Changes</h3>
<ul>
<li>Methods <code>Instrumenter.instrument(org.objectweb.asm.ClassReader)</code>
and <code>Analyzer.analyzeClass(org.objectweb.asm.ClassReader)</code>
were removed
(GitHub <a href="https://github.com/jacoco/jacoco/issues/850">#850</a>).</li>
</ul>

<h2>Release 0.8.3 (2019/01/23)</h2>

<h3>New Features</h3>
Expand Down