Skip to content

Commit 7235a53

Browse files
mi-acV8-internal LUCI CQ
authored andcommitted
[clean-up] Remove unused program reference for adoption
Bug: 465497343 Change-Id: I0b136da11c15bd83353c76fae8d1c168f92f5d34 Reviewed-on: https://chrome-internal-review.googlesource.com/c/v8/fuzzilli/+/9026976 Reviewed-by: Matthias Liedtke <mliedtke@google.com> Commit-Queue: Michael Achenbach <machenbach@google.com>
1 parent 6c60634 commit 7235a53

8 files changed

Lines changed: 18 additions & 18 deletions

File tree

Sources/Fuzzilli/Base/ProgramBuilder.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,15 +1397,15 @@ public class ProgramBuilder {
13971397

13981398
///
13991399
/// Adoption of variables from a different program.
1400-
/// Required when copying instructions between program.
1400+
/// Required when copying instructions between programs.
14011401
///
14021402
private var varMaps = [VariableMap<Variable>]()
14031403

1404-
/// Prepare for adoption of variables from the given program.
1404+
/// Prepare for adoption of variables from another program.
14051405
///
1406-
/// This sets up a mapping for variables from the given program to the
1406+
/// This sets up a mapping for variables from another program to the
14071407
/// currently constructed one to avoid collision of variable names.
1408-
public func beginAdoption(from program: Program) {
1408+
public func beginAdoption() {
14091409
varMaps.append(VariableMap())
14101410
}
14111411

@@ -1414,9 +1414,9 @@ public class ProgramBuilder {
14141414
varMaps.removeLast()
14151415
}
14161416

1417-
/// Executes the given block after preparing for adoption from the provided program.
1418-
public func adopting(from program: Program, _ block: () -> Void) {
1419-
beginAdoption(from: program)
1417+
/// Executes the given block after preparing for adoption.
1418+
public func adopting(_ block: () -> Void) {
1419+
beginAdoption()
14201420
block()
14211421
endAdoption()
14221422
}
@@ -1453,7 +1453,7 @@ public class ProgramBuilder {
14531453
/// This also renames any variable used in the given program so all variables
14541454
/// from the appended program refer to the same values in the current program.
14551455
public func append(_ program: Program) {
1456-
adopting(from: program) {
1456+
adopting() {
14571457
for instr in program.code {
14581458
adopt(instr)
14591459
}

Sources/Fuzzilli/Fuzzer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ public class Fuzzer {
547547

548548
let dummy = b.buildPlainFunction(with: .parameters(n: 0)) { _ in }
549549
var variablesToReplaceWithDummy = VariableSet()
550-
b.adopting(from: program) {
550+
b.adopting() {
551551
for instr in program.code {
552552
var removeInstruction = false
553553
switch instr.op.opcode {
@@ -644,7 +644,7 @@ public class Fuzzer {
644644

645645
// Third and final attempt at fixing up the program: simply wrap the entire program in a try-catch block.
646646
b.buildTryCatchFinally(tryBody: {
647-
b.adopting(from: program) {
647+
b.adopting() {
648648
for instr in program.code {
649649
b.adopt(instr)
650650
}

Sources/Fuzzilli/Mutators/BaseInstructionMutator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class BaseInstructionMutator: Mutator {
4040
toMutate.insert(chooseUniform(from: candidates))
4141
}
4242

43-
b.adopting(from: program) {
43+
b.adopting() {
4444
for instr in program.code {
4545
if toMutate.contains(instr.index) {
4646
mutate(instr, b)

Sources/Fuzzilli/Mutators/ExplorationMutator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public class ExplorationMutator: RuntimeAssistedMutator {
106106
// For that reason, we keep a stack of variables that still need to be explored. A variable in that stack is explored
107107
// when its entry is popped from the stack, which happens when the block end instruction is emitted.
108108
var pendingExploreStack = Stack<Variable?>()
109-
b.adopting(from: program) {
109+
b.adopting() {
110110
for instr in program.code {
111111
b.adopt(instr)
112112

@@ -205,7 +205,7 @@ public class ExplorationMutator: RuntimeAssistedMutator {
205205
}
206206

207207
// Now build the real program by replacing every Explore operation with the operation(s) that it actually performed at runtime.
208-
b.adopting(from: instrumentedProgram) {
208+
b.adopting() {
209209
for instr in instrumentedProgram.code {
210210
if let op = instr.op as? Explore {
211211
if let entry = actions[op.id], let action = entry {

Sources/Fuzzilli/Mutators/ProbingMutator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class ProbingMutator: RuntimeAssistedMutator {
7575
// the block that they are the output of is closed.
7676
var pendingProbesStack = Stack<Variable?>()
7777
let b = fuzzer.makeBuilder()
78-
b.adopting(from: program) {
78+
b.adopting() {
7979
for instr in program.code {
8080
b.adopt(instr)
8181

@@ -143,7 +143,7 @@ public class ProbingMutator: RuntimeAssistedMutator {
143143

144144
// Now build the final program by parsing the results and replacing the Probe operations
145145
// with FuzzIL operations that install one of the non-existent properties (if any).
146-
b.adopting(from: instrumentedProgram) {
146+
b.adopting() {
147147
for instr in instrumentedProgram.code {
148148
if let op = instr.op as? Probe {
149149
if let results = results[op.id] {

Sources/FuzzilliCli/Profiles/V8SandboxProfile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fileprivate struct SandboxFuzzingPostProcessor: FuzzingPostProcessor {
3737
}
3838
}
3939

40-
b.adopting(from: program) {
40+
b.adopting() {
4141
for instr in program.code {
4242
b.adopt(instr)
4343

Tests/FuzzilliTests/LifterTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3322,7 +3322,7 @@ class LifterTests: XCTestCase {
33223322
let _ = lifter.lift(prog)
33233323

33243324
// Now we build the mutated Program.
3325-
b.beginAdoption(from: prog)
3325+
b.beginAdoption()
33263326
for i in 0..<mutationIndex {
33273327
b.adopt(prog.code[i])
33283328
}

Tests/FuzzilliTests/MutatorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class MutatorTests: XCTestCase {
140140
let mutator = OperationMutator()
141141
for _ in 1...10 {
142142
let newBuilder = fuzzer.makeBuilder()
143-
newBuilder.adopting(from: prog) {
143+
newBuilder.adopting() {
144144
mutator.mutate(originalLoadInstruction[0], newBuilder)
145145
}
146146

0 commit comments

Comments
 (0)