Skip to content
This repository has been archived by the owner on Jan 27, 2019. It is now read-only.

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
yck1509 committed Oct 13, 2015
1 parent 873206e commit 2cb8427
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
5 changes: 5 additions & 0 deletions Confuser.Core/ConfuserContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ public ModuleDefMD CurrentModule {
/// <value>The output <c>byte[]</c> debug symbol.</value>
public byte[] CurrentModuleSymbol { get; internal set; }

/// <summary>
/// Gets the token used to indicate cancellation
/// </summary>
public CancellationToken CancellationToken { get { return token; } }

/// <summary>
/// Throws a System.OperationCanceledException if protection process has been canceled.
/// </summary>
Expand Down
18 changes: 1 addition & 17 deletions Confuser.Protections/Constants/ReferenceReplacer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,25 +373,9 @@ static void ReplaceCFG(MethodDef method, List<Tuple<Instruction, uint, IMethod>>
}

// Update state for blocks not in use
var done = new HashSet<ControlFlowBlock>();
var q = new Stack<ControlFlowBlock>(graph.Where(b => (b.Type & ControlFlowBlockType.Entry) != 0).Reverse());
while (q.Count > 0) {
var block = q.Pop();
if (done.Contains(block))
continue;
done.Add(block);

foreach (var succ in block.Targets)
q.Push(succ);

if (blockReferences.ContainsKey(block.Id))
continue;
InsertEmptyStateUpdate(cfgCtx, block);
}

for (int i = 0; i < graph.Count; i++) {
var block = graph[i];
if (done.Contains(block) || blockReferences.ContainsKey(block.Id))
if (blockReferences.ContainsKey(block.Id))
continue;
InsertEmptyStateUpdate(cfgCtx, block);
}
Expand Down

0 comments on commit 2cb8427

Please sign in to comment.