1 /* |
1 /* |
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
157 void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) { |
157 void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) { |
158 assert(index_for(right - 1) < _vs.committed_size(), |
158 assert(index_for(right - 1) < _vs.committed_size(), |
159 "right address out of range"); |
159 "right address out of range"); |
160 assert(left < right, "Heap addresses out of order"); |
160 assert(left < right, "Heap addresses out of order"); |
161 size_t num_cards = pointer_delta(right, left) >> LogN_words; |
161 size_t num_cards = pointer_delta(right, left) >> LogN_words; |
162 memset(&_offset_array[index_for(left)], offset, num_cards); |
162 if (UseMemSetInBOT) { |
|
163 memset(&_offset_array[index_for(left)], offset, num_cards); |
|
164 } else { |
|
165 size_t i = index_for(left); |
|
166 const size_t end = i + num_cards; |
|
167 for (; i < end; i++) { |
|
168 _offset_array[i] = offset; |
|
169 } |
|
170 } |
163 } |
171 } |
164 |
172 |
165 void set_offset_array(size_t left, size_t right, u_char offset) { |
173 void set_offset_array(size_t left, size_t right, u_char offset) { |
166 assert(right < _vs.committed_size(), "right address out of range"); |
174 assert(right < _vs.committed_size(), "right address out of range"); |
167 assert(left <= right, "indexes out of order"); |
175 assert(left <= right, "indexes out of order"); |
168 size_t num_cards = right - left + 1; |
176 size_t num_cards = right - left + 1; |
169 memset(&_offset_array[left], offset, num_cards); |
177 if (UseMemSetInBOT) { |
|
178 memset(&_offset_array[left], offset, num_cards); |
|
179 } else { |
|
180 size_t i = left; |
|
181 const size_t end = i + num_cards; |
|
182 for (; i < end; i++) { |
|
183 _offset_array[i] = offset; |
|
184 } |
|
185 } |
170 } |
186 } |
171 |
187 |
172 void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const { |
188 void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const { |
173 assert(index < _vs.committed_size(), "index out of range"); |
189 assert(index < _vs.committed_size(), "index out of range"); |
174 assert(high >= low, "addresses out of order"); |
190 assert(high >= low, "addresses out of order"); |