changeset 13631:11c46696a655

Add probabilities to NewObjectSnippets.allocateInstanceDynamic
author Gilles Duboscq <duboscq@ssw.jku.at>
date Mon, 13 Jan 2014 10:46:52 +0100
parents b1838411e896
children 0f7d6359bdf3
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Tue Jan 14 10:14:31 2014 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Mon Jan 13 10:46:52 2014 +0100
@@ -151,8 +151,8 @@
     @Snippet
     public static Object allocateInstanceDynamic(Class<?> type, @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter String typeContext) {
         Word hub = loadWordFromObject(type, klassOffset());
-        if (!hub.equal(Word.zero())) {
-            if (isKlassFullyInitialized(hub)) {
+        if (probability(FAST_PATH_PROBABILITY, !hub.equal(Word.zero()))) {
+            if (probability(FAST_PATH_PROBABILITY, isKlassFullyInitialized(hub))) {
                 int layoutHelper = readLayoutHelper(hub);
                 /*
                  * src/share/vm/oops/klass.hpp: For instances, layout helper is a positive number,
@@ -160,7 +160,7 @@
                  * scaled to bytes. The low order bit is set if instances of this class cannot be
                  * allocated using the fastpath.
                  */
-                if ((layoutHelper & 1) == 0) {
+                if (probability(FAST_PATH_PROBABILITY, (layoutHelper & 1) == 0)) {
                     Word prototypeMarkWord = hub.readWord(prototypeMarkWordOffset(), PROTOTYPE_MARK_WORD_LOCATION);
                     return allocateInstance(layoutHelper, hub, prototypeMarkWord, fillContents, threadRegister, false, typeContext);
                 }