equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2018, 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. |
317 _max_blocks = (max_elements + bits_per_block - 1) / bits_per_block; |
317 _max_blocks = (max_elements + bits_per_block - 1) / bits_per_block; |
318 |
318 |
319 if (_max_blocks <= preallocated_block_list_size) { |
319 if (_max_blocks <= preallocated_block_list_size) { |
320 _blocks = _preallocated_block_list; |
320 _blocks = _preallocated_block_list; |
321 } else { |
321 } else { |
322 _blocks = (IndexSet::BitBlock**) arena()->Amalloc_4(sizeof(IndexSet::BitBlock**) * _max_blocks); |
322 _blocks = (IndexSet::BitBlock**) arena()->Amalloc_4(sizeof(IndexSet::BitBlock*) * _max_blocks); |
323 } |
323 } |
324 for (uint i = 0; i < _max_blocks; i++) { |
324 for (uint i = 0; i < _max_blocks; i++) { |
325 set_block(i, &_empty_block); |
325 set_block(i, &_empty_block); |
326 } |
326 } |
327 } |
327 } |
341 _max_blocks = (max_elements + bits_per_block - 1) / bits_per_block; |
341 _max_blocks = (max_elements + bits_per_block - 1) / bits_per_block; |
342 |
342 |
343 if (_max_blocks <= preallocated_block_list_size) { |
343 if (_max_blocks <= preallocated_block_list_size) { |
344 _blocks = _preallocated_block_list; |
344 _blocks = _preallocated_block_list; |
345 } else { |
345 } else { |
346 _blocks = (IndexSet::BitBlock**) arena->Amalloc_4(sizeof(IndexSet::BitBlock**) * _max_blocks); |
346 _blocks = (IndexSet::BitBlock**) arena->Amalloc_4(sizeof(IndexSet::BitBlock*) * _max_blocks); |
347 } |
347 } |
348 for (uint i = 0; i < _max_blocks; i++) { |
348 for (uint i = 0; i < _max_blocks; i++) { |
349 set_block(i, &_empty_block); |
349 set_block(i, &_empty_block); |
350 } |
350 } |
351 } |
351 } |