comparison src/share/vm/utilities/workgroup.cpp @ 10408:836a62f43af9

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 19 Jun 2013 10:45:56 +0200
parents f9be75d21404
children 78bbf4d43a14
comparison
equal deleted inserted replaced
10086:e0fb8a213650 10408:836a62f43af9
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.
77 name(), 77 name(),
78 total_workers()); 78 total_workers());
79 } 79 }
80 _gang_workers = NEW_C_HEAP_ARRAY(GangWorker*, total_workers(), mtInternal); 80 _gang_workers = NEW_C_HEAP_ARRAY(GangWorker*, total_workers(), mtInternal);
81 if (gang_workers() == NULL) { 81 if (gang_workers() == NULL) {
82 vm_exit_out_of_memory(0, "Cannot create GangWorker array."); 82 vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GangWorker array.");
83 return false; 83 return false;
84 } 84 }
85 os::ThreadType worker_type; 85 os::ThreadType worker_type;
86 if (are_ConcurrentGC_threads()) { 86 if (are_ConcurrentGC_threads()) {
87 worker_type = os::cgc_thread; 87 worker_type = os::cgc_thread;
91 for (uint worker = 0; worker < total_workers(); worker += 1) { 91 for (uint worker = 0; worker < total_workers(); worker += 1) {
92 GangWorker* new_worker = allocate_worker(worker); 92 GangWorker* new_worker = allocate_worker(worker);
93 assert(new_worker != NULL, "Failed to allocate GangWorker"); 93 assert(new_worker != NULL, "Failed to allocate GangWorker");
94 _gang_workers[worker] = new_worker; 94 _gang_workers[worker] = new_worker;
95 if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) { 95 if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) {
96 vm_exit_out_of_memory(0, "Cannot create worker GC thread. Out of system resources."); 96 vm_exit_out_of_memory(0, OOM_MALLOC_ERROR,
97 "Cannot create worker GC thread. Out of system resources.");
97 return false; 98 return false;
98 } 99 }
99 if (!DisableStartThread) { 100 if (!DisableStartThread) {
100 os::start_thread(new_worker); 101 os::start_thread(new_worker);
101 } 102 }
526 bool FreeIdSet::_safepoint; 527 bool FreeIdSet::_safepoint;
527 528
528 FreeIdSet::FreeIdSet(int sz, Monitor* mon) : 529 FreeIdSet::FreeIdSet(int sz, Monitor* mon) :
529 _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)
530 { 531 {
531 _ids = new int[sz]; 532 _ids = NEW_C_HEAP_ARRAY(int, sz, mtInternal);
532 for (int i = 0; i < sz; i++) _ids[i] = i+1; 533 for (int i = 0; i < sz; i++) _ids[i] = i+1;
533 _ids[sz-1] = end_of_list; // end of list. 534 _ids[sz-1] = end_of_list; // end of list.
534 if (_stat_init) { 535 if (_stat_init) {
535 for (int j = 0; j < NSets; j++) _sets[j] = NULL; 536 for (int j = 0; j < NSets; j++) _sets[j] = NULL;
536 _stat_init = true; 537 _stat_init = true;
546 guarantee(_index != -1, "Too many FreeIdSets in use!"); 547 guarantee(_index != -1, "Too many FreeIdSets in use!");
547 } 548 }
548 549
549 FreeIdSet::~FreeIdSet() { 550 FreeIdSet::~FreeIdSet() {
550 _sets[_index] = NULL; 551 _sets[_index] = NULL;
552 FREE_C_HEAP_ARRAY(int, _ids, mtInternal);
551 } 553 }
552 554
553 void FreeIdSet::set_safepoint(bool b) { 555 void FreeIdSet::set_safepoint(bool b) {
554 _safepoint = b; 556 _safepoint = b;
555 if (b) { 557 if (b) {