short[] (InstructionSequence seq) { int len = seq.length(); short[] inststates = new short[len]; Set<Integer> excSet = new HashSet<>(); for (ExceptionHandler handler : seq.getExceptionTable().getHandlers()) { excSet.add(handler.from_instr); excSet.add(handler.to_instr); excSet.add(handler.handler_instr); } for (int i = 0; i < len; i++) { // exception blocks if (excSet.contains(i)) { inststates[i] = 1; } Instruction instr = seq.getInstr(i); switch (instr.group) { case GROUP_JUMP: inststates[((JumpInstruction)instr).destination] = 1; case GROUP_RETURN: if (i + 1 < len) { inststates[i + 1] = 1; } break; case GROUP_SWITCH: SwitchInstruction swinstr = (SwitchInstruction)instr; int[] dests = swinstr.getDestinations(); for (int j = dests.length - 1; j >= 0; j--) { inststates[dests[j]] = 1; } inststates[swinstr.getDefaultDestination()] = 1; if (i + 1 < len) { inststates[i + 1] = 1; } } } // first instruction inststates[0] = 1; return inststates; }