< prev index next >

src/hotspot/share/utilities/sizes.hpp

Print this page




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_UTILITIES_SIZES_HPP
  26 #define SHARE_VM_UTILITIES_SIZES_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "utilities/globalDefinitions.hpp"
  30 
  31 // The following two classes are used to represent 'sizes' and 'offsets' in the VM;
  32 // they serve as 'unit' types. ByteSize is used for sizes measured in bytes, while
  33 // WordSize is used for sizes measured in machine words (i.e., 32bit or 64bit words
  34 // depending on platform).
  35 //
  36 // The classes are defined with friend functions operating on them instead of member
  37 // functions so that they (the classes) can be re-#define'd to int types in optimized
  38 // mode. This allows full type checking and maximum safety in debug mode, and full
  39 // optimizations (constant folding) and zero overhead (time and space wise) in the
  40 // optimized build (some compilers do not optimize one-element value classes but
  41 // instead create an object in memory - thus the overhead may be significant).
  42 //
  43 // Note: 1) DO NOT add new overloaded friend functions that do not have a unique function
  44 //          function name but require signature types for resolution. This will not work
  45 //          in optimized mode as both, ByteSize and WordSize are mapped to the same type
  46 //          and thus the distinction would not be possible anymore (=> compiler errors).
  47 //
  48 //       2) DO NOT add non-static member functions as they cannot be mapped so something




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_UTILITIES_SIZES_HPP
  26 #define SHARE_VM_UTILITIES_SIZES_HPP
  27 

  28 #include "utilities/globalDefinitions.hpp"
  29 
  30 // The following two classes are used to represent 'sizes' and 'offsets' in the VM;
  31 // they serve as 'unit' types. ByteSize is used for sizes measured in bytes, while
  32 // WordSize is used for sizes measured in machine words (i.e., 32bit or 64bit words
  33 // depending on platform).
  34 //
  35 // The classes are defined with friend functions operating on them instead of member
  36 // functions so that they (the classes) can be re-#define'd to int types in optimized
  37 // mode. This allows full type checking and maximum safety in debug mode, and full
  38 // optimizations (constant folding) and zero overhead (time and space wise) in the
  39 // optimized build (some compilers do not optimize one-element value classes but
  40 // instead create an object in memory - thus the overhead may be significant).
  41 //
  42 // Note: 1) DO NOT add new overloaded friend functions that do not have a unique function
  43 //          function name but require signature types for resolution. This will not work
  44 //          in optimized mode as both, ByteSize and WordSize are mapped to the same type
  45 //          and thus the distinction would not be possible anymore (=> compiler errors).
  46 //
  47 //       2) DO NOT add non-static member functions as they cannot be mapped so something


< prev index next >