Java Code Examples for com.sun.tools.javac.util.ArrayUtils#ensureCapacity()

The following examples show how to use com.sun.tools.javac.util.ArrayUtils#ensureCapacity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Pool.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Place an object in the pool, unless it is already there.
     *  If object is a symbol also enter its owner unless the owner is a
     *  package.  Return the object's index in the pool.
     */
    public int put(Object value) {
        value = makePoolValue(value);
//      assert !(value instanceof Type.TypeVar);
        Integer index = indices.get(value);
        if (index == null) {
//          System.err.println("put " + value + " " + value.getClass());//DEBUG
            index = pp;
            indices.put(value, index);
            pool = ArrayUtils.ensureCapacity(pool, pp);
            pool[pp++] = value;
            if (value instanceof Long || value instanceof Double) {
                pool = ArrayUtils.ensureCapacity(pool, pp);
                pool[pp++] = null;
            }
        }
        return index.intValue();
    }
 
Example 2
Source File: Pool.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** Place an object in the pool, unless it is already there.
     *  If object is a symbol also enter its owner unless the owner is a
     *  package.  Return the object's index in the pool.
     */
    public int put(Object value) {
        value = makePoolValue(value);
//      assert !(value instanceof Type.TypeVar);
        Integer index = indices.get(value);
        if (index == null) {
//          System.err.println("put " + value + " " + value.getClass());//DEBUG
            index = pp;
            indices.put(value, index);
            pool = ArrayUtils.ensureCapacity(pool, pp);
            pool[pp++] = value;
            if (value instanceof Long || value instanceof Double) {
                pool = ArrayUtils.ensureCapacity(pool, pp);
                pool[pp++] = null;
            }
        }
        return index.intValue();
    }
 
Example 3
Source File: Pool.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Place an object in the pool, unless it is already there.
     *  If object is a symbol also enter its owner unless the owner is a
     *  package.  Return the object's index in the pool.
     */
    public int put(Object value) {
        value = makePoolValue(value);
//      assert !(value instanceof Type.TypeVar);
        Integer index = indices.get(value);
        if (index == null) {
//          System.err.println("put " + value + " " + value.getClass());//DEBUG
            index = pp;
            indices.put(value, index);
            pool = ArrayUtils.ensureCapacity(pool, pp);
            pool[pp++] = value;
            if (value instanceof Long || value instanceof Double) {
                pool = ArrayUtils.ensureCapacity(pool, pp);
                pool[pp++] = null;
            }
        }
        return index.intValue();
    }
 
Example 4
Source File: Pool.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** Place an object in the pool, unless it is already there.
     *  If object is a symbol also enter its owner unless the owner is a
     *  package.  Return the object's index in the pool.
     */
    public int put(Object value) {
        value = makePoolValue(value);
//      assert !(value instanceof Type.TypeVar);
        Integer index = indices.get(value);
        if (index == null) {
//          System.err.println("put " + value + " " + value.getClass());//DEBUG
            index = pp;
            indices.put(value, index);
            pool = ArrayUtils.ensureCapacity(pool, pp);
            pool[pp++] = value;
            if (value instanceof Long || value instanceof Double) {
                pool = ArrayUtils.ensureCapacity(pool, pp);
                pool[pp++] = null;
            }
        }
        return index.intValue();
    }
 
Example 5
Source File: Pool.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/** Place an object in the pool, unless it is already there.
 *  If object is a symbol also enter its owner unless the owner is a
 *  package.  Return the object's index in the pool.
 */
public int put(Object value) {
    value = makePoolValue(value);
    Assert.check(!(value instanceof Type.TypeVar));
    Assert.check(!(value instanceof Types.UniqueType &&
                   ((UniqueType) value).type instanceof Type.TypeVar));
    Integer index = indices.get(value);
    if (index == null) {
        index = pp;
        indices.put(value, index);
        pool = ArrayUtils.ensureCapacity(pool, pp);
        pool[pp++] = value;
        if (value instanceof Long || value instanceof Double) {
            pool = ArrayUtils.ensureCapacity(pool, pp);
            pool[pp++] = null;
        }
    }
    return index.intValue();
}
 
Example 6
Source File: Pool.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** Place an object in the pool, unless it is already there.
     *  If object is a symbol also enter its owner unless the owner is a
     *  package.  Return the object's index in the pool.
     */
    public int put(Object value) {
        value = makePoolValue(value);
//      assert !(value instanceof Type.TypeVar);
        Integer index = indices.get(value);
        if (index == null) {
//          System.err.println("put " + value + " " + value.getClass());//DEBUG
            index = pp;
            indices.put(value, index);
            pool = ArrayUtils.ensureCapacity(pool, pp);
            pool[pp++] = value;
            if (value instanceof Long || value instanceof Double) {
                pool = ArrayUtils.ensureCapacity(pool, pp);
                pool[pp++] = null;
            }
        }
        return index.intValue();
    }
 
