MCPcopy Create free account
hub / github.com/Youlor/unpacker / BasicBlock

Method BasicBlock

dexfixer/src/com/android/dx/rop/code/BasicBlock.java:59–113  ·  view source on GitHub ↗

Constructs an instance. The predecessor set is set to null. @param label >= 0; target label for this block @param insns non-null; list of instructions in this block @param successors non-null; full list of successors that this block may branch to @param primarySucces

(int label, InsnList insns, IntList successors,
                      int primarySuccessor)

Source from the content-addressed store, hash-verified

57 * unconditional throw)
58 */
59 public BasicBlock(int label, InsnList insns, IntList successors,
60 int primarySuccessor) {
61 if (label < 0) {
62 throw new IllegalArgumentException("label < 0");
63 }
64
65 try {
66 insns.throwIfMutable();
67 } catch (NullPointerException ex) {
68 // Elucidate exception.
69 throw new NullPointerException("insns == null");
70 }
71
72 int sz = insns.size();
73
74 if (sz == 0) {
75 throw new IllegalArgumentException("insns.size() == 0");
76 }
77
78 for (int i = sz - 2; i >= 0; i--) {
79 Rop one = insns.get(i).getOpcode();
80 if (one.getBranchingness() != Rop.BRANCH_NONE) {
81 throw new IllegalArgumentException("insns[" + i + "] is a " +
82 "branch or can throw");
83 }
84 }
85
86 Insn lastInsn = insns.get(sz - 1);
87 if (lastInsn.getOpcode().getBranchingness() == Rop.BRANCH_NONE) {
88 throw new IllegalArgumentException("insns does not end with " +
89 "a branch or throwing " +
90 "instruction");
91 }
92
93 try {
94 successors.throwIfMutable();
95 } catch (NullPointerException ex) {
96 // Elucidate exception.
97 throw new NullPointerException("successors == null");
98 }
99
100 if (primarySuccessor < -1) {
101 throw new IllegalArgumentException("primarySuccessor < -1");
102 }
103
104 if (primarySuccessor >= 0 && !successors.contains(primarySuccessor)) {
105 throw new IllegalArgumentException(
106 "primarySuccessor " + primarySuccessor + " not in successors " + successors);
107 }
108
109 this.label = label;
110 this.insns = insns;
111 this.successors = successors;
112 this.primarySuccessor = primarySuccessor;
113 }
114
115 /**
116 * {@inheritDoc}

Callers

nothing calls this directly

Calls 7

getBranchingnessMethod · 0.95
getOpcodeMethod · 0.95
throwIfMutableMethod · 0.80
sizeMethod · 0.65
getMethod · 0.65
getOpcodeMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected