|
30 | 30 | #include "oops/oop.inline.hpp"
|
31 | 31 | #include "utilities/align.hpp"
|
32 | 32 |
|
33 |
| -inline HeapWord* CollectedHeap::align_allocation_or_fail(HeapWord* addr, |
34 |
| - HeapWord* end, |
35 |
| - unsigned short alignment_in_bytes) { |
36 |
| - if (alignment_in_bytes <= ObjectAlignmentInBytes) { |
37 |
| - return addr; |
38 |
| - } |
39 |
| - |
40 |
| - assert(is_aligned(addr, HeapWordSize), |
41 |
| - "Address " PTR_FORMAT " is not properly aligned.", p2i(addr)); |
42 |
| - assert(is_aligned(alignment_in_bytes, HeapWordSize), |
43 |
| - "Alignment size %u is incorrect.", alignment_in_bytes); |
44 |
| - |
45 |
| - HeapWord* new_addr = align_up(addr, alignment_in_bytes); |
46 |
| - size_t padding = pointer_delta(new_addr, addr); |
47 |
| - |
48 |
| - if (padding == 0) { |
49 |
| - return addr; |
50 |
| - } |
51 |
| - |
52 |
| - if (padding < CollectedHeap::min_fill_size()) { |
53 |
| - padding += alignment_in_bytes / HeapWordSize; |
54 |
| - assert(padding >= CollectedHeap::min_fill_size(), |
55 |
| - "alignment_in_bytes %u is expect to be larger " |
56 |
| - "than the minimum object size", alignment_in_bytes); |
57 |
| - new_addr = addr + padding; |
58 |
| - } |
59 |
| - |
60 |
| - assert(new_addr > addr, "Unexpected arithmetic overflow " |
61 |
| - PTR_FORMAT " not greater than " PTR_FORMAT, p2i(new_addr), p2i(addr)); |
62 |
| - if(new_addr < end) { |
63 |
| - CollectedHeap::fill_with_object(addr, padding); |
64 |
| - return new_addr; |
65 |
| - } else { |
66 |
| - return NULL; |
67 |
| - } |
68 |
| -} |
69 |
| - |
70 | 33 | inline oop CollectedHeap::obj_allocate(Klass* klass, int size, TRAPS) {
|
71 | 34 | ObjAllocator allocator(klass, size, THREAD);
|
72 | 35 | return allocator.allocate();
|
|
0 commit comments