You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by si...@apache.org on 2009/11/03 22:24:52 UTC

svn commit: r832565 - /lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java

Author: simonw
Date: Tue Nov  3 21:24:49 2009
New Revision: 832565

URL: http://svn.apache.org/viewvc?rev=832565&view=rev
Log:
Removed Dead code and legacy finalize method from MemoryIndexReader. The finalize method has been removed from IndexReader so subclasses do not need to override it. - Hackathon, reviewed by uschindler

Modified:
    lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java

Modified: lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java?rev=832565&r1=832564&r2=832565&view=diff
==============================================================================
--- lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (original)
+++ lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java Tue Nov  3 21:24:49 2009
@@ -730,9 +730,6 @@
       super(); // avoid as much superclass baggage as possible
     }
     
-    // lucene >= 1.9 or lucene-1.4.3 with patch removing "final" in superclass
-    protected void finalize() {}
-    
     private Info getInfo(String fieldName) {
       return fields.get(fieldName);
     }
@@ -1197,20 +1194,8 @@
      * Object header of any heap allocated Java object. 
      * ptr to class, info for monitor, gc, hash, etc.
      */
-//	private static final int OBJECT_HEADER = 2*4; // even on 64 bit VMs?
     private static final int OBJECT_HEADER = 2*PTR; 
 
-    /**
-	 * Modern VMs tend to trade space for time, allocating memory on word
-	 * boundaries. For example, on a 64 bit VM, the variables of a class with
-	 * one 32 bit integer and one Java char really consume 8 bytes instead of 6
-	 * bytes. 2 bytes are spent on padding. Similary, on a 64 bit VM a
-	 * java.lang.Integer consumes OBJECT_HEADER + 8 bytes rather than
-	 * OBJECT_HEADER + 4 bytes.
-	 */ 
-    private static final boolean IS_WORD_ALIGNED_VM = true;
-    
-    
     private VM() {} // not instantiable
 
     //  assumes n > 0
@@ -1219,10 +1204,7 @@
     //    1..8  --> 1*PTR
     //    9..16 --> 2*PTR
     private static int sizeOf(int n) {
-        return IS_WORD_ALIGNED_VM ?
-//              ((n-1)/PTR + 1) * PTR :               // slow version
-                (((n-1) >> LOG_PTR) + 1) << LOG_PTR : // fast version
-                n;
+        return (((n-1) >> LOG_PTR) + 1) << LOG_PTR;
     }
     
     public static int sizeOfObject(int n) {