1 /*
2 * Copyright (c) 2000, 2012, 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 *
29 #include "memory/space.inline.hpp"
30 #include "memory/universe.hpp"
31 #include "oops/oop.inline.hpp"
32 #include "runtime/java.hpp"
33 #include "services/memTracker.hpp"
34
35 //////////////////////////////////////////////////////////////////////
36 // BlockOffsetSharedArray
37 //////////////////////////////////////////////////////////////////////
38
39 BlockOffsetSharedArray::BlockOffsetSharedArray(MemRegion reserved,
40 size_t init_word_size):
41 _reserved(reserved), _end(NULL)
42 {
43 size_t size = compute_size(reserved.word_size());
44 ReservedSpace rs(size);
45 if (!rs.is_reserved()) {
46 vm_exit_during_initialization("Could not reserve enough space for heap offset array");
47 }
48
49 MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);
50
51 if (!_vs.initialize(rs, 0)) {
52 vm_exit_during_initialization("Could not reserve enough space for heap offset array");
53 }
54 _offset_array = (u_char*)_vs.low_boundary();
55 resize(init_word_size);
56 if (TraceBlockOffsetTable) {
57 gclog_or_tty->print_cr("BlockOffsetSharedArray::BlockOffsetSharedArray: ");
58 gclog_or_tty->print_cr(" "
59 " rs.base(): " INTPTR_FORMAT
60 " rs.size(): " INTPTR_FORMAT
61 " rs end(): " INTPTR_FORMAT,
62 rs.base(), rs.size(), rs.base() + rs.size());
63 gclog_or_tty->print_cr(" "
64 " _vs.low_boundary(): " INTPTR_FORMAT
65 " _vs.high_boundary(): " INTPTR_FORMAT,
66 _vs.low_boundary(),
67 _vs.high_boundary());
68 }
69 }
|
1 /*
2 * Copyright (c) 2000, 2013, 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 *
29 #include "memory/space.inline.hpp"
30 #include "memory/universe.hpp"
31 #include "oops/oop.inline.hpp"
32 #include "runtime/java.hpp"
33 #include "services/memTracker.hpp"
34
35 //////////////////////////////////////////////////////////////////////
36 // BlockOffsetSharedArray
37 //////////////////////////////////////////////////////////////////////
38
39 BlockOffsetSharedArray::BlockOffsetSharedArray(MemRegion reserved,
40 size_t init_word_size):
41 _reserved(reserved), _end(NULL)
42 {
43 size_t size = compute_size(reserved.word_size());
44 ReservedSpace rs(size);
45 if (!rs.is_reserved()) {
46 vm_exit_during_initialization("Could not reserve enough space for heap offset array");
47 }
48
49 NMTTrackOp op(NMTTrackOp::TypeOp);
50 op.execute_op((address)rs.base(), 0, mtGC);
51
52 if (!_vs.initialize(rs, 0)) {
53 vm_exit_during_initialization("Could not reserve enough space for heap offset array");
54 }
55 _offset_array = (u_char*)_vs.low_boundary();
56 resize(init_word_size);
57 if (TraceBlockOffsetTable) {
58 gclog_or_tty->print_cr("BlockOffsetSharedArray::BlockOffsetSharedArray: ");
59 gclog_or_tty->print_cr(" "
60 " rs.base(): " INTPTR_FORMAT
61 " rs.size(): " INTPTR_FORMAT
62 " rs end(): " INTPTR_FORMAT,
63 rs.base(), rs.size(), rs.base() + rs.size());
64 gclog_or_tty->print_cr(" "
65 " _vs.low_boundary(): " INTPTR_FORMAT
66 " _vs.high_boundary(): " INTPTR_FORMAT,
67 _vs.low_boundary(),
68 _vs.high_boundary());
69 }
70 }
|