src/share/vm/utilities/globalDefinitions.hpp

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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 // This file holds all globally used constants & types, class (forward)
  26 // declarations and a few frequently used utility functions.
  27 
  28 //----------------------------------------------------------------------------------------------------
  29 // Constants
  30 
  31 const int LogBytesPerShort   = 1;
  32 const int LogBytesPerInt     = 2;
  33 #ifdef _LP64
  34 const int LogBytesPerWord    = 3;
  35 #else
  36 const int LogBytesPerWord    = 2;
  37 #endif
  38 const int LogBytesPerLong    = 3;
  39 
  40 const int BytesPerShort      = 1 << LogBytesPerShort;
  41 const int BytesPerInt        = 1 << LogBytesPerInt;
  42 const int BytesPerWord       = 1 << LogBytesPerWord;
  43 const int BytesPerLong       = 1 << LogBytesPerLong;
  44 


 287 //
 288 // Determines whether on-the-fly class replacement and frame popping are enabled.
 289 
 290 #define HOTSWAP
 291 
 292 //----------------------------------------------------------------------------------------------------
 293 // Object alignment, in units of HeapWords.
 294 //
 295 // Minimum is max(BytesPerLong, BytesPerDouble, BytesPerOop) / HeapWordSize, so jlong, jdouble and
 296 // reference fields can be naturally aligned.
 297 
 298 extern int MinObjAlignment;
 299 extern int MinObjAlignmentInBytes;
 300 extern int MinObjAlignmentInBytesMask;
 301 
 302 extern int LogMinObjAlignment;
 303 extern int LogMinObjAlignmentInBytes;
 304 
 305 // Machine dependent stuff
 306 
 307 #include "incls/_globalDefinitions_pd.hpp.incl"









 308 
 309 // The byte alignment to be used by Arena::Amalloc.  See bugid 4169348.
 310 // Note: this value must be a power of 2
 311 
 312 #define ARENA_AMALLOC_ALIGNMENT (2*BytesPerWord)
 313 
 314 // Signed variants of alignment helpers.  There are two versions of each, a macro
 315 // for use in places like enum definitions that require compile-time constant
 316 // expressions and a function for all other places so as to get type checking.
 317 
 318 #define align_size_up_(size, alignment) (((size) + ((alignment) - 1)) & ~((alignment) - 1))
 319 
 320 inline intptr_t align_size_up(intptr_t size, intptr_t alignment) {
 321   return align_size_up_(size, alignment);
 322 }
 323 
 324 #define align_size_down_(size, alignment) ((size) & ~((alignment) - 1))
 325 
 326 inline intptr_t align_size_down(intptr_t size, intptr_t alignment) {
 327   return align_size_down_(size, alignment);


1200 #define SSIZE_FORMAT  INT64_FORMAT
1201 #else   // !_LP64
1202 #define PTR_FORMAT    PTR32_FORMAT
1203 #define UINTX_FORMAT  UINT32_FORMAT
1204 #define INTX_FORMAT   INT32_FORMAT
1205 #define SIZE_FORMAT   UINT32_FORMAT
1206 #define SSIZE_FORMAT  INT32_FORMAT
1207 #endif  // _LP64
1208 
1209 #define INTPTR_FORMAT PTR_FORMAT
1210 
1211 // Enable zap-a-lot if in debug version.
1212 
1213 # ifdef ASSERT
1214 # ifdef COMPILER2
1215 #   define ENABLE_ZAP_DEAD_LOCALS
1216 #endif /* COMPILER2 */
1217 # endif /* ASSERT */
1218 
1219 #define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0]))




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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_GLOBALDEFINITIONS_HPP
  26 #define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP
  27 
  28 #ifdef TARGET_COMPILER_gcc
  29 # include "utilities/globalDefinitions_gcc.hpp"
  30 #endif
  31 #ifdef TARGET_COMPILER_visCPP
  32 # include "utilities/globalDefinitions_visCPP.hpp"
  33 #endif
  34 #ifdef TARGET_COMPILER_sparcWorks
  35 # include "utilities/globalDefinitions_sparcWorks.hpp"
  36 #endif
  37 
  38 // Needs to be included after globalDefinitions_<compiler>.hpp,
  39 // to make sure that _LP64 is defined.
  40 #include "utilities/macros.hpp"
  41 
  42 // This file holds all globally used constants & types, class (forward)
  43 // declarations and a few frequently used utility functions.
  44 
  45 //----------------------------------------------------------------------------------------------------
  46 // Constants
  47 
  48 const int LogBytesPerShort   = 1;
  49 const int LogBytesPerInt     = 2;
  50 #ifdef _LP64
  51 const int LogBytesPerWord    = 3;
  52 #else
  53 const int LogBytesPerWord    = 2;
  54 #endif
  55 const int LogBytesPerLong    = 3;
  56 
  57 const int BytesPerShort      = 1 << LogBytesPerShort;
  58 const int BytesPerInt        = 1 << LogBytesPerInt;
  59 const int BytesPerWord       = 1 << LogBytesPerWord;
  60 const int BytesPerLong       = 1 << LogBytesPerLong;
  61 


 304 //
 305 // Determines whether on-the-fly class replacement and frame popping are enabled.
 306 
 307 #define HOTSWAP
 308 
 309 //----------------------------------------------------------------------------------------------------
 310 // Object alignment, in units of HeapWords.
 311 //
 312 // Minimum is max(BytesPerLong, BytesPerDouble, BytesPerOop) / HeapWordSize, so jlong, jdouble and
 313 // reference fields can be naturally aligned.
 314 
 315 extern int MinObjAlignment;
 316 extern int MinObjAlignmentInBytes;
 317 extern int MinObjAlignmentInBytesMask;
 318 
 319 extern int LogMinObjAlignment;
 320 extern int LogMinObjAlignmentInBytes;
 321 
 322 // Machine dependent stuff
 323 
 324 #ifdef TARGET_ARCH_x86
 325 # include "globalDefinitions_x86.hpp"
 326 #endif
 327 #ifdef TARGET_ARCH_sparc
 328 # include "globalDefinitions_sparc.hpp"
 329 #endif
 330 #ifdef TARGET_ARCH_zero
 331 # include "globalDefinitions_zero.hpp"
 332 #endif
 333 
 334 
 335 // The byte alignment to be used by Arena::Amalloc.  See bugid 4169348.
 336 // Note: this value must be a power of 2
 337 
 338 #define ARENA_AMALLOC_ALIGNMENT (2*BytesPerWord)
 339 
 340 // Signed variants of alignment helpers.  There are two versions of each, a macro
 341 // for use in places like enum definitions that require compile-time constant
 342 // expressions and a function for all other places so as to get type checking.
 343 
 344 #define align_size_up_(size, alignment) (((size) + ((alignment) - 1)) & ~((alignment) - 1))
 345 
 346 inline intptr_t align_size_up(intptr_t size, intptr_t alignment) {
 347   return align_size_up_(size, alignment);
 348 }
 349 
 350 #define align_size_down_(size, alignment) ((size) & ~((alignment) - 1))
 351 
 352 inline intptr_t align_size_down(intptr_t size, intptr_t alignment) {
 353   return align_size_down_(size, alignment);


1226 #define SSIZE_FORMAT  INT64_FORMAT
1227 #else   // !_LP64
1228 #define PTR_FORMAT    PTR32_FORMAT
1229 #define UINTX_FORMAT  UINT32_FORMAT
1230 #define INTX_FORMAT   INT32_FORMAT
1231 #define SIZE_FORMAT   UINT32_FORMAT
1232 #define SSIZE_FORMAT  INT32_FORMAT
1233 #endif  // _LP64
1234 
1235 #define INTPTR_FORMAT PTR_FORMAT
1236 
1237 // Enable zap-a-lot if in debug version.
1238 
1239 # ifdef ASSERT
1240 # ifdef COMPILER2
1241 #   define ENABLE_ZAP_DEAD_LOCALS
1242 #endif /* COMPILER2 */
1243 # endif /* ASSERT */
1244 
1245 #define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0]))
1246 
1247 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP