private Code readUnaryOp( int opcode, boolean wideBase, boolean wideRest, int offset, HashMap<Integer, Code.Label> labels) throws IOException { int operand = readBase(wideBase); int typeIdx = readRest(wideRest); Type type = typePool[typeIdx]; switch (opcode) { case Code.OPCODE_debug: return Code.Debug(operand); case Code.OPCODE_ifis: { int resultIdx = readRest(wideRest); Type result = typePool[resultIdx]; int target = readTarget(wideRest, offset); Code.Label l = findLabel(target, labels); return Code.IfIs(type, operand, result, l.label); } case Code.OPCODE_throw: return Code.Throw(type, operand); case Code.OPCODE_return: return Code.Return(type, operand); case Code.OPCODE_switch: { ArrayList<Pair<Constant, String>> cases = new ArrayList<Pair<Constant, String>>(); int target = readTarget(wideRest, offset); Code.Label defaultLabel = findLabel(target, labels); int nCases = readRest(wideRest); for (int i = 0; i != nCases; ++i) { int constIdx = readRest(wideRest); Constant constant = constantPool[constIdx]; target = readTarget(wideRest, offset); Code.Label l = findLabel(target, labels); cases.add(new Pair<Constant, String>(constant, l.label)); } return Code.Switch(type, operand, defaultLabel.label, cases); } } throw new RuntimeException("unknown opcode encountered (" + opcode + ")"); }