plab.hpp (8867:8e371a1ba7df) | plab.hpp (8871:91bd6ad35898) |
---|---|
1/* 2 * Copyright (c) 2001, 2015, 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 * --- 60 unchanged lines hidden (view full) --- 69 void undo_last_allocation(HeapWord* obj, size_t word_sz); 70 71public: 72 // Initializes the buffer to be empty, but with the given "word_sz". 73 // Must get initialized with "set_buf" for an allocation to succeed. 74 PLAB(size_t word_sz); 75 virtual ~PLAB() {} 76 | 1/* 2 * Copyright (c) 2001, 2015, 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 * --- 60 unchanged lines hidden (view full) --- 69 void undo_last_allocation(HeapWord* obj, size_t word_sz); 70 71public: 72 // Initializes the buffer to be empty, but with the given "word_sz". 73 // Must get initialized with "set_buf" for an allocation to succeed. 74 PLAB(size_t word_sz); 75 virtual ~PLAB() {} 76 |
77 static size_t size_required_for_allocation(size_t word_size) { return word_size + AlignmentReserve; } 78 |
|
77 // Minimum PLAB size. 78 static size_t min_size(); 79 // Maximum PLAB size. 80 static size_t max_size(); 81 82 // If an allocation of the given "word_sz" can be satisfied within the 83 // buffer, do the allocation, returning a pointer to the start of the 84 // allocated block. If the allocation request cannot be satisfied, --- 17 unchanged lines hidden (view full) --- 102 103 // The total (word) size of the buffer, including both allocated and 104 // unallocated space. 105 size_t word_sz() { return _word_sz; } 106 107 size_t waste() { return _wasted; } 108 size_t undo_waste() { return _undo_wasted; } 109 | 79 // Minimum PLAB size. 80 static size_t min_size(); 81 // Maximum PLAB size. 82 static size_t max_size(); 83 84 // If an allocation of the given "word_sz" can be satisfied within the 85 // buffer, do the allocation, returning a pointer to the start of the 86 // allocated block. If the allocation request cannot be satisfied, --- 17 unchanged lines hidden (view full) --- 104 105 // The total (word) size of the buffer, including both allocated and 106 // unallocated space. 107 size_t word_sz() { return _word_sz; } 108 109 size_t waste() { return _wasted; } 110 size_t undo_waste() { return _undo_wasted; } 111 |
110 // Should only be done if we are about to reset with a new buffer of the 111 // given size. 112 void set_word_size(size_t new_word_sz) { 113 assert(new_word_sz > AlignmentReserve, "Too small"); 114 _word_sz = new_word_sz; 115 } 116 | |
117 // The number of words of unallocated space remaining in the buffer. 118 size_t words_remaining() { 119 assert(_end >= _top, "Negative buffer"); 120 return pointer_delta(_end, _top, HeapWordSize); 121 } 122 123 bool contains(void* addr) { 124 return (void*)_bottom <= addr && addr < (void*)_hard_end; 125 } 126 127 // Sets the space of the buffer to be [buf, space+word_sz()). | 112 // The number of words of unallocated space remaining in the buffer. 113 size_t words_remaining() { 114 assert(_end >= _top, "Negative buffer"); 115 return pointer_delta(_end, _top, HeapWordSize); 116 } 117 118 bool contains(void* addr) { 119 return (void*)_bottom <= addr && addr < (void*)_hard_end; 120 } 121 122 // Sets the space of the buffer to be [buf, space+word_sz()). |
128 virtual void set_buf(HeapWord* buf) { | 123 virtual void set_buf(HeapWord* buf, size_t new_word_sz) { 124 assert(new_word_sz > AlignmentReserve, "Too small"); 125 _word_sz = new_word_sz; 126 |
129 _bottom = buf; 130 _top = _bottom; 131 _hard_end = _bottom + word_sz(); 132 _end = _hard_end - AlignmentReserve; 133 assert(_end >= _top, "Negative buffer"); 134 // In support of ergonomic sizing 135 _allocated += word_sz(); 136 } --- 67 unchanged lines hidden --- | 127 _bottom = buf; 128 _top = _bottom; 129 _hard_end = _bottom + word_sz(); 130 _end = _hard_end - AlignmentReserve; 131 assert(_end >= _top, "Negative buffer"); 132 // In support of ergonomic sizing 133 _allocated += word_sz(); 134 } --- 67 unchanged lines hidden --- |