BasicBlockCollection新增参数决定是否计算inLoop
parent
52fcf17161
commit
d60d0e02dd
|
@ -38,13 +38,20 @@ namespace Obfuz.Emit
|
|||
|
||||
public IList<BasicBlock> Blocks => _blocks;
|
||||
|
||||
public BasicBlockCollection(MethodDef method)
|
||||
public BasicBlockCollection(MethodDef method, bool computeInLoop)
|
||||
{
|
||||
_method = method;
|
||||
HashSet<Instruction> splitPoints = BuildSplitPoint(method);
|
||||
BuildBasicBlocks(method, splitPoints);
|
||||
BuildInOutGraph(method);
|
||||
if (computeInLoop)
|
||||
{
|
||||
ComputeBlocksInLoop();
|
||||
}
|
||||
}
|
||||
|
||||
public void ComputeBlocksInLoop()
|
||||
{
|
||||
var loopBlocks = FindLoopBlocks(_blocks);
|
||||
foreach (var block in loopBlocks)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,8 @@ namespace Obfuz.ObfusPasses
|
|||
{
|
||||
protected abstract bool NeedObfuscateMethod(MethodDef method);
|
||||
|
||||
protected virtual bool ComputeBlockInLoop => true;
|
||||
|
||||
public override void Process()
|
||||
{
|
||||
var ctx = ObfuscationPassContext.Current;
|
||||
|
@ -48,7 +50,7 @@ namespace Obfuz.ObfusPasses
|
|||
|
||||
private void ObfuscateData(MethodDef method)
|
||||
{
|
||||
BasicBlockCollection bbc = new BasicBlockCollection(method);
|
||||
BasicBlockCollection bbc = new BasicBlockCollection(method, ComputeBlockInLoop);
|
||||
|
||||
IList<Instruction> instructions = method.Body.Instructions;
|
||||
|
||||
|
|
Loading…
Reference in New Issue