< prev index next >

src/hotspot/share/gc/parallel/mutableNUMASpace.cpp

Print this page




 847     i = os::random() % lgrp_spaces()->length();
 848   }
 849   LGRPSpace *ls = lgrp_spaces()->at(i);
 850   MutableSpace *s = ls->space();
 851   HeapWord *p = s->cas_allocate(size);
 852   if (p != NULL) {
 853     size_t remainder = pointer_delta(s->end(), p + size);
 854     if (remainder < CollectedHeap::min_fill_size() && remainder > 0) {
 855       if (s->cas_deallocate(p, size)) {
 856         // We were the last to allocate and created a fragment less than
 857         // a minimal object.
 858         p = NULL;
 859       } else {
 860         guarantee(false, "Deallocation should always succeed");
 861       }
 862     }
 863   }
 864   if (p != NULL) {
 865     HeapWord* cur_top, *cur_chunk_top = p + size;
 866     while ((cur_top = top()) < cur_chunk_top) { // Keep _top updated.
 867       if (Atomic::cmpxchg(cur_chunk_top, top_addr(), cur_top) == cur_top) {
 868         break;
 869       }
 870     }
 871   }
 872 
 873   // Make the page allocation happen here if there is no static binding.
 874   if (p != NULL && !os::numa_has_static_binding() ) {
 875     for (HeapWord *i = p; i < p + size; i += os::vm_page_size() >> LogHeapWordSize) {
 876       *(int*)i = 0;
 877     }
 878   }
 879   if (p == NULL) {
 880     ls->set_allocation_failed();
 881   }
 882   return p;
 883 }
 884 
 885 void MutableNUMASpace::print_short_on(outputStream* st) const {
 886   MutableSpace::print_short_on(st);
 887   st->print(" (");




 847     i = os::random() % lgrp_spaces()->length();
 848   }
 849   LGRPSpace *ls = lgrp_spaces()->at(i);
 850   MutableSpace *s = ls->space();
 851   HeapWord *p = s->cas_allocate(size);
 852   if (p != NULL) {
 853     size_t remainder = pointer_delta(s->end(), p + size);
 854     if (remainder < CollectedHeap::min_fill_size() && remainder > 0) {
 855       if (s->cas_deallocate(p, size)) {
 856         // We were the last to allocate and created a fragment less than
 857         // a minimal object.
 858         p = NULL;
 859       } else {
 860         guarantee(false, "Deallocation should always succeed");
 861       }
 862     }
 863   }
 864   if (p != NULL) {
 865     HeapWord* cur_top, *cur_chunk_top = p + size;
 866     while ((cur_top = top()) < cur_chunk_top) { // Keep _top updated.
 867       if (Atomic::cmpxchg(top_addr(), cur_top, cur_chunk_top) == cur_top) {
 868         break;
 869       }
 870     }
 871   }
 872 
 873   // Make the page allocation happen here if there is no static binding.
 874   if (p != NULL && !os::numa_has_static_binding() ) {
 875     for (HeapWord *i = p; i < p + size; i += os::vm_page_size() >> LogHeapWordSize) {
 876       *(int*)i = 0;
 877     }
 878   }
 879   if (p == NULL) {
 880     ls->set_allocation_failed();
 881   }
 882   return p;
 883 }
 884 
 885 void MutableNUMASpace::print_short_on(outputStream* st) const {
 886   MutableSpace::print_short_on(st);
 887   st->print(" (");


< prev index next >