MCPcopy Create free account
hub / github.com/beanshell/beanshell / visitVarInsn

Method visitVarInsn

src/bsh/org/objectweb/asm/CodeWriter.java:600–643  ·  view source on GitHub ↗
(final int opcode, final int var)

Source from the content-addressed store, hash-verified

598 }
599
600 public void visitVarInsn (final int opcode, final int var) {
601 if (computeMaxs) {
602 // updates current and max stack sizes
603 if (opcode == Constants.RET) {
604 // no stack change, but end of current block (no successor)
605 if (currentBlock != null) {
606 currentBlock.maxStackSize = maxStackSize;
607 currentBlock = null;
608 }
609 } else { // xLOAD or xSTORE
610 int size = stackSize + SIZE[opcode];
611 if (size > maxStackSize) {
612 maxStackSize = size;
613 }
614 stackSize = size;
615 }
616 // updates max locals
617 int n;
618 if (opcode == Constants.LLOAD || opcode == Constants.DLOAD ||
619 opcode == Constants.LSTORE || opcode == Constants.DSTORE)
620 {
621 n = var + 2;
622 } else {
623 n = var + 1;
624 }
625 if (n > maxLocals) {
626 maxLocals = n;
627 }
628 }
629 // adds the instruction to the bytecode of the method
630 if (var < 4 && opcode != Constants.RET) {
631 int opt;
632 if (opcode < Constants.ISTORE) {
633 opt = 26 /*ILOAD_0*/ + ((opcode - Constants.ILOAD) << 2) + var;
634 } else {
635 opt = 59 /*ISTORE_0*/ + ((opcode - Constants.ISTORE) << 2) + var;
636 }
637 code.put1(opt);
638 } else if (var >= 256) {
639 code.put1(196 /*WIDE*/).put12(opcode, var);
640 } else {
641 code.put11(opcode, var);
642 }
643 }
644
645 public void visitTypeInsn (final int opcode, final String desc) {
646 if (computeMaxs && opcode == Constants.NEW) {

Callers

nothing calls this directly

Calls 3

put1Method · 0.80
put12Method · 0.80
put11Method · 0.80

Tested by

no test coverage detected