1 23 24 25 package com.sun.jdo.api.persistence.enhancer.classfile; 26 27 28 import java.io.PrintStream ; 29 30 33 34 public class InsnIInc extends Insn { 35 36 37 private int localVarIndex; 38 39 40 private int value; 41 42 43 44 public int nStackArgs() { 45 return 0; 46 } 47 48 public int nStackResults() { 49 return 0; 50 } 51 52 55 public String argTypes() { 56 return ""; } 58 59 62 public String resultTypes() { 63 return ""; } 65 66 public boolean branches() { 67 return false; 68 } 69 70 73 public int varIndex() { 74 return localVarIndex; 75 } 76 77 80 public int incrValue() { 81 return value; 82 } 83 84 87 public InsnIInc (int localVarIndex, int value) { 88 this(localVarIndex, value, NO_OFFSET); 89 } 90 91 92 93 InsnIInc (int localVarIndex, int value, int pc) { 94 super(opc_iinc, pc); 95 96 this.localVarIndex = localVarIndex; 97 this.value =value; 98 } 99 100 void print (PrintStream out, int indent) { 101 ClassPrint.spaces(out, indent); 102 out.println(offset() + " opc_iinc " + localVarIndex + "," + value); } 105 106 int store(byte[] buf, int index) { 107 if (isWide()) 108 buf[index++] = (byte) opc_wide; 109 buf[index++] = (byte) opcode(); 110 if (isWide()) { 111 index = storeShort(buf, index, (short) localVarIndex); 112 index = storeShort(buf, index, (short) value); 113 } else { 114 buf[index++] = (byte)localVarIndex; 115 buf[index++] = (byte)value; 116 } 117 return index; 118 } 119 120 int size() { 121 return isWide() ? 6 : 3; 122 } 123 124 private boolean isWide() { 125 return (value > 127 || value < -128 || localVarIndex > 255); 126 } 127 128 } 129 | Popular Tags |