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; } }
public boolean contains(Object o) { return containsKey(o); } public boolean remove(Object o) {
public void clear() { IntHashMap.this.clear(); } };
private void gatherLabels() { mLabels = new IntHashMap<Object>(); mCatchLocations = new IntHashMap<List<ExceptionHandler>> (mExceptionHandlers.length * 2 + 1); int labelKey; 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);
private void gatherLabels() { mLabels = new IntHashMap<Object>(); mCatchLocations = new IntHashMap<List<ExceptionHandler>> (mExceptionHandlers.length * 2 + 1); int labelKey = handler.getCatchLocation().getLocation(); createLabel(labelKey); List<ExceptionHandler> list = mCatchLocations.get(labelKey); if (list == null) { list = new ArrayList<ExceptionHandler>(2); mCatchLocations.put(labelKey, list); Integer[] keys = new Integer[mLabels.size()]; mLabels.keySet().toArray(keys); Arrays.sort(keys); for (int i=0; i<keys.length; i++) { mLabels.put(keys[i], "L" + (i + 1) + '_' + keys[i]);
/** * 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 String getLabel(int address) { Object label = mLabels.get(new Integer(address)); if (label == null || (!(label instanceof String))) { return "L?_" + address; } else { return (String)label; } }
private void createLabel(int labelKey) { mLabels.put(labelKey, (Object) labelKey); }
public TracedMethodRegistry() { mMethodMap = new IntHashMap<TracedMethod>(); }
public boolean remove(Object o) { return IntHashMap.this.remove(o) != null; } public void clear() {
/** * Constructs a new map with the same mappings as the given map. The * map is created with a capacity of twice the number of mappings in * the given map or 11 (whichever is greater), and a default load factor, * which is <tt>0.75</tt>. */ public IntHashMap(Map<? extends Integer, ? extends V> t) { this(Math.max(2 * t.size(), 11), 0.75f); putAll(t); }
public boolean contains(Object o) { return containsValue(o); } public void clear() {
if (count >= threshold) { rehash();
IntHashMap decoders = mDecoders; if (decoders == null) { mDecoders = decoders = new IntHashMap(); Decoder<S> decoder = (Decoder<S>) decoders.get(generation); if (decoder == null) { synchronized (cCodecDecoders) { mDecoders.put(generation, decoder);
private void gatherLabels() { mLabels = new IntHashMap<Object>(); mCatchLocations = new IntHashMap<List<ExceptionHandler>> (mExceptionHandlers.length * 2 + 1); int labelKey = handler.getCatchLocation().getLocation(); createLabel(labelKey); List<ExceptionHandler> list = mCatchLocations.get(labelKey); if (list == null) { list = new ArrayList<ExceptionHandler>(2); mCatchLocations.put(labelKey, list); Integer[] keys = new Integer[mLabels.size()]; keys = mLabels.keySet().toArray(keys); Arrays.sort(keys); for (int i=0; i<keys.length; i++) { mLabels.put(keys[i], "L" + (i + 1) + '_' + keys[i]);
/** * Returns the value to which this map maps the specified key. Returns * <tt>null</tt> if the map contains no mapping for this key. A return * value of <tt>null</tt> does not <i>necessarily</i> indicate that the * map contains no mapping for the key; it's also possible that the map * explicitly maps the key to <tt>null</tt>. The <tt>containsKey</tt> * operation may be used to distinguish these two cases. * * @return the value to which this map maps the specified key. * @param key key whose associated value is to be returned. */ public V get(Integer key) { return get(key.intValue()); }
/** * 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); }
Scope(TraceToolbox toolbox, Scope parent, Thread thread) { mStartMillis = System.currentTimeMillis(); mToolbox = toolbox; mParent = parent; mThread = thread; mMethodDataMap = new IntHashMap<MethodData>(); mMethodDataSequence = new ArrayList<MethodData>(); }
/** * Removes the mapping for this key from this map if present. * * @param key key whose mapping is to be removed from the map. * @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 map previously associated <tt>null</tt> * with the specified key. */ public V remove(Integer key) { return remove(key.intValue()); }
/** * Constructs a new map with the same mappings as the given map. The * map is created with a capacity of twice the number of mappings in * the given map or 11 (whichever is greater), and a default load factor, * which is <tt>0.75</tt>. */ public IntHashMap(Map<? extends Integer, ? extends V> t) { this(Math.max(2 * t.size(), 11), 0.75f); putAll(t); }