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 | /* |
brutisso@2532 | 2 | * Copyright (c) 2001, 2011, 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_VM_OPERATIONS_G1_HPP |
stefank@2314 | 26 | #define SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "gc_implementation/shared/vmGCOperations.hpp" |
stefank@2314 | 29 | |
ysr@777 | 30 | // VM_operations for the G1 collector. |
ysr@777 | 31 | // VM_GC_Operation: |
ysr@777 | 32 | // - VM_CGC_Operation |
ysr@777 | 33 | // - VM_G1CollectFull |
tonyp@2315 | 34 | // - VM_G1OperationWithAllocRequest |
tonyp@2315 | 35 | // - VM_G1CollectForAllocation |
tonyp@2315 | 36 | // - VM_G1IncCollectionPause |
tonyp@2315 | 37 | |
tonyp@2315 | 38 | class VM_G1OperationWithAllocRequest: public VM_GC_Operation { |
tonyp@2315 | 39 | protected: |
tonyp@2315 | 40 | size_t _word_size; |
tonyp@2315 | 41 | HeapWord* _result; |
tonyp@2315 | 42 | bool _pause_succeeded; |
tonyp@2315 | 43 | |
tonyp@2315 | 44 | public: |
tonyp@2315 | 45 | VM_G1OperationWithAllocRequest(unsigned int gc_count_before, |
tonyp@2315 | 46 | size_t word_size) |
brutisso@2532 | 47 | : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure), |
tonyp@2315 | 48 | _word_size(word_size), _result(NULL), _pause_succeeded(false) { } |
tonyp@2315 | 49 | HeapWord* result() { return _result; } |
tonyp@2315 | 50 | bool pause_succeeded() { return _pause_succeeded; } |
tonyp@2315 | 51 | }; |
ysr@777 | 52 | |
ysr@777 | 53 | class VM_G1CollectFull: public VM_GC_Operation { |
tonyp@2315 | 54 | public: |
tonyp@2011 | 55 | VM_G1CollectFull(unsigned int gc_count_before, |
tonyp@2011 | 56 | unsigned int full_gc_count_before, |
tonyp@2011 | 57 | GCCause::Cause cause) |
brutisso@2532 | 58 | : VM_GC_Operation(gc_count_before, cause, full_gc_count_before) { } |
ysr@777 | 59 | virtual VMOp_Type type() const { return VMOp_G1CollectFull; } |
ysr@777 | 60 | virtual void doit(); |
ysr@777 | 61 | virtual const char* name() const { |
ysr@777 | 62 | return "full garbage-first collection"; |
ysr@777 | 63 | } |
ysr@777 | 64 | }; |
ysr@777 | 65 | |
tonyp@2315 | 66 | class VM_G1CollectForAllocation: public VM_G1OperationWithAllocRequest { |
tonyp@2315 | 67 | public: |
tonyp@2315 | 68 | VM_G1CollectForAllocation(unsigned int gc_count_before, |
tonyp@2315 | 69 | size_t word_size); |
ysr@777 | 70 | virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; } |
ysr@777 | 71 | virtual void doit(); |
ysr@777 | 72 | virtual const char* name() const { |
ysr@777 | 73 | return "garbage-first collection to satisfy allocation"; |
ysr@777 | 74 | } |
ysr@777 | 75 | }; |
ysr@777 | 76 | |
tonyp@2315 | 77 | class VM_G1IncCollectionPause: public VM_G1OperationWithAllocRequest { |
tonyp@2011 | 78 | private: |
tonyp@2315 | 79 | bool _should_initiate_conc_mark; |
tonyp@2315 | 80 | double _target_pause_time_ms; |
tonyp@2011 | 81 | unsigned int _full_collections_completed_before; |
tonyp@2011 | 82 | public: |
tonyp@2011 | 83 | VM_G1IncCollectionPause(unsigned int gc_count_before, |
tonyp@2315 | 84 | size_t word_size, |
tonyp@2011 | 85 | bool should_initiate_conc_mark, |
tonyp@2011 | 86 | double target_pause_time_ms, |
tonyp@2315 | 87 | GCCause::Cause gc_cause); |
ysr@777 | 88 | virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; } |
ysr@777 | 89 | virtual void doit(); |
tonyp@2011 | 90 | virtual void doit_epilogue(); |
ysr@777 | 91 | virtual const char* name() const { |
ysr@777 | 92 | return "garbage-first incremental collection pause"; |
ysr@777 | 93 | } |
ysr@777 | 94 | }; |
ysr@777 | 95 | |
johnc@3218 | 96 | // Concurrent GC stop-the-world operations such as remark and cleanup; |
ysr@777 | 97 | // consider sharing these with CMS's counterparts. |
ysr@777 | 98 | class VM_CGC_Operation: public VM_Operation { |
ysr@777 | 99 | VoidClosure* _cl; |
ysr@777 | 100 | const char* _printGCMessage; |
johnc@3218 | 101 | |
johnc@3218 | 102 | protected: |
johnc@3218 | 103 | // java.lang.ref.Reference support |
johnc@3218 | 104 | void acquire_pending_list_lock(); |
johnc@3218 | 105 | void release_and_notify_pending_list_lock(); |
johnc@3218 | 106 | |
tonyp@2315 | 107 | public: |
tonyp@2315 | 108 | VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg) |
tonyp@2315 | 109 | : _cl(cl), _printGCMessage(printGCMsg) { } |
ysr@777 | 110 | virtual VMOp_Type type() const { return VMOp_CGC_Operation; } |
ysr@777 | 111 | virtual void doit(); |
ysr@777 | 112 | virtual bool doit_prologue(); |
ysr@777 | 113 | virtual void doit_epilogue(); |
ysr@777 | 114 | virtual const char* name() const { |
ysr@777 | 115 | return "concurrent gc"; |
ysr@777 | 116 | } |
ysr@777 | 117 | }; |
stefank@2314 | 118 | |
stefank@2314 | 119 | #endif // SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP |