java - Splitting InsnList into basic blocks -
in asm tree api, have insnlist, containing list of instructions in method.
i want split basic blocks: sequence of instructions such each instruction except last 1 has 1 successor, , such no instruction except first 1 can target of jump.
how accomplish this?
in java 7+ stack frames included in method opcodes. iterate through method's insnlist , make blocks split each frameinsn.
example:
list<insnlist> l = lists.newlist(); insnlist il = new insnlist(); (abstractinsnnode ain : method.instructions.toarray()) { if (ain.gettype == abstractinsnnode.frame){ l.add(il); il = new insnlist(); } else { il.add(ain); } }
Comments
Post a Comment