private void fixDeadcode(byte[] code, TypedBlock block) throws BadBytecode { int pos = block.position; int len = block.length - 3; if (len < 0) { // if the dead-code length is shorter than 3 bytes. if (len == -1) code[pos] = Bytecode.NOP; code[pos + block.length - 1] = (byte)Bytecode.ATHROW; block.incoming = 1; recordStackMap(block, 0); return; } // if block.incomping > 0, all the incoming edges are from // other dead code blocks. So set block.incoming to 0. block.incoming = 0; for (int k = 0; k < len; k++) code[pos + k] = Bytecode.NOP; code[pos + len] = (byte)Bytecode.GOTO; ByteArray.write16bit(-len, code, pos + len + 1); }
private void fixDeadcode(byte[] code, TypedBlock block) throws BadBytecode { int pos = block.position; int len = block.length - 3; if (len < 0) { // if the dead-code length is shorter than 3 bytes. if (len == -1) code[pos] = Bytecode.NOP; code[pos + block.length - 1] = (byte)Bytecode.ATHROW; block.incoming = 1; recordStackMap(block, 0); return; } // if block.incomping > 0, all the incoming edges are from // other dead code blocks. So set block.incoming to 0. block.incoming = 0; for (int k = 0; k < len; k++) code[pos + k] = Bytecode.NOP; code[pos + len] = (byte)Bytecode.GOTO; ByteArray.write16bit(-len, code, pos + len + 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 { 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 fixDeadcode(byte[] code, TypedBlock block) throws BadBytecode { int pos = block.position; int len = block.length - 3; if (len < 0) { // if the dead-code length is shorter than 3 bytes. if (len == -1) code[pos] = Bytecode.NOP; code[pos + block.length - 1] = (byte)Bytecode.ATHROW; block.incoming = 1; recordStackMap(block, 0); return; } // if block.incomping > 0, all the incoming edges are from // other dead code blocks. So set block.incoming to 0. block.incoming = 0; for (int k = 0; k < len; k++) code[pos + k] = Bytecode.NOP; code[pos + len] = (byte)Bytecode.GOTO; ByteArray.write16bit(-len, code, pos + len + 1); }
private void fixDeadcode(byte[] code, TypedBlock block) throws BadBytecode { int pos = block.position; int len = block.length - 3; if (len < 0) { // if the dead-code length is shorter than 3 bytes. if (len == -1) code[pos] = Bytecode.NOP; code[pos + block.length - 1] = (byte)Bytecode.ATHROW; block.incoming = 1; recordStackMap(block, 0); return; } // if block.incomping > 0, all the incoming edges are from // other dead code blocks. So set block.incoming to 0. block.incoming = 0; for (int k = 0; k < len; k++) code[pos + k] = Bytecode.NOP; code[pos + len] = (byte)Bytecode.GOTO; ByteArray.write16bit(-len, code, pos + len + 1); }
private void fixDeadcode(byte[] code, TypedBlock block) throws BadBytecode { int pos = block.position; int len = block.length - 3; if (len < 0) { // if the dead-code length is shorter than 3 bytes. if (len == -1) code[pos] = Bytecode.NOP; code[pos + block.length - 1] = (byte)Bytecode.ATHROW; block.incoming = 1; recordStackMap(block, 0); return; } // if block.incomping > 0, all the incoming edges are from // other dead code blocks. So set block.incoming to 0. block.incoming = 0; for (int k = 0; k < len; k++) code[pos + k] = Bytecode.NOP; code[pos + len] = (byte)Bytecode.GOTO; ByteArray.write16bit(-len, code, pos + len + 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 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 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; } }
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); } } } }