comparison src/share/vm/memory/filemap.hpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents d2a62e0f25eb
children 716c64bda5ba
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2012, 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.
23 */ 23 */
24 24
25 #ifndef SHARE_VM_MEMORY_FILEMAP_HPP 25 #ifndef SHARE_VM_MEMORY_FILEMAP_HPP
26 #define SHARE_VM_MEMORY_FILEMAP_HPP 26 #define SHARE_VM_MEMORY_FILEMAP_HPP
27 27
28 #include "memory/compactingPermGenGen.hpp" 28 #include "memory/metaspaceShared.hpp"
29 #include "memory/space.hpp"
30 29
31 // Layout of the file: 30 // Layout of the file:
32 // header: dump of archive instance plus versioning info, datestamp, etc. 31 // header: dump of archive instance plus versioning info, datestamp, etc.
33 // [magic # = 0xF00BABA2] 32 // [magic # = 0xF00BABA2]
34 // ... padding to align on page-boundary 33 // ... padding to align on page-boundary
41 static const int JVM_SPACENAME_MAX = 128; 40 static const int JVM_SPACENAME_MAX = 128;
42 static const int JVM_IDENT_MAX = 256; 41 static const int JVM_IDENT_MAX = 256;
43 static const int JVM_ARCH_MAX = 12; 42 static const int JVM_ARCH_MAX = 12;
44 43
45 44
45 class Metaspace;
46 46
47 class FileMapInfo : public CHeapObj<mtInternal> { 47 class FileMapInfo : public CHeapObj<mtInternal> {
48 private: 48 private:
49 enum { 49 enum {
50 _invalid_version = -1, 50 _invalid_version = -1,
69 char* _base; // copy-on-write base address 69 char* _base; // copy-on-write base address
70 size_t _capacity; // for validity checking 70 size_t _capacity; // for validity checking
71 size_t _used; // for setting space top on read 71 size_t _used; // for setting space top on read
72 bool _read_only; // read only space? 72 bool _read_only; // read only space?
73 bool _allow_exec; // executable code in space? 73 bool _allow_exec; // executable code in space?
74 } _space[CompactingPermGenGen::n_regions]; 74 } _space[MetaspaceShared::n_regions];
75 75
76 // The following fields are all sanity checks for whether this archive 76 // The following fields are all sanity checks for whether this archive
77 // will function correctly with this JVM and the bootclasspath it's 77 // will function correctly with this JVM and the bootclasspath it's
78 // invoked with. 78 // invoked with.
79 char _arch[JVM_ARCH_MAX]; // architecture 79 char _arch[JVM_ARCH_MAX]; // architecture
118 // File manipulation. 118 // File manipulation.
119 bool initialize(); 119 bool initialize();
120 bool open_for_read(); 120 bool open_for_read();
121 void open_for_write(); 121 void open_for_write();
122 void write_header(); 122 void write_header();
123 void write_space(int i, CompactibleSpace* space, bool read_only); 123 void write_space(int i, Metaspace* space, bool read_only);
124 void write_region(int region, char* base, size_t size, 124 void write_region(int region, char* base, size_t size,
125 size_t capacity, bool read_only, bool allow_exec); 125 size_t capacity, bool read_only, bool allow_exec);
126 void write_bytes(const void* buffer, int count); 126 void write_bytes(const void* buffer, int count);
127 void write_bytes_aligned(const void* buffer, int count); 127 void write_bytes_aligned(const void* buffer, int count);
128 bool map_space(int i, ReservedSpace rs, ContiguousSpace *space);
129 char* map_region(int i, ReservedSpace rs); 128 char* map_region(int i, ReservedSpace rs);
130 char* map_region(int i, bool address_must_match); 129 char* map_region(int i);
131 void unmap_region(int i); 130 void unmap_region(int i);
132 void close(); 131 void close();
133 bool is_open() { return _file_open; } 132 bool is_open() { return _file_open; }
133 ReservedSpace reserve_shared_memory();
134 134
135 // JVM/TI RedefineClasses() support: 135 // JVM/TI RedefineClasses() support:
136 // Remap the shared readonly space to shared readwrite, private. 136 // Remap the shared readonly space to shared readwrite, private.
137 bool remap_shared_readonly_as_readwrite(); 137 bool remap_shared_readonly_as_readwrite();
138 138