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