Skip to content

Commit 41ae169

Browse files
simonreschoetr
authored andcommitted
chore: update internal jacoco version to 0.8.14
1 parent 1c0deb4 commit 41ae169

File tree

3 files changed

+28
-24
lines changed

3 files changed

+28
-24
lines changed

MODULE.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ http_archive(
199199
"//third_party:jacoco-make-probe-inserter-subclassable.patch",
200200
"//third_party:jacoco-ignore-offline-instrumentation.patch",
201201
],
202-
sha256 = "5c72dea2d13eef33a4d972d157186fc12d85149bc042186953efe1be50c220ee",
203-
strip_prefix = "jacoco-0.8.10",
204-
url = "https://github.com/jacoco/jacoco/archive/refs/tags/v0.8.10.tar.gz",
202+
sha256 = "764d75713a41473241b2bb88a69f813f786c87c8a6a5e6f7372b819f70e90bd4",
203+
strip_prefix = "jacoco-0.8.14",
204+
url = "https://github.com/jacoco/jacoco/archive/refs/tags/v0.8.14.tar.gz",
205205
)
206206

207207
http_archive(

src/main/java/com/code_intelligence/jazzer/instrumentor/EdgeCoverageInstrumentor.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ class EdgeCoverageInstrumentor(
161161
maxLocals: Int,
162162
) {
163163
val newMaxStack = max(maxStack + strategy.instrumentControlFlowEdgeStackSize, strategy.loadLocalVariableStackSize)
164-
val newMaxLocals = maxLocals + if (strategy.localVariableType != null) 1 else 0
164+
// Since JaCoCo 0.8.11, ProbeInserter reserves two local variable slots immediately
165+
// after the method parameters: a "safety slot" and the probe array itself.
166+
// See: https://github.com/jacoco/jacoco/commit/1a1db3bc1e51d6320ed8eb7da086ad401aef1ff7
167+
val newMaxLocals = maxLocals + if (strategy.localVariableType != null) 2 else 0
165168
mv.visitMaxs(newMaxStack, newMaxLocals)
166169
}
167170

third_party/jacoco-make-probe-inserter-subclassable.patch

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ index 00000000..19c2a7e2
6464
+ MethodVisitor mv, IProbeArrayStrategy arrayStrategy);
6565
+}
6666
diff --git org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java
67-
index 0f5b99ff..80965dfe 100644
67+
index a00894d0..cc32839c 100644
6868
--- org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java
6969
+++ org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java
70-
@@ -25,7 +25,7 @@ import org.objectweb.asm.TypePath;
71-
* addition the probe array has to be retrieved at the beginning of the method
72-
* and stored in a local variable.
70+
@@ -31,7 +31,7 @@ import org.objectweb.asm.TypePath;
71+
* "https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.10.2.3">a
72+
* value of type long or double which occupy two variables</a>.
7373
*/
7474
-class ProbeInserter extends MethodVisitor implements IProbeInserter {
7575
+public class ProbeInserter extends MethodVisitor implements IProbeInserter {
@@ -85,7 +85,7 @@ index 0f5b99ff..80965dfe 100644
8585

8686
/** Label for the new beginning of the method */
8787
private final Label beginLabel;
88-
@@ -56,7 +56,7 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
88+
@@ -65,7 +65,7 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
8989
* callback to create the code that retrieves the reference to
9090
* the probe array
9191
*/
@@ -94,7 +94,7 @@ index 0f5b99ff..80965dfe 100644
9494
final MethodVisitor mv, final IProbeArrayStrategy arrayStrategy) {
9595
super(InstrSupport.ASM_API_VERSION, mv);
9696
this.clinit = InstrSupport.CLINIT_NAME.equals(name);
97-
@@ -91,6 +91,10 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
97+
@@ -101,6 +101,12 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
9898
mv.visitInsn(Opcodes.BASTORE);
9999
}
100100

@@ -105,7 +105,7 @@ index 0f5b99ff..80965dfe 100644
105105
@Override
106106
public void visitCode() {
107107
mv.visitLabel(beginLabel);
108-
@@ -118,6 +122,10 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
108+
@@ -136,6 +142,11 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
109109
public AnnotationVisitor visitLocalVariableAnnotation(final int typeRef,
110110
final TypePath typePath, final Label[] start, final Label[] end,
111111
final int[] index, final String descriptor, final boolean visible) {
@@ -116,17 +116,17 @@ index 0f5b99ff..80965dfe 100644
116116
final int[] newIndex = new int[index.length];
117117
for (int i = 0; i < newIndex.length; i++) {
118118
newIndex[i] = map(index[i]);
119-
@@ -137,6 +145,9 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
119+
@@ -155,6 +166,9 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
120120
}
121121

122122
private int map(final int var) {
123123
+ if (getLocalVariableType() == null) {
124124
+ return var;
125125
+ }
126-
if (var < variable) {
126+
if (var < variable - 1) {
127127
return var;
128128
} else {
129-
@@ -153,13 +164,18 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
129+
@@ -171,6 +185,12 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
130130
"ClassReader.accept() should be called with EXPAND_FRAMES flag");
131131
}
132132

@@ -135,14 +135,15 @@ index 0f5b99ff..80965dfe 100644
135135
+ return;
136136
+ }
137137
+
138-
final Object[] newLocal = new Object[Math.max(nLocal, variable) + 1];
138+
final Object[] newLocal = new Object[Math.max(nLocal + 2,
139+
variable + 1)];
139140
int idx = 0; // Arrays index for existing locals
140-
int newIdx = 0; // Array index for new locals
141-
int pos = 0; // Current variable position
142-
while (idx < nLocal || pos <= variable) {
143-
if (pos == variable) {
144-
- newLocal[newIdx++] = InstrSupport.DATAFIELD_DESC;
145-
+ newLocal[newIdx++] = getLocalVariableType();
146-
pos++;
147-
} else {
148-
if (idx < nLocal) {
141+
@@ -186,7 +206,7 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter {
142+
newLocal[newIdx++] = Opcodes.TOP;
143+
pos++;
144+
}
145+
- newLocal[newIdx++] = InstrSupport.DATAFIELD_DESC;
146+
+ newLocal[newIdx++] = getLocalVariableType();
147+
if (idx < nLocal && safetySlotOccupied) {
148+
newLocal[newIdx++] = Opcodes.TOP;
149+
}

0 commit comments

Comments
 (0)