Author: mrglavas
Date: Fri Jul  6 19:04:35 2012
New Revision: 1358350

URL: http://svn.apache.org/viewvc?rev=1358350&view=rev
Log:
Refactor addSymbol() methods into smaller methods. May help the JIT with 
inlining.

Modified:
    xerces/java/trunk/src/org/apache/xerces/util/SoftReferenceSymbolTable.java
    xerces/java/trunk/src/org/apache/xerces/util/SymbolTable.java

Modified: 
xerces/java/trunk/src/org/apache/xerces/util/SoftReferenceSymbolTable.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/util/SoftReferenceSymbolTable.java?rev=1358350&r1=1358349&r2=1358350&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/util/SoftReferenceSymbolTable.java 
(original)
+++ xerces/java/trunk/src/org/apache/xerces/util/SoftReferenceSymbolTable.java 
Fri Jul  6 19:04:35 2012
@@ -139,7 +139,10 @@ public class SoftReferenceSymbolTable ex
             }
             ++collisionCount;
         }
-        
+        return addSymbol0(symbol, bucket, collisionCount);
+    } // addSymbol(String):String
+    
+    private String addSymbol0(String symbol, int bucket, int collisionCount) {
         if (fCount >= fThreshold) {
             // Rehash the table if the threshold is exceeded
             rehash();
@@ -158,7 +161,7 @@ public class SoftReferenceSymbolTable ex
         fBuckets[bucket] = entry;
         ++fCount;
         return symbol;
-    } // addSymbol(String):String
+    } // addSymbol0(String,int,int):String
 
     /**
      * Adds the specified symbol to the symbol table and returns a
@@ -191,7 +194,10 @@ public class SoftReferenceSymbolTable ex
             }
             ++collisionCount;
         }
-        
+        return addSymbol0(buffer, offset, length, bucket, collisionCount);
+    } // addSymbol(char[],int,int):String
+    
+    private String addSymbol0(char[] buffer, int offset, int length, int 
bucket, int collisionCount) {
         if (fCount >= fThreshold) {
             // Rehash the table if the threshold is exceeded
             rehash();
@@ -210,7 +216,7 @@ public class SoftReferenceSymbolTable ex
         fBuckets[bucket] = entry;
         ++fCount;
         return symbol;
-    } // addSymbol(char[],int,int):String
+    } // addSymbol0(char[],int,int,int,int):String
 
     /**
      * Increases the capacity of and internally reorganizes this 

Modified: xerces/java/trunk/src/org/apache/xerces/util/SymbolTable.java
URL: 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/util/SymbolTable.java?rev=1358350&r1=1358349&r2=1358350&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/util/SymbolTable.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/util/SymbolTable.java Fri Jul  6 
19:04:35 2012
@@ -201,6 +201,11 @@ public class SymbolTable {
             }
             ++collisionCount;
         }
+        return addSymbol0(symbol, bucket, collisionCount);
+        
+    } // addSymbol(String):String
+    
+    private String addSymbol0(String symbol, int bucket, int collisionCount) {
         
         if (fCount >= fThreshold) {
             // Rehash the table if the threshold is exceeded
@@ -220,7 +225,7 @@ public class SymbolTable {
         ++fCount;
         return entry.symbol;
         
-    } // addSymbol(String):String
+    } // addSymbol0(String,int,int):String
 
     /**
      * Adds the specified symbol to the symbol table and returns a
@@ -249,6 +254,11 @@ public class SymbolTable {
             }
             ++collisionCount;
         }
+        return addSymbol0(buffer, offset, length, bucket, collisionCount);
+        
+    } // addSymbol(char[],int,int):String
+    
+    private String addSymbol0(char[] buffer, int offset, int length, int 
bucket, int collisionCount) {
         
         if (fCount >= fThreshold) {
             // Rehash the table if the threshold is exceeded
@@ -268,7 +278,7 @@ public class SymbolTable {
         ++fCount;
         return entry.symbol;
         
-    } // addSymbol(char[],int,int):String
+    } // addSymbol0(char[],int,int,int,int):String
 
     /**
      * Returns a hashcode value for the specified symbol. The value



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to