1 23 24 25 package com.sun.jdo.api.persistence.enhancer.classfile; 26 27 import java.io.PrintStream ; 28 29 32 33 public class InsnMultiDimArrayNew extends Insn { 34 35 private ConstClass classOp; 36 37 38 private int nDimsOp; 39 40 41 42 public boolean isSimpleLoad() { 43 return false; 44 } 45 46 public int nStackArgs() { 47 return nDimsOp; 48 } 49 50 public int nStackResults() { 51 return 1; 52 } 53 54 57 public String argTypes() { 58 StringBuffer buf = new StringBuffer (); 59 for (int i=0; i<nDimsOp; i++) { 60 buf.append("I"); } 62 return buf.toString(); 63 } 64 65 68 public String resultTypes() { 69 return "A"; } 71 72 public boolean branches() { 73 return false; 74 } 75 76 79 public ConstClass arrayClass() { 80 return classOp; 81 } 82 83 86 public void setArrayClass(ConstClass classOp) { 87 this.classOp = classOp; 88 } 89 90 93 public int nDims() { 94 return nDimsOp; 95 } 96 97 102 public InsnMultiDimArrayNew (ConstClass classOp, int nDimsOp) { 103 this(classOp, nDimsOp, NO_OFFSET); 104 } 105 106 107 108 InsnMultiDimArrayNew (ConstClass classOp, int nDimsOp, int offset) { 109 super(opc_multianewarray, offset); 110 111 this.classOp = classOp; 112 this.nDimsOp = nDimsOp; 113 114 if (classOp == null || nDimsOp < 1) 115 throw new InsnError ("attempt to create an opc_multianewarray" + " with invalid operands"); } 118 119 120 121 void print (PrintStream out, int indent) { 122 ClassPrint.spaces(out, indent); 123 out.println(offset() + " opc_multianewarray pool(" + classOp.getIndex() + ")," + nDimsOp); } 126 127 int store(byte[] buf, int index) { 128 buf[index++] = (byte) opcode(); 129 index = storeShort(buf, index, (short) classOp.getIndex()); 130 buf[index++] = (byte) nDimsOp; 131 return index; 132 } 133 134 int size() { 135 return 4; 136 } 137 138 static InsnMultiDimArrayNew read (InsnReadEnv insnEnv, int myPC) { 139 ConstClass classOp = (ConstClass) 140 insnEnv.pool().constantAt(insnEnv.getUShort()); 141 int nDims = insnEnv.getUByte(); 142 return new InsnMultiDimArrayNew(classOp, nDims, myPC); 143 } 144 145 } 146 | Popular Tags |