1 23 24 25 package com.sun.jdo.api.persistence.enhancer.classfile; 26 27 import java.io.PrintStream ; 28 29 32 33 public class InsnInterfaceInvoke extends InsnConstOp { 34 35 private int nArgsOp; 36 37 38 39 public int nStackArgs() { 40 return super.nStackArgs(); 41 } 42 43 public int nStackResults() { 44 return super.nStackResults(); 45 } 46 47 50 public String argTypes() { 51 return super.argTypes(); 52 } 53 54 57 public String resultTypes() { 58 return super.resultTypes(); 59 } 60 61 public boolean branches() { 62 return false; 63 } 64 65 68 public ConstInterfaceMethodRef method() { 69 return (ConstInterfaceMethodRef) value(); 70 } 71 72 75 public int nArgs() { 76 return nArgsOp; 77 } 78 79 82 public InsnInterfaceInvoke (ConstInterfaceMethodRef methodRefOp, 83 int nArgsOp) { 84 this(methodRefOp, nArgsOp, NO_OFFSET); 85 } 86 87 88 89 InsnInterfaceInvoke (ConstInterfaceMethodRef methodRefOp, int nArgsOp, 90 int offset) { 91 super(opc_invokeinterface, methodRefOp, offset); 92 93 this.nArgsOp = nArgsOp; 94 95 if (methodRefOp == null || nArgsOp < 0) 96 throw new InsnError ("attempt to create an opc_invokeinterface" + " with invalid operands"); } 99 100 void print (PrintStream out, int indent) { 101 ClassPrint.spaces(out, indent); 102 out.println(offset() + " opc_invokeinterface " + "pool(" + method().getIndex() + ")," + nArgsOp); } 105 106 int store(byte[] buf, int index) { 107 buf[index++] = (byte) opcode(); 108 index = storeShort(buf, index, (short)method().getIndex()); 109 buf[index++] = (byte) nArgsOp; 110 buf[index++] = (byte) 0; 111 return index; 112 } 113 114 int size() { 115 return 5; 116 } 117 118 static InsnInterfaceInvoke read(InsnReadEnv insnEnv, int myPC) { 119 ConstInterfaceMethodRef iface = (ConstInterfaceMethodRef) 120 insnEnv.pool().constantAt(insnEnv.getUShort()); 121 int nArgs = insnEnv.getUByte(); 122 insnEnv.getByte(); return new InsnInterfaceInvoke(iface, nArgs, myPC); 124 } 125 } 126 | Popular Tags |