< prev index next >

src/share/vm/runtime/virtualspace.cpp

Print this page
rev 7192 : [mq]: 8058354-fix


  35 #endif
  36 #ifdef TARGET_OS_FAMILY_windows
  37 # include "os_windows.inline.hpp"
  38 #endif
  39 #ifdef TARGET_OS_FAMILY_aix
  40 # include "os_aix.inline.hpp"
  41 #endif
  42 #ifdef TARGET_OS_FAMILY_bsd
  43 # include "os_bsd.inline.hpp"
  44 #endif
  45 
  46 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  47 
  48 // ReservedSpace
  49 
  50 // Dummy constructor
  51 ReservedSpace::ReservedSpace() : _base(NULL), _size(0), _noaccess_prefix(0),
  52     _alignment(0), _special(false), _executable(false) {
  53 }
  54 
  55 ReservedSpace::ReservedSpace(size_t size) {
  56   // Want to use large pages where possible and pad with small pages.
  57   size_t page_size = os::page_size_for_region_unaligned(size, 1);
  58   bool large_pages = page_size != (size_t)os::vm_page_size();







  59   // Don't force the alignment to be large page aligned,
  60   // since that will waste memory.
  61   size_t alignment = os::vm_allocation_granularity();

  62   initialize(size, alignment, large_pages, NULL, 0, false);
  63 }
  64 
  65 ReservedSpace::ReservedSpace(size_t size, size_t alignment,
  66                              bool large,
  67                              char* requested_address,
  68                              const size_t noaccess_prefix) {
  69   initialize(size+noaccess_prefix, alignment, large, requested_address,
  70              noaccess_prefix, false);
  71 }
  72 
  73 ReservedSpace::ReservedSpace(size_t size, size_t alignment,
  74                              bool large,
  75                              bool executable) {
  76   initialize(size, alignment, large, NULL, 0, executable);
  77 }
  78 
  79 // Helper method.
  80 static bool failed_to_reserve_as_requested(char* base, char* requested_address,
  81                                            const size_t size, bool special)




  35 #endif
  36 #ifdef TARGET_OS_FAMILY_windows
  37 # include "os_windows.inline.hpp"
  38 #endif
  39 #ifdef TARGET_OS_FAMILY_aix
  40 # include "os_aix.inline.hpp"
  41 #endif
  42 #ifdef TARGET_OS_FAMILY_bsd
  43 # include "os_bsd.inline.hpp"
  44 #endif
  45 
  46 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  47 
  48 // ReservedSpace
  49 
  50 // Dummy constructor
  51 ReservedSpace::ReservedSpace() : _base(NULL), _size(0), _noaccess_prefix(0),
  52     _alignment(0), _special(false), _executable(false) {
  53 }
  54 
  55 ReservedSpace::ReservedSpace(size_t size, bool prefer_large_pages) {
  56   // Want to use large pages where possible and pad with small pages.
  57   size_t page_size = os::page_size_for_region_unaligned(size, 1);
  58   bool large_pages = page_size != (size_t)os::vm_page_size();
  59   size_t alignment;
  60   if (large_pages && prefer_large_pages) {
  61     alignment = MAX2(page_size, (size_t)os::vm_allocation_granularity());
  62     // ReservedSpace initialization requires size to be aligned to the given
  63     // alignment. Align the size up.
  64     size = align_size_up(size, alignment);
  65   } else {
  66     // Don't force the alignment to be large page aligned,
  67     // since that will waste memory.
  68     alignment = os::vm_allocation_granularity();
  69   }
  70   initialize(size, alignment, large_pages, NULL, 0, false);
  71 }
  72 
  73 ReservedSpace::ReservedSpace(size_t size, size_t alignment,
  74                              bool large,
  75                              char* requested_address,
  76                              const size_t noaccess_prefix) {
  77   initialize(size+noaccess_prefix, alignment, large, requested_address,
  78              noaccess_prefix, false);
  79 }
  80 
  81 ReservedSpace::ReservedSpace(size_t size, size_t alignment,
  82                              bool large,
  83                              bool executable) {
  84   initialize(size, alignment, large, NULL, 0, executable);
  85 }
  86 
  87 // Helper method.
  88 static bool failed_to_reserve_as_requested(char* base, char* requested_address,
  89                                            const size_t size, bool special)


< prev index next >