comparison src/share/vm/gc_implementation/shared/vmGCOperations.hpp @ 22936:fb69749583e8

8072621: Clean up around VM_GC_Operations Reviewed-by: brutisso, jmasa
author mlarsson
date Thu, 09 Apr 2015 15:58:49 +0200
parents 2c6ef90f030a
children af8f16ac392c
comparison
equal deleted inserted replaced
22935:bff23dedb306 22936:fb69749583e8
1 /* 1 /*
2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2005, 2015, 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.
64 // different kind 64 // different kind
65 // 65 //
66 66
67 class VM_GC_Operation: public VM_Operation { 67 class VM_GC_Operation: public VM_Operation {
68 protected: 68 protected:
69 BasicLock _pending_list_basic_lock; // for refs pending list notification (PLL) 69 BasicLock _pending_list_basic_lock; // for refs pending list notification (PLL)
70 unsigned int _gc_count_before; // gc count before acquiring PLL 70 uint _gc_count_before; // gc count before acquiring PLL
71 unsigned int _full_gc_count_before; // full gc count before acquiring PLL 71 uint _full_gc_count_before; // full gc count before acquiring PLL
72 bool _full; // whether a "full" collection 72 bool _full; // whether a "full" collection
73 bool _prologue_succeeded; // whether doit_prologue succeeded 73 bool _prologue_succeeded; // whether doit_prologue succeeded
74 GCCause::Cause _gc_cause; // the putative cause for this gc op 74 GCCause::Cause _gc_cause; // the putative cause for this gc op
75 bool _gc_locked; // will be set if gc was locked 75 bool _gc_locked; // will be set if gc was locked
76 76
77 virtual bool skip_operation() const; 77 virtual bool skip_operation() const;
78 78
79 // java.lang.ref.Reference support 79 // java.lang.ref.Reference support
80 void acquire_pending_list_lock(); 80 void acquire_pending_list_lock();
81 void release_and_notify_pending_list_lock(); 81 void release_and_notify_pending_list_lock();
82 82
83 public: 83 public:
84 VM_GC_Operation(unsigned int gc_count_before, 84 VM_GC_Operation(uint gc_count_before,
85 GCCause::Cause _cause, 85 GCCause::Cause _cause,
86 unsigned int full_gc_count_before = 0, 86 uint full_gc_count_before = 0,
87 bool full = false) { 87 bool full = false) {
88 _full = full; 88 _full = full;
89 _prologue_succeeded = false; 89 _prologue_succeeded = false;
90 _gc_count_before = gc_count_before; 90 _gc_count_before = gc_count_before;
91 91
167 size_t _size; // size of object to be allocated. 167 size_t _size; // size of object to be allocated.
168 bool _tlab; // alloc is of a tlab. 168 bool _tlab; // alloc is of a tlab.
169 public: 169 public:
170 VM_GenCollectForAllocation(size_t size, 170 VM_GenCollectForAllocation(size_t size,
171 bool tlab, 171 bool tlab,
172 unsigned int gc_count_before) 172 uint gc_count_before)
173 : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure), 173 : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure),
174 _size(size), 174 _size(size),
175 _tlab(tlab) { 175 _tlab(tlab) {
176 _res = NULL; 176 _res = NULL;
177 } 177 }
179 virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; } 179 virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; }
180 virtual void doit(); 180 virtual void doit();
181 HeapWord* result() const { return _res; } 181 HeapWord* result() const { return _res; }
182 }; 182 };
183 183
184
185 // VM operation to invoke a collection of the heap as a 184 // VM operation to invoke a collection of the heap as a
186 // GenCollectedHeap heap. 185 // GenCollectedHeap heap.
187 class VM_GenCollectFull: public VM_GC_Operation { 186 class VM_GenCollectFull: public VM_GC_Operation {
188 private: 187 private:
189 int _max_level; 188 int _max_level;
190 public: 189 public:
191 VM_GenCollectFull(unsigned int gc_count_before, 190 VM_GenCollectFull(uint gc_count_before,
192 unsigned int full_gc_count_before, 191 uint full_gc_count_before,
193 GCCause::Cause gc_cause, 192 GCCause::Cause gc_cause,
194 int max_level) 193 int max_level)
195 : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */), 194 : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */),
196 _max_level(max_level) { } 195 _max_level(max_level) { }
197 ~VM_GenCollectFull() {} 196 ~VM_GenCollectFull() {}
198 virtual VMOp_Type type() const { return VMOp_GenCollectFull; } 197 virtual VMOp_Type type() const { return VMOp_GenCollectFull; }
199 virtual void doit(); 198 virtual void doit();
206 Metaspace::MetadataType _mdtype; 205 Metaspace::MetadataType _mdtype;
207 ClassLoaderData* _loader_data; 206 ClassLoaderData* _loader_data;
208 public: 207 public:
209 VM_CollectForMetadataAllocation(ClassLoaderData* loader_data, 208 VM_CollectForMetadataAllocation(ClassLoaderData* loader_data,
210 size_t size, Metaspace::MetadataType mdtype, 209 size_t size, Metaspace::MetadataType mdtype,
211 unsigned int gc_count_before, 210 uint gc_count_before,
212 unsigned int full_gc_count_before, 211 uint full_gc_count_before,
213 GCCause::Cause gc_cause) 212 GCCause::Cause gc_cause)
214 : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true), 213 : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true),
215 _loader_data(loader_data), _size(size), _mdtype(mdtype), _result(NULL) { 214 _loader_data(loader_data), _size(size), _mdtype(mdtype), _result(NULL) {
216 } 215 }
217 virtual VMOp_Type type() const { return VMOp_CollectForMetadataAllocation; } 216 virtual VMOp_Type type() const { return VMOp_CollectForMetadataAllocation; }
218 virtual void doit(); 217 virtual void doit();