private void createLabel(int labelKey) { mLabels.put(labelKey, (Object) labelKey); }
/** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or <tt>null</tt> * if there was no mapping for key. A <tt>null</tt> return can * also indicate that the IntHashMap previously associated * <tt>null</tt> with the specified key. */ public V put(Integer key, V value) { return put(key.intValue(), value); }
/** * Reconstitute the <tt>IntHashMap</tt> instance from a stream (i.e., * deserialize it). */ private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { // Read in the threshold, loadfactor, and any hidden stuff s.defaultReadObject(); // Read in number of buckets and allocate the bucket array; int numBuckets = s.readInt(); table = new Entry[numBuckets]; // Read in size (number of Mappings) int size = s.readInt(); // Read the keys and values, and put the mappings in the IntHashMap for (int i=0; i<size; i++) { int key = s.readInt(); V value = (V) s.readObject(); put(key, value); } }
private Label getLabel(int address) { int labelKey = address; Object labelValue = mLabels.get(labelKey); // labelValue will never be null unless gatherLabels is broken. if (!(labelValue instanceof Label)) { labelValue = mAssembler.createLabel(); mLabels.put(labelKey, labelValue); } return (Label)labelValue; } }
ExceptionHandler handler = mExceptionHandlers[i]; labelKey = handler.getStartLocation().getLocation(); mLabels.put(labelKey, (Object) labelKey); labelKey = handler.getEndLocation().getLocation(); mLabels.put(labelKey, (Object) labelKey); labelKey = handler.getCatchLocation().getLocation(); List<ExceptionHandler> list = mCatchLocations.get(labelKey); if (list == null) { list = new ArrayList<ExceptionHandler>(2); mCatchLocations.put(labelKey, list); case Opcode.IF_ICMPLE: labelKey = mAddress + readShort(); mLabels.put(labelKey, (Object) labelKey); break; case Opcode.JSR_W: labelKey = mAddress + readInt(); mLabels.put(labelKey, (Object) labelKey); break; mLabels.put(labelKey, (Object) labelKey); mLabels.put(labelKey, (Object) labelKey); mLabels.put(labelKey, (Object) labelKey);
private void createLabel(int labelKey) { mLabels.put(labelKey, (Object) labelKey); }
/** * Reserve an identifier for a method. * * @return new method identifier */ public synchronized int reserveMethod(boolean root, boolean graft) { int id = ++mNextId; if (root) { id |= 0x80000000; } if (graft) { id |= 0x40000000; } mMethodMap.put(id, null); return id; }
private void locateLabel() { int labelKey = mAddress; Object labelValue = mLabels.get(labelKey); if (labelValue != null) { if (labelValue instanceof Label) { ((Label)labelValue).setLocation(); } else { labelValue = mAssembler.createLabel().setLocation(); mLabels.put(labelKey, labelValue); } } List<ExceptionHandler> handlers = mCatchLocations.get(labelKey); if (handlers != null) { for (int i=0; i<handlers.size(); i++) { ExceptionHandler handler = handlers.get(i); Label start = getLabel(handler.getStartLocation().getLocation()); Label end = getLabel(handler.getEndLocation().getLocation()); String catchClassName; if (handler.getCatchType() == null) { catchClassName = null; } else { catchClassName = handler.getCatchType().getType().getFullName(); } mAssembler.exceptionHandler(start, end, catchClassName); } } }
/** * Associates the specified value with the specified key in this map. * If the map previously contained a mapping for this key, the old * value is replaced. * * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or <tt>null</tt> * if there was no mapping for key. A <tt>null</tt> return can * also indicate that the IntHashMap previously associated * <tt>null</tt> with the specified key. */ public V put(Integer key, V value) { return put(key.intValue(), value); }
/** * Reconstitute the <tt>IntHashMap</tt> instance from a stream (i.e., * deserialize it). */ private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { // Read in the threshold, loadfactor, and any hidden stuff s.defaultReadObject(); // Read in number of buckets and allocate the bucket array; int numBuckets = s.readInt(); table = new Entry[numBuckets]; // Read in size (number of Mappings) int size = s.readInt(); // Read the keys and values, and put the mappings in the IntHashMap for (int i=0; i<size; i++) { int key = s.readInt(); V value = (V) s.readObject(); put(key, value); } }
/** * Finish registering a method once it has been loaded. * * @param mid reserved method identifier * @param method method to assign to identifier * @throws IllegalStateException if id has already been registered or is unknown */ public synchronized void registerMethod(int mid, TracedMethod method) { if (mMethodMap.get(mid) == null && mMethodMap.containsKey(mid)) { mMethodMap.put(mid, method); } else { throw new IllegalStateException("Unknown mid: " + mid); } } }
private Label getLabel(int address) { int labelKey = address; Object labelValue = mLabels.get(labelKey); // labelValue will never be null unless gatherLabels is broken. if (!(labelValue instanceof Label)) { labelValue = mAssembler.createLabel(); mLabels.put(labelKey, labelValue); } return (Label)labelValue; } }
private MethodData getMethodData(int mid) { MethodData md = mMethodDataMap.get(mid); if (md == null) { md = new MethodData(mToolbox.getTracedMethod(mid)); mMethodDataMap.put(mid, md); mMethodDataSequence.add(md); } return md; } }
/** * Transfers gathered data to parent scope, or returns null if no * parent. */ Scope transferToParent() { Scope parent = mParent; if (parent != null) { for (MethodData md : mMethodDataSequence) { int mid = md.mMethod.getMethodId(); MethodData pmd = parent.mMethodDataMap.get(mid); if (pmd == null) { parent.mMethodDataMap.put(mid, md); parent.mMethodDataSequence.add(md); } else { md.transferToParent(pmd); } } } return parent; }
ExceptionHandler handler = mExceptionHandlers[i]; labelKey = handler.getStartLocation().getLocation(); mLabels.put(labelKey, (Object) labelKey); labelKey = handler.getEndLocation().getLocation(); mLabels.put(labelKey, (Object) labelKey); labelKey = handler.getCatchLocation().getLocation(); List<ExceptionHandler> list = mCatchLocations.get(labelKey); if (list == null) { list = new ArrayList<ExceptionHandler>(2); mCatchLocations.put(labelKey, list); case Opcode.IF_ICMPLE: labelKey = mAddress + readShort(); mLabels.put(labelKey, (Object) labelKey); break; case Opcode.JSR_W: labelKey = mAddress + readInt(); mLabels.put(labelKey, (Object) labelKey); break; mLabels.put(labelKey, (Object) labelKey); mLabels.put(labelKey, (Object) labelKey); mLabels.put(labelKey, (Object) labelKey);
mDecoders.put(generation, decoder);
mDecoders.put(generation, decoder);
private void locateLabel() { int labelKey = mAddress; Object labelValue = mLabels.get(labelKey); if (labelValue != null) { if (labelValue instanceof Label) { ((Label)labelValue).setLocation(); } else { labelValue = mAssembler.createLabel().setLocation(); mLabels.put(labelKey, labelValue); } } List<ExceptionHandler> handlers = mCatchLocations.get(labelKey); if (handlers != null) { for (int i=0; i<handlers.size(); i++) { ExceptionHandler handler = handlers.get(i); Label start = getLabel(handler.getStartLocation().getLocation()); Label end = getLabel(handler.getEndLocation().getLocation()); String catchClassName; if (handler.getCatchType() == null) { catchClassName = null; } else { catchClassName = handler.getCatchType().getType().getFullName(); } mAssembler.exceptionHandler(start, end, catchClassName); } } }