MCPcopy Create free account
hub / github.com/FabricMC/Matcher / queueTryCatchBlocks

Method queueTryCatchBlocks

src/main/java/matcher/type/Analysis.java:770–807  ·  view source on GitHub ↗
(MethodInstance method, StateRecorder rec, Queue<QueueElement> queue, Set<QueueElement> queued)

Source from the content-addressed store, hash-verified

768 }
769
770 private static boolean queueTryCatchBlocks(MethodInstance method, StateRecorder rec, Queue<QueueElement> queue, Set<QueueElement> queued) {
771 if (method.getAsmNode().tryCatchBlocks.isEmpty()) return false;
772
773 InsnList il = method.getAsmNode().instructions;
774 Set<ExecState> states = new HashSet<>();
775 boolean ret = false;
776
777 for (TryCatchBlockNode n : method.getAsmNode().tryCatchBlocks) {
778 ClassInstance type = n.type != null ? method.getEnv().getCreateClassInstance(ClassInstance.getId(n.type)) : method.getEnv().getCreateClassInstance("Ljava/lang/Throwable;");
779 ClassInstance[] stack = new ClassInstance[] { type };
780 int[] stackVarIds = new int[] { rec.getNextVarId(VarSource.ExtException) };
781
782 for (int idx = il.indexOf(n.start), max = il.indexOf(n.end); idx < max; idx++) {
783 ExecState state = rec.getState(idx);
784
785 if (state != null) {
786 states.add(new ExecState(Arrays.copyOf(state.locals, state.locals.length), Arrays.copyOf(state.localVarIds, state.locals.length), stack, stackVarIds));
787 }
788 }
789
790 if (states.isEmpty()) continue;
791
792 int dstIndex = il.indexOf(n.handler);
793
794 for (ExecState state : states) {
795 QueueElement e = new QueueElement(dstIndex, state);
796
797 if (queued.add(e)) {
798 queue.add(e);
799 ret = true;
800 }
801 }
802
803 states.clear();
804 }
805
806 return ret;
807 }
808
809 private static ClassInstance normalizeVarType(ClassInstance cls, CommonClasses common) {
810 if (!cls.isPrimitive()) return cls;

Callers 1

analyzeMethodMethod · 0.95

Calls 7

getIdMethod · 0.95
getNextVarIdMethod · 0.80
getStateMethod · 0.80
getEnvMethod · 0.65
getAsmNodeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected