1 /* 2 * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 # include "incls/_precompiled.incl" 26 # include "incls/_parMarkBitMap.cpp.incl" 27 28 bool 29 ParMarkBitMap::initialize(MemRegion covered_region) 30 { 31 const idx_t bits = bits_required(covered_region); 32 // The bits will be divided evenly between two bitmaps; each of them should be 33 // an integral number of words. 34 assert(bits % (BitsPerWord * 2) == 0, "region size unaligned"); 35 36 const size_t words = bits / BitsPerWord; 37 const size_t raw_bytes = words * sizeof(idx_t); 38 const size_t page_sz = os::page_size_for_region(raw_bytes, raw_bytes, 10); 39 const size_t granularity = os::vm_allocation_granularity(); 40 const size_t bytes = align_size_up(raw_bytes, MAX2(page_sz, granularity)); 41 42 const size_t rs_align = page_sz == (size_t) os::vm_page_size() ? 0 : 43 MAX2(page_sz, granularity); 44 ReservedSpace rs(bytes, rs_align, rs_align > 0); 45 os::trace_page_sizes("par bitmap", raw_bytes, raw_bytes, page_sz, 46 rs.base(), rs.size()); | 1 /* 2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp" 27 #include "gc_implementation/parallelScavenge/parMarkBitMap.inline.hpp" 28 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" 29 #include "oops/oop.inline.hpp" 30 #include "runtime/os.hpp" 31 #include "utilities/bitMap.inline.hpp" 32 #ifdef TARGET_OS_FAMILY_linux 33 # include "os_linux.inline.hpp" 34 #endif 35 #ifdef TARGET_OS_FAMILY_solaris 36 # include "os_solaris.inline.hpp" 37 #endif 38 #ifdef TARGET_OS_FAMILY_windows 39 # include "os_windows.inline.hpp" 40 #endif 41 42 bool 43 ParMarkBitMap::initialize(MemRegion covered_region) 44 { 45 const idx_t bits = bits_required(covered_region); 46 // The bits will be divided evenly between two bitmaps; each of them should be 47 // an integral number of words. 48 assert(bits % (BitsPerWord * 2) == 0, "region size unaligned"); 49 50 const size_t words = bits / BitsPerWord; 51 const size_t raw_bytes = words * sizeof(idx_t); 52 const size_t page_sz = os::page_size_for_region(raw_bytes, raw_bytes, 10); 53 const size_t granularity = os::vm_allocation_granularity(); 54 const size_t bytes = align_size_up(raw_bytes, MAX2(page_sz, granularity)); 55 56 const size_t rs_align = page_sz == (size_t) os::vm_page_size() ? 0 : 57 MAX2(page_sz, granularity); 58 ReservedSpace rs(bytes, rs_align, rs_align > 0); 59 os::trace_page_sizes("par bitmap", raw_bytes, raw_bytes, page_sz, 60 rs.base(), rs.size()); |