1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Pool.java Tue Sep 25 11:56:46 2012 +0100 1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Pool.java Tue Sep 25 13:06:58 2012 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -32,6 +32,7 @@ 1.11 import com.sun.tools.javac.code.Symbol; 1.12 import com.sun.tools.javac.code.Symbol.*; 1.13 import com.sun.tools.javac.code.Type; 1.14 +import com.sun.tools.javac.util.ArrayUtils; 1.15 import com.sun.tools.javac.util.Assert; 1.16 import com.sun.tools.javac.util.Filter; 1.17 import com.sun.tools.javac.util.Name; 1.18 @@ -91,14 +92,6 @@ 1.19 indices.clear(); 1.20 } 1.21 1.22 - /** Double pool buffer in size. 1.23 - */ 1.24 - private void doublePool() { 1.25 - Object[] newpool = new Object[pool.length * 2]; 1.26 - System.arraycopy(pool, 0, newpool, 0, pool.length); 1.27 - pool = newpool; 1.28 - } 1.29 - 1.30 /** Place an object in the pool, unless it is already there. 1.31 * If object is a symbol also enter its owner unless the owner is a 1.32 * package. Return the object's index in the pool. 1.33 @@ -114,10 +107,10 @@ 1.34 // System.err.println("put " + value + " " + value.getClass());//DEBUG 1.35 index = pp; 1.36 indices.put(value, index); 1.37 - if (pp == pool.length) doublePool(); 1.38 + pool = ArrayUtils.ensureCapacity(pool, pp); 1.39 pool[pp++] = value; 1.40 if (value instanceof Long || value instanceof Double) { 1.41 - if (pp == pool.length) doublePool(); 1.42 + pool = ArrayUtils.ensureCapacity(pool, pp); 1.43 pool[pp++] = null; 1.44 } 1.45 }