comparison src/share/vm/utilities/workgroup.cpp @ 10271:f9be75d21404

8012902: remove use of global operator new - take 2 Summary: The fix of 8010992, disable use of global operator new and new[] which caused failure on some tests. This takes two of the bugs also add ALLOW_OPERATOR_NEW_USAGE to prevent crash for third party code calling operator new of jvm on certain platforms. Reviewed-by: coleenp, dholmes, zgu Contributed-by: yumin.qi@oracle.com
author minqi
date Tue, 14 May 2013 09:41:12 -0700
parents 746b070f5022
children 78bbf4d43a14
comparison
equal deleted inserted replaced
10269:a9270d9ecb13 10271:f9be75d21404
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) {