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 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP
27
28 #include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
29 #include "gc_implementation/g1/g1CollectedHeap.hpp"
30 #include "gc_implementation/g1/heapRegion.hpp"
31 #include "memory/space.hpp"
32 #include "runtime/atomic.inline.hpp"
33
34 // This version requires locking.
35 inline HeapWord* G1OffsetTableContigSpace::allocate_impl(size_t size,
36 HeapWord* const end_value) {
37 HeapWord* obj = top();
38 if (pointer_delta(end_value, obj) >= size) {
39 HeapWord* new_top = obj + size;
40 set_top(new_top);
41 assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
42 return obj;
43 } else {
44 return NULL;
45 }
46 }
47
48 // This version is lock-free.
49 inline HeapWord* G1OffsetTableContigSpace::par_allocate_impl(size_t size,
50 HeapWord* const end_value) {
51 do {
|
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 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP
27
28 #include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
29 #include "gc_implementation/g1/g1CollectedHeap.hpp"
30 #include "gc_implementation/g1/heapRegion.hpp"
31 #include "memory/space.hpp"
32 #include "oops/oop.inline.hpp"
33 #include "runtime/atomic.inline.hpp"
34
35 // This version requires locking.
36 inline HeapWord* G1OffsetTableContigSpace::allocate_impl(size_t size,
37 HeapWord* const end_value) {
38 HeapWord* obj = top();
39 if (pointer_delta(end_value, obj) >= size) {
40 HeapWord* new_top = obj + size;
41 set_top(new_top);
42 assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
43 return obj;
44 } else {
45 return NULL;
46 }
47 }
48
49 // This version is lock-free.
50 inline HeapWord* G1OffsetTableContigSpace::par_allocate_impl(size_t size,
51 HeapWord* const end_value) {
52 do {
|