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

Method visitMethodInsn

src/bsh/org/objectweb/asm/CodeWriter.java:694–743  ·  view source on GitHub ↗
(
    final int opcode,
    final String owner,
    final String name,
    final String desc)

Source from the content-addressed store, hash-verified

692 }
693
694 public void visitMethodInsn (
695 final int opcode,
696 final String owner,
697 final String name,
698 final String desc)
699 {
700 Item i;
701 if (opcode == Constants.INVOKEINTERFACE) {
702 i = cw.newItfMethod(owner, name, desc);
703 } else {
704 i = cw.newMethod(owner, name, desc);
705 }
706 int argSize = i.intVal;
707 if (computeMaxs) {
708 // computes the stack size variation. In order not to recompute several
709 // times this variation for the same Item, we use the intVal field of
710 // this item to store this variation, once it has been computed. More
711 // precisely this intVal field stores the sizes of the arguments and of
712 // the return value corresponding to desc.
713 if (argSize == 0) {
714 // the above sizes have not been computed yet, so we compute them...
715 argSize = getArgumentsAndReturnSizes(desc);
716 // ... and we save them in order not to recompute them in the future
717 i.intVal = argSize;
718 }
719 int size;
720 if (opcode == Constants.INVOKESTATIC) {
721 size = stackSize - (argSize >> 2) + (argSize & 0x03) + 1;
722 } else {
723 size = stackSize - (argSize >> 2) + (argSize & 0x03);
724 }
725 // updates current and max stack sizes
726 if (size > maxStackSize) {
727 maxStackSize = size;
728 }
729 stackSize = size;
730 }
731 // adds the instruction to the bytecode of the method
732 if (opcode == Constants.INVOKEINTERFACE) {
733 if (!computeMaxs) {
734 if (argSize == 0) {
735 argSize = getArgumentsAndReturnSizes(desc);
736 i.intVal = argSize;
737 }
738 }
739 code.put12(Constants.INVOKEINTERFACE, i.index).put11(argSize >> 2, 0);
740 } else {
741 code.put12(opcode, i.index);
742 }
743 }
744
745 public void visitJumpInsn (final int opcode, final Label label) {
746 if (CHECK) {

Callers

nothing calls this directly

Calls 5

newItfMethodMethod · 0.80
newMethodMethod · 0.80
put11Method · 0.80
put12Method · 0.80

Tested by

no test coverage detected