Mercurial > hg > truffle
changeset 5687:5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 22 Jun 2012 17:27:36 +0200 |
parents | 6cb39a47da14 |
children | 9bb0ba9e8ba6 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewInstanceSnippets.java |
diffstat | 1 files changed, 16 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewInstanceSnippets.java Fri Jun 22 17:16:57 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewInstanceSnippets.java Fri Jun 22 17:27:36 2012 +0200 @@ -98,14 +98,27 @@ } /** + * Maximum size of an object whose body is initialized by a sequence of + * zero-stores to its fields. Larger objects have their bodies initialized + * in a loop. + */ + private static final int MAX_UNROLLED_OBJECT_INITIALIZATION_SIZE = 10 * wordSize(); + + /** * Formats some allocated memory with an object header zeroes out the rest. */ private static void formatObject(Object hub, int size, Word memory, Word headerPrototype) { store(memory, 0, 0, headerPrototype); store(memory, 0, hubOffset(), hub); - explodeLoop(); - for (int offset = 2 * wordSize(); offset < size; offset += wordSize()) { - store(memory, 0, offset, 0); + if (size <= MAX_UNROLLED_OBJECT_INITIALIZATION_SIZE) { + explodeLoop(); + for (int offset = 2 * wordSize(); offset < size; offset += wordSize()) { + store(memory, 0, offset, 0); + } + } else { + for (int offset = 2 * wordSize(); offset < size; offset += wordSize()) { + store(memory, 0, offset, 0); + } } }