src/share/vm/memory/generationSpec.hpp

Mon, 29 Apr 2013 16:13:57 -0400

author
hseigel
date
Mon, 29 Apr 2013 16:13:57 -0400
changeset 4987
f258c5828eb8
parent 4037
da91efe96a93
child 6876
710a3c8b516e
permissions
-rw-r--r--

8011773: Some tests on Interned String crashed JVM with OOM
Summary: Instead of terminating the VM, throw OutOfMemoryError exceptions.
Reviewed-by: coleenp, dholmes

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 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.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_MEMORY_GENERATIONSPEC_HPP
stefank@2314 26 #define SHARE_VM_MEMORY_GENERATIONSPEC_HPP
stefank@2314 27
stefank@2314 28 #include "memory/generation.hpp"
stefank@2314 29
duke@435 30 // The specification of a generation. This class also encapsulates
duke@435 31 // some generation-specific behavior. This is done here rather than as a
duke@435 32 // virtual function of Generation because these methods are needed in
duke@435 33 // initialization of the Generations.
zgu@3900 34 class GenerationSpec : public CHeapObj<mtGC> {
duke@435 35 friend class VMStructs;
duke@435 36 private:
duke@435 37 Generation::Name _name;
duke@435 38 size_t _init_size;
duke@435 39 size_t _max_size;
duke@435 40
duke@435 41 public:
duke@435 42 GenerationSpec(Generation::Name name, size_t init_size, size_t max_size) {
duke@435 43 _name = name;
duke@435 44 _init_size = init_size;
duke@435 45 _max_size = max_size;
duke@435 46 }
duke@435 47
duke@435 48 Generation* init(ReservedSpace rs, int level, GenRemSet* remset);
duke@435 49
duke@435 50 // Accessors
duke@435 51 Generation::Name name() const { return _name; }
duke@435 52 size_t init_size() const { return _init_size; }
duke@435 53 void set_init_size(size_t size) { _init_size = size; }
duke@435 54 size_t max_size() const { return _max_size; }
duke@435 55 void set_max_size(size_t size) { _max_size = size; }
duke@435 56
duke@435 57 // Alignment
duke@435 58 void align(size_t alignment) {
duke@435 59 set_init_size(align_size_up(init_size(), alignment));
duke@435 60 set_max_size(align_size_up(max_size(), alignment));
duke@435 61 }
duke@435 62
duke@435 63 // Return the number of regions contained in the generation which
duke@435 64 // might need to be independently covered by a remembered set.
duke@435 65 virtual int n_covered_regions() const { return 1; }
duke@435 66 };
duke@435 67
duke@435 68 typedef GenerationSpec* GenerationSpecPtr;
duke@435 69
stefank@2314 70 #endif // SHARE_VM_MEMORY_GENERATIONSPEC_HPP

mercurial