Example 7
Source File: Pool.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** Place an object in the pool, unless it is already there.
     *  If object is a symbol also enter its owner unless the owner is a
     *  package.  Return the object's index in the pool.
     */
    public int put(Object value) {
        value = makePoolValue(value);
//      assert !(value instanceof Type.TypeVar);
        Integer index = indices.get(value);
        if (index == null) {
//          System.err.println("put " + value + " " + value.getClass());//DEBUG
            index = pp;
            indices.put(value, index);
            pool = ArrayUtils.ensureCapacity(pool, pp);
            pool[pp++] = value;
            if (value instanceof Long || value instanceof Double) {
                pool = ArrayUtils.ensureCapacity(pool, pp);
                pool[pp++] = null;
            }
        }
        return index.intValue();
    }
 
Example 8
Source File: Pool.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/** Place an object in the pool, unless it is already there.
     *  If object is a symbol also enter its owner unless the owner is a
     *  package.  Return the object's index in the pool.
     */
    public int put(Object value) {
        value = makePoolValue(value);
//      assert !(value instanceof Type.TypeVar);
        Integer index = indices.get(value);
        if (index == null) {
//          System.err.println("put " + value + " " + value.getClass());//DEBUG
            index = pp;
            indices.put(value, index);
            pool = ArrayUtils.ensureCapacity(pool, pp);
            pool[pp++] = value;
            if (value instanceof Long || value instanceof Double) {
                pool = ArrayUtils.ensureCapacity(pool, pp);
                pool[pp++] = null;
            }
        }
        return index.intValue();
    }
 
Example 9
Source File: Pool.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/** Place an object in the pool, unless it is already there.
 *  If object is a symbol also enter its owner unless the owner is a
 *  package.  Return the object's index in the pool.
 */
public int put(Object value) {
    value = makePoolValue(value);
    Assert.check(!(value instanceof Type.TypeVar));
    Assert.check(!(value instanceof Types.UniqueType &&
                   ((UniqueType) value).type instanceof Type.TypeVar));
    Integer index = indices.get(value);
    if (index == null) {
        index = pp;
        indices.put(value, index);
        pool = ArrayUtils.ensureCapacity(pool, pp);
        pool[pp++] = value;
        if (value instanceof Long || value instanceof Double) {
            pool = ArrayUtils.ensureCapacity(pool, pp);
            pool[pp++] = null;
        }
    }
    return index.intValue();
}
 
Example 10
Source File: UnicodeReader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Append a character to sbuf.
 */
protected void putChar(char ch, boolean scan) {
    sbuf = ArrayUtils.ensureCapacity(sbuf, sp);
    sbuf[sp++] = ch;
    if (scan)
        scanChar();
}
 
Example 11
Source File: UnicodeReader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** Append a character to sbuf.
 */
protected void putChar(char ch, boolean scan) {
    sbuf = ArrayUtils.ensureCapacity(sbuf, sp);
    sbuf[sp++] = ch;
    if (scan)
        scanChar();
}
 
Example 12
Source File: UnicodeReader.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** Append a character to sbuf.
 */
protected void putChar(char ch, boolean scan) {
    sbuf = ArrayUtils.ensureCapacity(sbuf, sp);
    sbuf[sp++] = ch;
    if (scan)
        scanChar();
}
 
Example 13
Source File: UnicodeReader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Append a character to sbuf.
 */
protected void putChar(char ch, boolean scan) {
    sbuf = ArrayUtils.ensureCapacity(sbuf, sp);
    sbuf[sp++] = ch;
    if (scan)
        scanChar();
}
 
Example 14
Source File: UnicodeReader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** Append a character to sbuf.
 */
protected void putChar(char ch, boolean scan) {
    sbuf = ArrayUtils.ensureCapacity(sbuf, sp);
    sbuf[sp++] = ch;
    if (scan)
        scanChar();
}
 
Example 15
Source File: Flow.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Initialize new trackable variable by setting its address field
 *  to the next available sequence number and entering it under that
 *  index into the vars array.
 */
void newVar(JCVariableDecl varDecl) {
    VarSymbol sym = varDecl.sym;
    vardecls = ArrayUtils.ensureCapacity(vardecls, nextadr);
    if ((sym.flags() & FINAL) == 0) {
        sym.flags_field |= EFFECTIVELY_FINAL;
    }
    sym.adr = nextadr;
    vardecls[nextadr] = varDecl;
    inits.excl(nextadr);
    uninits.incl(nextadr);
    nextadr++;
}
 
Example 16
Source File: UnicodeReader.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Append a character to sbuf.
 */
protected void putChar(char ch, boolean scan) {
    sbuf = ArrayUtils.ensureCapacity(sbuf, sp);
    sbuf[sp++] = ch;
    if (scan)
        scanChar();
}
 
Example 17
Source File: UnicodeReader.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** Append a character to sbuf.
 */
protected void putChar(char ch, boolean scan) {
    sbuf = ArrayUtils.ensureCapacity(sbuf, sp);
    sbuf[sp++] = ch;
    if (scan)
        scanChar();
}
 
Example 18
Source File: UnicodeReader.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/** Append a character to sbuf.
 */
protected void putChar(char ch, boolean scan) {
    sbuf = ArrayUtils.ensureCapacity(sbuf, sp);
    sbuf[sp++] = ch;
    if (scan)
        scanChar();
}
 
Example 19
Source File: UnicodeReader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Append a character to sbuf.
 */
protected void putChar(char ch, boolean scan) {
    sbuf = ArrayUtils.ensureCapacity(sbuf, sp);
    sbuf[sp++] = ch;
    if (scan)
        scanChar();
}