src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp

changeset 1
2d8a650513c2
parent 0
f90c822e73f8
child 25
873fd82b133d
     1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp	Fri Apr 29 00:06:10 2016 +0800
     1.3 @@ -22,6 +22,12 @@
     1.4   *
     1.5   */
     1.6  
     1.7 +/*
     1.8 + * This file has been modified by Loongson Technology in 2015. These
     1.9 + * modifications are Copyright (c) 2015 Loongson Technology, and are made
    1.10 + * available on the same license terms set forth above.
    1.11 + */
    1.12 +
    1.13  #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSOLDGEN_HPP
    1.14  #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSOLDGEN_HPP
    1.15  
    1.16 @@ -29,6 +35,7 @@
    1.17  #include "gc_implementation/parallelScavenge/psGenerationCounters.hpp"
    1.18  #include "gc_implementation/parallelScavenge/psVirtualspace.hpp"
    1.19  #include "gc_implementation/shared/mutableSpace.hpp"
    1.20 +#include "gc_implementation/shared/mutableNUMASpace.hpp"
    1.21  #include "gc_implementation/shared/spaceCounters.hpp"
    1.22  #include "runtime/safepoint.hpp"
    1.23  
    1.24 @@ -73,9 +80,15 @@
    1.25    // Support for MT garbage collection. CAS allocation is lower overhead than grabbing
    1.26    // and releasing the heap lock, which is held during gc's anyway. This method is not
    1.27    // safe for use at the same time as allocate_noexpand()!
    1.28 -  HeapWord* cas_allocate_noexpand(size_t word_size) {
    1.29 +  HeapWord* cas_allocate_noexpand(size_t word_size, int node) {
    1.30      assert(SafepointSynchronize::is_at_safepoint(), "Must only be called at safepoint");
    1.31 -    HeapWord* res = object_space()->cas_allocate(word_size);
    1.32 +    HeapWord* res;
    1.33 +    if(UseOldNUMA) {
    1.34 +      res = object_space()->cas_allocate_oldnuma(word_size, node);
    1.35 +    }
    1.36 +    else {
    1.37 +      res = object_space()->cas_allocate(word_size);
    1.38 +    } 
    1.39      if (res != NULL) {
    1.40        _start_array.allocate_block(res);
    1.41      }
    1.42 @@ -83,13 +96,13 @@
    1.43    }
    1.44  
    1.45    // Support for MT garbage collection. See above comment.
    1.46 -  HeapWord* cas_allocate(size_t word_size) {
    1.47 -    HeapWord* res = cas_allocate_noexpand(word_size);
    1.48 -    return (res == NULL) ? expand_and_cas_allocate(word_size) : res;
    1.49 +  HeapWord* cas_allocate(size_t word_size, int node) {
    1.50 +    HeapWord* res = cas_allocate_noexpand(word_size, node);
    1.51 +    return (res == NULL) ? expand_and_cas_allocate(word_size, node) : res;
    1.52    }
    1.53  
    1.54    HeapWord* expand_and_allocate(size_t word_size);
    1.55 -  HeapWord* expand_and_cas_allocate(size_t word_size);
    1.56 +  HeapWord* expand_and_cas_allocate(size_t word_size, int node);
    1.57    void expand(size_t bytes);
    1.58    bool expand_by(size_t bytes);
    1.59    bool expand_to_reserved();
    1.60 @@ -147,6 +160,22 @@
    1.61    size_t capacity_in_bytes() const        { return object_space()->capacity_in_bytes(); }
    1.62    size_t used_in_bytes() const            { return object_space()->used_in_bytes(); }
    1.63    size_t free_in_bytes() const            { return object_space()->free_in_bytes(); }
    1.64 +  size_t free_in_bytes_numa() const {
    1.65 +    size_t min_size, free_bytes;
    1.66 +    MutableNUMASpace* s = (MutableNUMASpace*) object_space();
    1.67 +    int i = s->lgrp_spaces()->length();
    1.68 +    int j;
    1.69 +    MutableNUMASpace::LGRPSpace *ls;
    1.70 +    MutableSpace* sp;
    1.71 +    for(j = 0; j < i; j++) {
    1.72 +      ls = s->lgrp_spaces()->at(j);
    1.73 +      sp = ls->space();
    1.74 +      free_bytes = sp->free_in_bytes();
    1.75 +      if(j == 0) min_size = free_bytes;
    1.76 +      if(free_bytes < min_size) min_size = free_bytes;
    1.77 +    }
    1.78 +    return min_size;
    1.79 +  }
    1.80  
    1.81    size_t capacity_in_words() const        { return object_space()->capacity_in_words(); }
    1.82    size_t used_in_words() const            { return object_space()->used_in_words(); }

mercurial