Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/ptrQueue.cpp @ 1084:5f932a151fd4
6895788: G1: SATB and update buffer allocation code allocates too much space
Summary: The type in the NEW_C_HEAP_ARRRY and FREE_C_HEAP_ARRAY calls in the buffer allocation code was changed from void* to char as the size argument had already been mulitipled by the byte size of an object pointer.
Reviewed-by: ysr, tonyp
author | johnc |
---|---|
date | Fri, 06 Nov 2009 11:10:05 -0800 |
parents | bd02caa94611 |
children | 44f61c24ddab |
comparison
equal
deleted
inserted
replaced
1051:26f1542097f1 | 1084:5f932a151fd4 |
---|---|
105 // Just override the next pointer with NULL, just in case we scan this part | 105 // Just override the next pointer with NULL, just in case we scan this part |
106 // of the buffer. | 106 // of the buffer. |
107 res[0] = NULL; | 107 res[0] = NULL; |
108 return res; | 108 return res; |
109 } else { | 109 } else { |
110 return NEW_C_HEAP_ARRAY(void*, _sz); | 110 return (void**) NEW_C_HEAP_ARRAY(char, _sz); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 void PtrQueueSet::deallocate_buffer(void** buf) { | 114 void PtrQueueSet::deallocate_buffer(void** buf) { |
115 assert(_sz > 0, "Didn't set a buffer size."); | 115 assert(_sz > 0, "Didn't set a buffer size."); |
125 size_t n = _buf_free_list_sz / 2; | 125 size_t n = _buf_free_list_sz / 2; |
126 while (n > 0) { | 126 while (n > 0) { |
127 assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong."); | 127 assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong."); |
128 void** head = _buf_free_list; | 128 void** head = _buf_free_list; |
129 _buf_free_list = (void**)_buf_free_list[0]; | 129 _buf_free_list = (void**)_buf_free_list[0]; |
130 FREE_C_HEAP_ARRAY(void*,head); | 130 FREE_C_HEAP_ARRAY(char, head); |
131 _buf_free_list_sz --; | |
131 n--; | 132 n--; |
132 } | 133 } |
133 } | 134 } |
134 | 135 |
135 void PtrQueueSet::enqueue_complete_buffer(void** buf, size_t index, bool ignore_max_completed) { | 136 void PtrQueueSet::enqueue_complete_buffer(void** buf, size_t index, bool ignore_max_completed) { |