src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp

changeset 25
873fd82b133d
parent 1
2d8a650513c2
child 6876
710a3c8b516e
equal deleted inserted replaced
24:d2be62fdfa50 25:873fd82b133d
19 * 19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any 21 * or visit www.oracle.com if you need additional information or have any
22 * questions. 22 * questions.
23 * 23 *
24 */
25
26 /*
27 * This file has been modified by Loongson Technology in 2015. These
28 * modifications are Copyright (c) 2015 Loongson Technology, and are made
29 * available on the same license terms set forth above.
30 */ 24 */
31 25
32 #include "precompiled.hpp" 26 #include "precompiled.hpp"
33 #include "gc_implementation/shared/mutableNUMASpace.hpp" 27 #include "gc_implementation/shared/mutableNUMASpace.hpp"
34 #include "gc_implementation/shared/spaceDecorator.hpp" 28 #include "gc_implementation/shared/spaceDecorator.hpp"
871 ls->set_allocation_failed(); 865 ls->set_allocation_failed();
872 } 866 }
873 return p; 867 return p;
874 } 868 }
875 869
876 HeapWord* MutableNUMASpace::cas_allocate_oldnuma(size_t size, int node) {
877 LGRPSpace *ls = lgrp_spaces()->at(node);
878 MutableSpace *s = ls->space();
879 HeapWord *p = s->cas_allocate(size);
880 if (p != NULL) {
881 size_t remainder = pointer_delta(s->end(), p + size);
882 if (remainder < CollectedHeap::min_fill_size() && remainder > 0) {
883 if (s->cas_deallocate(p, size)) {
884 // We were the last to allocate and created a fragment less than
885 // a minimal object.
886 p = NULL;
887 } else {
888 guarantee(false, "Deallocation should always succeed");
889 }
890 }
891 }
892 if (p != NULL) {
893 HeapWord* cur_top, *cur_chunk_top = p + size;
894 while ((cur_top = top()) < cur_chunk_top) { // Keep _top updated.
895 if (Atomic::cmpxchg_ptr(cur_chunk_top, top_addr(), cur_top) == cur_top) {
896 break;
897 }
898 }
899 }
900
901 // Make the page allocation happen here if there is no static binding.
902 if (p != NULL && !os::numa_has_static_binding() ) {
903 for (HeapWord *i = p; i < p + size; i += os::vm_page_size() >> LogHeapWordSize) {
904 *(int*)i = 0;
905 }
906 }
907 if (p == NULL) {
908 ls->set_allocation_failed();
909 }
910 return p;
911 }
912
913 void MutableNUMASpace::print_short_on(outputStream* st) const { 870 void MutableNUMASpace::print_short_on(outputStream* st) const {
914 MutableSpace::print_short_on(st); 871 MutableSpace::print_short_on(st);
915 st->print(" ("); 872 st->print(" (");
916 for (int i = 0; i < lgrp_spaces()->length(); i++) { 873 for (int i = 0; i < lgrp_spaces()->length(); i++) {
917 st->print("lgrp %d: ", lgrp_spaces()->at(i)->lgrp_id()); 874 st->print("lgrp %d: ", lgrp_spaces()->at(i)->lgrp_id());

mercurial