Wed, 02 Nov 2011 08:04:23 +0100
7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
Summary: _cset_rs_update_cl[] was indexed with values beyond what it is set up to handle.
Reviewed-by: ysr, jmasa, johnc
ysr@777 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
ysr@777 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ysr@777 | 4 | * |
ysr@777 | 5 | * This code is free software; you can redistribute it and/or modify it |
ysr@777 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ysr@777 | 7 | * published by the Free Software Foundation. |
ysr@777 | 8 | * |
ysr@777 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ysr@777 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ysr@777 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ysr@777 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
ysr@777 | 13 | * accompanied this code). |
ysr@777 | 14 | * |
ysr@777 | 15 | * You should have received a copy of the GNU General Public License version |
ysr@777 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
ysr@777 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ysr@777 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
ysr@777 | 22 | * |
ysr@777 | 23 | */ |
ysr@777 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINETHREAD_HPP |
stefank@2314 | 26 | #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINETHREAD_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "gc_implementation/shared/concurrentGCThread.hpp" |
stefank@2314 | 29 | |
ysr@777 | 30 | // Forward Decl. |
ysr@777 | 31 | class ConcurrentG1Refine; |
ysr@777 | 32 | |
ysr@777 | 33 | // The G1 Concurrent Refinement Thread (could be several in the future). |
ysr@777 | 34 | |
ysr@777 | 35 | class ConcurrentG1RefineThread: public ConcurrentGCThread { |
ysr@777 | 36 | friend class VMStructs; |
ysr@777 | 37 | friend class G1CollectedHeap; |
ysr@777 | 38 | |
ysr@777 | 39 | double _vtime_start; // Initial virtual time. |
ysr@777 | 40 | double _vtime_accum; // Initial virtual time. |
iveresov@1229 | 41 | int _worker_id; |
iveresov@1230 | 42 | int _worker_id_offset; |
ysr@777 | 43 | |
iveresov@1229 | 44 | // The refinement threads collection is linked list. A predecessor can activate a successor |
iveresov@1229 | 45 | // when the number of the rset update buffer crosses a certain threshold. A successor |
iveresov@1229 | 46 | // would self-deactivate when the number of the buffers falls below the threshold. |
iveresov@1229 | 47 | bool _active; |
iveresov@1546 | 48 | ConcurrentG1RefineThread* _next; |
iveresov@1546 | 49 | Monitor* _monitor; |
iveresov@1546 | 50 | ConcurrentG1Refine* _cg1r; |
ysr@777 | 51 | |
iveresov@1546 | 52 | int _thread_threshold_step; |
iveresov@1546 | 53 | // This thread activation threshold |
iveresov@1546 | 54 | int _threshold; |
iveresov@1546 | 55 | // This thread deactivation threshold |
iveresov@1546 | 56 | int _deactivation_threshold; |
iveresov@1229 | 57 | |
iveresov@1546 | 58 | void sample_young_list_rs_lengths(); |
iveresov@1546 | 59 | void run_young_rs_sampling(); |
iveresov@1546 | 60 | void wait_for_completed_buffers(); |
ysr@777 | 61 | |
iveresov@1546 | 62 | void set_active(bool x) { _active = x; } |
iveresov@1546 | 63 | bool is_active(); |
iveresov@1546 | 64 | void activate(); |
iveresov@1546 | 65 | void deactivate(); |
ysr@777 | 66 | |
ysr@777 | 67 | // For use by G1CollectedHeap, which is a friend. |
ysr@777 | 68 | static SuspendibleThreadSet* sts() { return &_sts; } |
ysr@777 | 69 | |
iveresov@1546 | 70 | public: |
iveresov@1546 | 71 | virtual void run(); |
ysr@777 | 72 | // Constructor |
iveresov@1230 | 73 | ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread* next, |
iveresov@1230 | 74 | int worker_id_offset, int worker_id); |
ysr@777 | 75 | |
iveresov@1546 | 76 | void initialize(); |
iveresov@1546 | 77 | |
ysr@777 | 78 | // Printing |
tonyp@1454 | 79 | void print() const; |
tonyp@1454 | 80 | void print_on(outputStream* st) const; |
ysr@777 | 81 | |
ysr@777 | 82 | // Total virtual time so far. |
ysr@777 | 83 | double vtime_accum() { return _vtime_accum; } |
ysr@777 | 84 | |
iveresov@1546 | 85 | ConcurrentG1Refine* cg1r() { return _cg1r; } |
ysr@777 | 86 | |
ysr@777 | 87 | // Yield for GC |
iveresov@1546 | 88 | void yield(); |
ysr@777 | 89 | // shutdown |
iveresov@1229 | 90 | void stop(); |
ysr@777 | 91 | }; |
stefank@2314 | 92 | |
stefank@2314 | 93 | #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINETHREAD_HPP |