harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r583506 - /harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
Date Wed, 10 Oct 2007 15:12:35 GMT
Author: gshimansky
Date: Wed Oct 10 08:12:35 2007
New Revision: 583506

URL: http://svn.apache.org/viewvc?rev=583506&view=rev
Log:
Applied patch from HARMONY-4923
[drlvm][em64t] Wrong change in HARMONY-4913


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h?rev=583506&r1=583505&r2=583506&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h Wed Oct 10 08:12:35 2007
@@ -1675,10 +1675,12 @@
      *         caller thread.*/
     ManagedObject* allocate_instance();
 
-    /** Calculates a size of the block allocated for the array, which is represented by 
+    /**
+	 * Calculates a size of the block allocated for the array, which is represented by 
      * the given class.
-     * @param[in] length - the length of the array
-     * @return The size of the array of specified length in bytes.*/
+     * @param[in] length the length of the array
+     * @return The size of the array of specified length in bytes, or 0 if the size is too
big.
+	 */
     unsigned calculate_array_size(int length) const {
         if (length < 0) {
             return 0;
@@ -1696,14 +1698,13 @@
 
         // check overflow, we need:
         // first_elem_offset + (length << m_array_element_shift)
-        //      + GC_OBJECT_ALIGNMENT < NEXT_TO_HIGH_BIT_CLEAR_MASK
+        //      + GC_OBJECT_ALIGNMENT < NEXT_TO_HIGH_BIT_SET_MASK
         //
-        if (((NEXT_TO_HIGH_BIT_CLEAR_MASK - GC_OBJECT_ALIGNMENT - first_elem_offset)
-                    >> m_array_element_shift) < (unsigned)length) {
+        if (((NEXT_TO_HIGH_BIT_SET_MASK - GC_OBJECT_ALIGNMENT - first_elem_offset)
+                    >> m_array_element_shift) <= (unsigned)length) {
             // zero means overflow
             return 0;
         }
-
 
         unsigned size = first_elem_offset + (length << m_array_element_shift);
         size = (((size + (GC_OBJECT_ALIGNMENT - 1)) & (~(GC_OBJECT_ALIGNMENT - 1))));



Mime
View raw message