1 package com.sun.org.apache.bcel.internal.verifier.statics; 2 3 56 57 import com.sun.org.apache.bcel.internal.Constants; 58 import com.sun.org.apache.bcel.internal.generic.Type; 59 import com.sun.org.apache.bcel.internal.verifier.exc.*; 60 61 69 public class LocalVariablesInfo{ 70 71 72 private LocalVariableInfo[] localVariableInfos; 73 74 78 private IntList instruction_offsets = new IntList(); 79 80 81 LocalVariablesInfo(int max_locals){ 82 localVariableInfos = new LocalVariableInfo[max_locals]; 83 for (int i=0; i<max_locals; i++){ 84 localVariableInfos[i] = new LocalVariableInfo(); 85 } 86 } 87 88 89 public LocalVariableInfo getLocalVariableInfo(int slot){ 90 if (slot < 0 || slot >= localVariableInfos.length){ 91 throw new AssertionViolatedException("Slot number for local variable information out of range."); 92 } 93 return localVariableInfos[slot]; 94 } 95 96 102 public void add(int slot, String name, int startpc, int length, Type t) throws LocalVariableInfoInconsistentException{ 103 105 if (slot < 0 || slot >= localVariableInfos.length){ 106 throw new AssertionViolatedException("Slot number for local variable information out of range."); 107 } 108 109 localVariableInfos[slot].add(name, startpc, length, t); 110 if (t == Type.LONG) localVariableInfos[slot+1].add(name, startpc, length, LONG_Upper.theInstance()); 111 if (t == Type.DOUBLE) localVariableInfos[slot+1].add(name, startpc, length, DOUBLE_Upper.theInstance()); 112 } 113 } 114 | Popular Tags |