1 /* |
1 /* |
2 * Copyright (c) 2001, 2013, 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. |
526 bool FreeIdSet::_safepoint; |
526 bool FreeIdSet::_safepoint; |
527 |
527 |
528 FreeIdSet::FreeIdSet(int sz, Monitor* mon) : |
528 FreeIdSet::FreeIdSet(int sz, Monitor* mon) : |
529 _sz(sz), _mon(mon), _hd(0), _waiters(0), _index(-1), _claimed(0) |
529 _sz(sz), _mon(mon), _hd(0), _waiters(0), _index(-1), _claimed(0) |
530 { |
530 { |
531 _ids = NEW_C_HEAP_ARRAY(int, sz, mtInternal); |
531 _ids = new int[sz]; |
532 for (int i = 0; i < sz; i++) _ids[i] = i+1; |
532 for (int i = 0; i < sz; i++) _ids[i] = i+1; |
533 _ids[sz-1] = end_of_list; // end of list. |
533 _ids[sz-1] = end_of_list; // end of list. |
534 if (_stat_init) { |
534 if (_stat_init) { |
535 for (int j = 0; j < NSets; j++) _sets[j] = NULL; |
535 for (int j = 0; j < NSets; j++) _sets[j] = NULL; |
536 _stat_init = true; |
536 _stat_init = true; |
546 guarantee(_index != -1, "Too many FreeIdSets in use!"); |
546 guarantee(_index != -1, "Too many FreeIdSets in use!"); |
547 } |
547 } |
548 |
548 |
549 FreeIdSet::~FreeIdSet() { |
549 FreeIdSet::~FreeIdSet() { |
550 _sets[_index] = NULL; |
550 _sets[_index] = NULL; |
551 FREE_C_HEAP_ARRAY(int, _ids, mtInternal); |
|
552 } |
551 } |
553 |
552 |
554 void FreeIdSet::set_safepoint(bool b) { |
553 void FreeIdSet::set_safepoint(bool b) { |
555 _safepoint = b; |
554 _safepoint = b; |
556 if (b) { |
555 if (b) { |