private void fixTypes(byte[] code, TypedBlock[] blocks) throws NotFoundException, BadBytecode { ArrayList preOrder = new ArrayList(); int len = blocks.length; int index = 0; for (int i = 0; i < len; i++) { TypedBlock block = blocks[i]; if (block.alreadySet()) { // if block is not dead code int n = block.localsTypes.length; for (int j = 0; j < n; j++) index = block.localsTypes[j].dfs(preOrder, index, classPool); n = block.stackTop; for (int j = 0; j < n; j++) index = block.stackTypes[j].dfs(preOrder, index, classPool); } } }
private void findDeadCatchers(byte[] code, TypedBlock[] blocks) throws BadBytecode { int len = blocks.length; for (int i = 0; i < len; i++) { TypedBlock block = blocks[i]; if (!block.alreadySet()) { fixDeadcode(code, block); BasicBlock.Catch handler = block.toCatch; if (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (!tb.alreadySet()) { // tb is a handler that catches only the exceptions // thrown from dead code. recordStackMap(tb, handler.typeIndex); fixDeadcode(code, tb); tb.incoming = 1; } } } } }
private void findDeadCatchers(byte[] code, TypedBlock[] blocks) throws BadBytecode { int len = blocks.length; for (int i = 0; i < len; i++) { TypedBlock block = blocks[i]; if (!block.alreadySet()) { fixDeadcode(code, block); BasicBlock.Catch handler = block.toCatch; if (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (!tb.alreadySet()) { // tb is a handler that catches only the exceptions // thrown from dead code. recordStackMap(tb, handler.typeIndex); fixDeadcode(code, tb); tb.incoming = 1; } } } } }
private void fixTypes(byte[] code, TypedBlock[] blocks) throws NotFoundException, BadBytecode { List<TypeData> preOrder = new ArrayList<TypeData>(); int len = blocks.length; int index = 0; for (int i = 0; i < len; i++) { TypedBlock block = blocks[i]; if (block.alreadySet()) { // if block is not dead code int n = block.localsTypes.length; for (int j = 0; j < n; j++) index = block.localsTypes[j].dfs(preOrder, index, classPool); n = block.stackTop; for (int j = 0; j < n; j++) index = block.stackTypes[j].dfs(preOrder, index, classPool); } } }
private void traceException(byte[] code, TypedBlock.Catch handler) throws BadBytecode { while (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (tb.alreadySet()) { mergeMap(tb, false); if (tb.stackTop < 1) throw new BadBytecode("bad catch clause: " + handler.typeIndex); tb.stackTypes[0] = merge(toExceptionType(handler.typeIndex), tb.stackTypes[0]); } else { recordStackMap(tb, handler.typeIndex); MapMaker maker = new MapMaker(this); maker.make(code, tb); } handler = handler.next; } }
private void traceException(byte[] code, TypedBlock.Catch handler) throws BadBytecode { while (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (tb.alreadySet()) { mergeMap(tb, false); if (tb.stackTop < 1) throw new BadBytecode("bad catch clause: " + handler.typeIndex); tb.stackTypes[0] = merge(toExceptionType(handler.typeIndex), tb.stackTypes[0]); } else { recordStackMap(tb, handler.typeIndex); MapMaker maker = new MapMaker(this); maker.make(code, tb); } handler = handler.next; } }
private void make(byte[] code, TypedBlock tb) throws BadBytecode { copyTypeData(tb.stackTop, tb.stackTypes, stackTypes); stackTop = tb.stackTop; copyTypeData(tb.localsTypes.length, tb.localsTypes, localsTypes); traceException(code, tb.toCatch); int pos = tb.position; int end = pos + tb.length; while (pos < end) { pos += doOpcode(pos, code); traceException(code, tb.toCatch); } if (tb.exit != null) { for (int i = 0; i < tb.exit.length; i++) { TypedBlock e = (TypedBlock)tb.exit[i]; if (e.alreadySet()) mergeMap(e, true); else { recordStackMap(e); MapMaker maker = new MapMaker(this); maker.make(code, e); } } } }
private void make(byte[] code, TypedBlock tb) throws BadBytecode { copyTypeData(tb.stackTop, tb.stackTypes, stackTypes); stackTop = tb.stackTop; copyTypeData(tb.localsTypes.length, tb.localsTypes, localsTypes); traceException(code, tb.toCatch); int pos = tb.position; int end = pos + tb.length; while (pos < end) { pos += doOpcode(pos, code); traceException(code, tb.toCatch); } if (tb.exit != null) { for (int i = 0; i < tb.exit.length; i++) { TypedBlock e = (TypedBlock)tb.exit[i]; if (e.alreadySet()) mergeMap(e, true); else { recordStackMap(e); MapMaker maker = new MapMaker(this); maker.make(code, e); } } } }
private void fixTypes(byte[] code, TypedBlock[] blocks) throws NotFoundException, BadBytecode { ArrayList preOrder = new ArrayList(); int len = blocks.length; int index = 0; for (int i = 0; i < len; i++) { TypedBlock block = blocks[i]; if (block.alreadySet()) { // if block is not dead code int n = block.localsTypes.length; for (int j = 0; j < n; j++) index = block.localsTypes[j].dfs(preOrder, index, classPool); n = block.stackTop; for (int j = 0; j < n; j++) index = block.stackTypes[j].dfs(preOrder, index, classPool); } } }
private void fixTypes(byte[] code, TypedBlock[] blocks) throws NotFoundException, BadBytecode { ArrayList preOrder = new ArrayList(); int len = blocks.length; int index = 0; for (int i = 0; i < len; i++) { TypedBlock block = blocks[i]; if (block.alreadySet()) { // if block is not dead code int n = block.localsTypes.length; for (int j = 0; j < n; j++) index = block.localsTypes[j].dfs(preOrder, index, classPool); n = block.stackTop; for (int j = 0; j < n; j++) index = block.stackTypes[j].dfs(preOrder, index, classPool); } } }
private void fixTypes(byte[] code, TypedBlock[] blocks) throws NotFoundException, BadBytecode { ArrayList preOrder = new ArrayList(); int len = blocks.length; int index = 0; for (int i = 0; i < len; i++) { TypedBlock block = blocks[i]; if (block.alreadySet()) { // if block is not dead code int n = block.localsTypes.length; for (int j = 0; j < n; j++) index = block.localsTypes[j].dfs(preOrder, index, classPool); n = block.stackTop; for (int j = 0; j < n; j++) index = block.stackTypes[j].dfs(preOrder, index, classPool); } } }
private void findDeadCatchers(byte[] code, TypedBlock[] blocks) throws BadBytecode { int len = blocks.length; for (int i = 0; i < len; i++) { TypedBlock block = blocks[i]; if (!block.alreadySet()) { fixDeadcode(code, block); BasicBlock.Catch handler = block.toCatch; if (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (!tb.alreadySet()) { // tb is a handler that catches only the exceptions // thrown from dead code. recordStackMap(tb, handler.typeIndex); fixDeadcode(code, tb); tb.incoming = 1; } } } } }
private void findDeadCatchers(byte[] code, TypedBlock[] blocks) throws BadBytecode { int len = blocks.length; for (int i = 0; i < len; i++) { TypedBlock block = blocks[i]; if (!block.alreadySet()) { fixDeadcode(code, block); BasicBlock.Catch handler = block.toCatch; if (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (!tb.alreadySet()) { // tb is a handler that catches only the exceptions // thrown from dead code. recordStackMap(tb, handler.typeIndex); fixDeadcode(code, tb); tb.incoming = 1; } } } } }
private void findDeadCatchers(byte[] code, TypedBlock[] blocks) throws BadBytecode { int len = blocks.length; for (int i = 0; i < len; i++) { TypedBlock block = blocks[i]; if (!block.alreadySet()) { fixDeadcode(code, block); BasicBlock.Catch handler = block.toCatch; if (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (!tb.alreadySet()) { // tb is a handler that catches only the exceptions // thrown from dead code. recordStackMap(tb, handler.typeIndex); fixDeadcode(code, tb); tb.incoming = 1; } } } } }
private void traceException(byte[] code, TypedBlock.Catch handler) throws BadBytecode { TypedBlock tb = (TypedBlock)handler.body; if (tb.alreadySet()) mergeMap(tb, false); else { recordStackMap(tb, handler.typeIndex); MapMaker maker = new MapMaker(this, false); /* the following code is equivalent to maker.copyFrom(this) * except stackTypes are not copied. */ maker.stackTypes[0] = tb.stackTypes[0].getSelf(); maker.stackTop = 1; maker.make(code, tb); } }
private void traceException(byte[] code, TypedBlock.Catch handler) throws BadBytecode { TypedBlock tb = (TypedBlock)handler.body; if (tb.alreadySet()) mergeMap(tb, false); else { recordStackMap(tb, handler.typeIndex); MapMaker maker = new MapMaker(this, false); /* the following code is equivalent to maker.copyFrom(this) * except stackTypes are not copied. */ maker.stackTypes[0] = tb.stackTypes[0].getSelf(); maker.stackTop = 1; maker.make(code, tb); } }
private void make(byte[] code, TypedBlock tb) throws BadBytecode { BasicBlock.Catch handlers = tb.toCatch; while (handlers != null) { traceException(code, handlers); handlers = handlers.next; } int pos = tb.position; int end = pos + tb.length; while (pos < end) pos += doOpcode(pos, code); if (tb.exit != null) { for (int i = 0; i < tb.exit.length; i++) { TypedBlock e = (TypedBlock)tb.exit[i]; if (e.alreadySet()) mergeMap(e, true); else { recordStackMap(e); MapMaker maker = new MapMaker(this, true); maker.make(code, e); } } } }
private void traceException(byte[] code, TypedBlock.Catch handler) throws BadBytecode { while (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (tb.alreadySet()) { mergeMap(tb, false); if (tb.stackTop < 1) throw new BadBytecode("bad catch clause: " + handler.typeIndex); tb.stackTypes[0] = merge(toExceptionType(handler.typeIndex), tb.stackTypes[0]); } else { recordStackMap(tb, handler.typeIndex); MapMaker maker = new MapMaker(this); maker.make(code, tb); } handler = handler.next; } }
private void traceException(byte[] code, TypedBlock.Catch handler) throws BadBytecode { while (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (tb.alreadySet()) { mergeMap(tb, false); if (tb.stackTop < 1) throw new BadBytecode("bad catch clause: " + handler.typeIndex); tb.stackTypes[0] = merge(toExceptionType(handler.typeIndex), tb.stackTypes[0]); } else { recordStackMap(tb, handler.typeIndex); MapMaker maker = new MapMaker(this); maker.make(code, tb); } handler = handler.next; } }
private void traceException(byte[] code, TypedBlock.Catch handler) throws BadBytecode { while (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (tb.alreadySet()) { mergeMap(tb, false); if (tb.stackTop < 1) throw new BadBytecode("bad catch clause: " + handler.typeIndex); tb.stackTypes[0] = merge(toExceptionType(handler.typeIndex), tb.stackTypes[0]); } else { recordStackMap(tb, handler.typeIndex); MapMaker maker = new MapMaker(this); maker.make(code, tb); } handler = handler.next; } }