# HG changeset patch # User Doug Simon # Date 1339686202 -7200 # Node ID ff7961661b9691b28f13feebae5c27771f00237a # Parent f8eb2cb76a2f49bc4c0f70cb8d1cac0b940c70fb improved allocation tracing in NewInstanceSnippets diff -r f8eb2cb76a2f -r ff7961661b96 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewInstanceSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewInstanceSnippets.java Thu Jun 14 16:37:40 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewInstanceSnippets.java Thu Jun 14 17:03:22 2012 +0200 @@ -70,7 +70,7 @@ if (klassState != klassStateFullyInitialized()) { if (logType != null) { Log.print(logType); - Log.println(" - uninitialized"); + Log.println(" - uninit alloc"); } return NewInstanceStubCall.call(hub); } @@ -84,17 +84,21 @@ if (newTop.cmp(BE, end)) { Object instance = cast(top, Object.class); store(thread, 0, threadTlabTopOffset(), newTop); - return formatInstance(hub, size, instance, logType); - } else { + formatInstance(hub, size, instance); if (logType != null) { Log.print(logType); - Log.println(" - stub allocate"); + Log.print(" - fast alloc at "); + Log.printlnAddress(instance); } - return NewInstanceStubCall.call(hub); + return instance; } - } else { - return NewInstanceStubCall.call(hub); } + + if (logType != null) { + Log.print(logType); + Log.println(" - slow alloc"); + } + return NewInstanceStubCall.call(hub); } private static Word asWord(Object object) { @@ -108,7 +112,7 @@ /** * Formats the header of a created instance and zeroes out its body. */ - private static Object formatInstance(Object hub, int size, Object instance, String logType) { + private static void formatInstance(Object hub, int size, Object instance) { Word headerPrototype = cast(load(hub, 0, instanceHeaderPrototypeOffset(), wordKind()), Word.class); store(instance, 0, 0, headerPrototype); store(instance, 0, hubOffset(), hub); @@ -116,13 +120,6 @@ for (int offset = 2 * wordSize(); offset < size; offset += wordSize()) { store(instance, 0, offset, 0); } - if (logType != null) { - Log.print("allocated instance of "); - Log.print(logType); - Log.print(" at "); - Log.printlnAddress(instance); - } - return instance; } @Fold