src/os/solaris/vm/os_solaris.cpp

changeset 3900
d2a62e0f25eb
parent 3783
7432b9db36ff
child 3903
65906dc96aa1
     1.1 --- a/src/os/solaris/vm/os_solaris.cpp	Wed Jun 27 15:23:36 2012 +0200
     1.2 +++ b/src/os/solaris/vm/os_solaris.cpp	Thu Jun 28 17:03:16 2012 -0400
     1.3 @@ -546,7 +546,7 @@
     1.4    // Find the number of processors in the processor set.
     1.5    if (pset_info(pset, NULL, id_length, NULL) == 0) {
     1.6      // Make up an array to hold their ids.
     1.7 -    *id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length);
     1.8 +    *id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length, mtInternal);
     1.9      // Fill in the array with their processor ids.
    1.10      if (pset_info(pset, NULL, id_length, *id_array) == 0) {
    1.11        result = true;
    1.12 @@ -577,7 +577,7 @@
    1.13    // Find the number of processors online.
    1.14    *id_length = sysconf(_SC_NPROCESSORS_ONLN);
    1.15    // Make up an array to hold their ids.
    1.16 -  *id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length);
    1.17 +  *id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length, mtInternal);
    1.18    // Processors need not be numbered consecutively.
    1.19    long found = 0;
    1.20    processorid_t next = 0;
    1.21 @@ -629,7 +629,7 @@
    1.22    // The next id, to limit loops.
    1.23    const processorid_t limit_id = max_id + 1;
    1.24    // Make up markers for available processors.
    1.25 -  bool* available_id = NEW_C_HEAP_ARRAY(bool, limit_id);
    1.26 +  bool* available_id = NEW_C_HEAP_ARRAY(bool, limit_id, mtInternal);
    1.27    for (uint c = 0; c < limit_id; c += 1) {
    1.28      available_id[c] = false;
    1.29    }
    1.30 @@ -666,7 +666,7 @@
    1.31      }
    1.32    }
    1.33    if (available_id != NULL) {
    1.34 -    FREE_C_HEAP_ARRAY(bool, available_id);
    1.35 +    FREE_C_HEAP_ARRAY(bool, available_id, mtInternal);
    1.36    }
    1.37    return true;
    1.38  }
    1.39 @@ -698,7 +698,7 @@
    1.40      }
    1.41    }
    1.42    if (id_array != NULL) {
    1.43 -    FREE_C_HEAP_ARRAY(processorid_t, id_array);
    1.44 +    FREE_C_HEAP_ARRAY(processorid_t, id_array, mtInternal);
    1.45    }
    1.46    return result;
    1.47  }
    1.48 @@ -771,8 +771,8 @@
    1.49    // code needs to be changed accordingly.
    1.50  
    1.51    // The next few definitions allow the code to be verbatim:
    1.52 -#define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n))
    1.53 -#define free(p) FREE_C_HEAP_ARRAY(char, p)
    1.54 +#define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n), mtInternal)
    1.55 +#define free(p) FREE_C_HEAP_ARRAY(char, p, mtInternal)
    1.56  #define getenv(n) ::getenv(n)
    1.57  
    1.58  #define EXTENSIONS_DIR  "/lib/ext"
    1.59 @@ -1927,11 +1927,11 @@
    1.60      // release the storage
    1.61      for (int i = 0 ; i < n ; i++) {
    1.62        if (pelements[i] != NULL) {
    1.63 -        FREE_C_HEAP_ARRAY(char, pelements[i]);
    1.64 +        FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
    1.65        }
    1.66      }
    1.67      if (pelements != NULL) {
    1.68 -      FREE_C_HEAP_ARRAY(char*, pelements);
    1.69 +      FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
    1.70      }
    1.71    } else {
    1.72      snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
    1.73 @@ -2662,17 +2662,17 @@
    1.74  
    1.75    // pending_signals has one int per signal
    1.76    // The additional signal is for SIGEXIT - exit signal to signal_thread
    1.77 -  pending_signals = (jint *)os::malloc(sizeof(jint) * (Sigexit+1));
    1.78 +  pending_signals = (jint *)os::malloc(sizeof(jint) * (Sigexit+1), mtInternal);
    1.79    memset(pending_signals, 0, (sizeof(jint) * (Sigexit+1)));
    1.80  
    1.81    if (UseSignalChaining) {
    1.82       chainedsigactions = (struct sigaction *)malloc(sizeof(struct sigaction)
    1.83 -       * (Maxsignum + 1));
    1.84 +       * (Maxsignum + 1), mtInternal);
    1.85       memset(chainedsigactions, 0, (sizeof(struct sigaction) * (Maxsignum + 1)));
    1.86 -     preinstalled_sigs = (int *)os::malloc(sizeof(int) * (Maxsignum + 1));
    1.87 +     preinstalled_sigs = (int *)os::malloc(sizeof(int) * (Maxsignum + 1), mtInternal);
    1.88       memset(preinstalled_sigs, 0, (sizeof(int) * (Maxsignum + 1)));
    1.89    }
    1.90 -  ourSigFlags = (int*)malloc(sizeof(int) * (Maxsignum + 1 ));
    1.91 +  ourSigFlags = (int*)malloc(sizeof(int) * (Maxsignum + 1 ), mtInternal);
    1.92    memset(ourSigFlags, 0, sizeof(int) * (Maxsignum + 1));
    1.93  }
    1.94  
    1.95 @@ -2760,7 +2760,7 @@
    1.96    return page_size;
    1.97  }
    1.98  
    1.99 -bool os::commit_memory(char* addr, size_t bytes, bool exec) {
   1.100 +bool os::pd_commit_memory(char* addr, size_t bytes, bool exec) {
   1.101    int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
   1.102    size_t size = bytes;
   1.103    char *res = Solaris::mmap_chunk(addr, size, MAP_PRIVATE|MAP_FIXED, prot);
   1.104 @@ -2773,7 +2773,7 @@
   1.105    return false;
   1.106  }
   1.107  
   1.108 -bool os::commit_memory(char* addr, size_t bytes, size_t alignment_hint,
   1.109 +bool os::pd_commit_memory(char* addr, size_t bytes, size_t alignment_hint,
   1.110                         bool exec) {
   1.111    if (commit_memory(addr, bytes, exec)) {
   1.112      if (UseMPSS && alignment_hint > (size_t)vm_page_size()) {
   1.113 @@ -2803,14 +2803,14 @@
   1.114  }
   1.115  
   1.116  // Uncommit the pages in a specified region.
   1.117 -void os::free_memory(char* addr, size_t bytes, size_t alignment_hint) {
   1.118 +void os::pd_free_memory(char* addr, size_t bytes, size_t alignment_hint) {
   1.119    if (madvise(addr, bytes, MADV_FREE) < 0) {
   1.120      debug_only(warning("MADV_FREE failed."));
   1.121      return;
   1.122    }
   1.123  }
   1.124  
   1.125 -bool os::create_stack_guard_pages(char* addr, size_t size) {
   1.126 +bool os::pd_create_stack_guard_pages(char* addr, size_t size) {
   1.127    return os::commit_memory(addr, size);
   1.128  }
   1.129  
   1.130 @@ -2819,7 +2819,7 @@
   1.131  }
   1.132  
   1.133  // Change the page size in a given range.
   1.134 -void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
   1.135 +void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
   1.136    assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned.");
   1.137    assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned.");
   1.138    if (UseLargePages && UseMPSS) {
   1.139 @@ -3006,7 +3006,7 @@
   1.140    return end;
   1.141  }
   1.142  
   1.143 -bool os::uncommit_memory(char* addr, size_t bytes) {
   1.144 +bool os::pd_uncommit_memory(char* addr, size_t bytes) {
   1.145    size_t size = bytes;
   1.146    // Map uncommitted pages PROT_NONE so we fail early if we touch an
   1.147    // uncommitted page. Otherwise, the read/write might succeed if we
   1.148 @@ -3045,7 +3045,7 @@
   1.149    return mmap_chunk(addr, bytes, flags, PROT_NONE);
   1.150  }
   1.151  
   1.152 -char* os::reserve_memory(size_t bytes, char* requested_addr, size_t alignment_hint) {
   1.153 +char* os::pd_reserve_memory(size_t bytes, char* requested_addr, size_t alignment_hint) {
   1.154    char* addr = Solaris::anon_mmap(requested_addr, bytes, alignment_hint, (requested_addr != NULL));
   1.155  
   1.156    guarantee(requested_addr == NULL || requested_addr == addr,
   1.157 @@ -3056,7 +3056,7 @@
   1.158  // Reserve memory at an arbitrary address, only if that area is
   1.159  // available (and not reserved for something else).
   1.160  
   1.161 -char* os::attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
   1.162 +char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
   1.163    const int max_tries = 10;
   1.164    char* base[max_tries];
   1.165    size_t size[max_tries];
   1.166 @@ -3178,7 +3178,7 @@
   1.167    return (i < max_tries) ? requested_addr : NULL;
   1.168  }
   1.169  
   1.170 -bool os::release_memory(char* addr, size_t bytes) {
   1.171 +bool os::pd_release_memory(char* addr, size_t bytes) {
   1.172    size_t size = bytes;
   1.173    return munmap(addr, size) == 0;
   1.174  }
   1.175 @@ -4792,7 +4792,7 @@
   1.176    lwpSize = 16*1024;
   1.177    for (;;) {
   1.178      ::lseek64 (lwpFile, 0, SEEK_SET);
   1.179 -    lwpArray = (prheader_t *)NEW_C_HEAP_ARRAY(char, lwpSize);
   1.180 +    lwpArray = (prheader_t *)NEW_C_HEAP_ARRAY(char, lwpSize, mtInternal);
   1.181      if (::read(lwpFile, lwpArray, lwpSize) < 0) {
   1.182        if (ThreadPriorityVerbose) warning("Error reading /proc/self/lstatus\n");
   1.183        break;
   1.184 @@ -4810,10 +4810,10 @@
   1.185        break;
   1.186      }
   1.187      lwpSize = lwpArray->pr_nent * lwpArray->pr_entsize;
   1.188 -    FREE_C_HEAP_ARRAY(char, lwpArray);  // retry.
   1.189 -  }
   1.190 -
   1.191 -  FREE_C_HEAP_ARRAY(char, lwpArray);
   1.192 +    FREE_C_HEAP_ARRAY(char, lwpArray, mtInternal);  // retry.
   1.193 +  }
   1.194 +
   1.195 +  FREE_C_HEAP_ARRAY(char, lwpArray, mtInternal);
   1.196    ::close (lwpFile);
   1.197    if (ThreadPriorityVerbose) {
   1.198      if (isT2) tty->print_cr("We are running with a T2 libthread\n");
   1.199 @@ -5137,9 +5137,9 @@
   1.200        UseNUMA = false;
   1.201      } else {
   1.202        size_t lgrp_limit = os::numa_get_groups_num();
   1.203 -      int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit);
   1.204 +      int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit, mtInternal);
   1.205        size_t lgrp_num = os::numa_get_leaf_groups(lgrp_ids, lgrp_limit);
   1.206 -      FREE_C_HEAP_ARRAY(int, lgrp_ids);
   1.207 +      FREE_C_HEAP_ARRAY(int, lgrp_ids, mtInternal);
   1.208        if (lgrp_num < 2) {
   1.209          // There's only one locality group, disable NUMA.
   1.210          UseNUMA = false;
   1.211 @@ -5485,7 +5485,7 @@
   1.212  }
   1.213  
   1.214  // Map a block of memory.
   1.215 -char* os::map_memory(int fd, const char* file_name, size_t file_offset,
   1.216 +char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
   1.217                       char *addr, size_t bytes, bool read_only,
   1.218                       bool allow_exec) {
   1.219    int prot;
   1.220 @@ -5517,7 +5517,7 @@
   1.221  
   1.222  
   1.223  // Remap a block of memory.
   1.224 -char* os::remap_memory(int fd, const char* file_name, size_t file_offset,
   1.225 +char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset,
   1.226                         char *addr, size_t bytes, bool read_only,
   1.227                         bool allow_exec) {
   1.228    // same as map_memory() on this OS
   1.229 @@ -5527,7 +5527,7 @@
   1.230  
   1.231  
   1.232  // Unmap a block of memory.
   1.233 -bool os::unmap_memory(char* addr, size_t bytes) {
   1.234 +bool os::pd_unmap_memory(char* addr, size_t bytes) {
   1.235    return munmap(addr, bytes) == 0;
   1.236  }
   1.237  

mercurial