1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/memory/metaspaceShared.hpp Sat Sep 01 13:25:18 2012 -0400 1.3 @@ -0,0 +1,86 @@ 1.4 +/* 1.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 +#ifndef SHARE_VM_MEMORY_METASPACE_SHARED_HPP 1.28 +#define SHARE_VM_MEMORY_METASPACE_SHARED_HPP 1.29 + 1.30 +#include "memory/allocation.hpp" 1.31 +#include "memory/memRegion.hpp" 1.32 +#include "runtime/virtualspace.hpp" 1.33 +#include "utilities/exceptions.hpp" 1.34 +#include "utilities/macros.hpp" 1.35 + 1.36 +class FileMapInfo; 1.37 + 1.38 +// Class Data Sharing Support 1.39 +class MetaspaceShared : AllStatic { 1.40 + 1.41 + // CDS support 1.42 + static ReservedSpace* _shared_rs; 1.43 + static int _max_alignment; 1.44 + 1.45 + public: 1.46 + enum { 1.47 + vtbl_list_size = 17, // number of entries in the shared space vtable list. 1.48 + num_virtuals = 200 // maximum number of virtual functions 1.49 + // If virtual functions are added to Metadata, 1.50 + // this number needs to be increased. Also, 1.51 + // SharedMiscCodeSize will need to be increased. 1.52 + }; 1.53 + 1.54 + enum { 1.55 + ro = 0, // read-only shared space in the heap 1.56 + rw = 1, // read-write shared space in the heap 1.57 + md = 2, // miscellaneous data for initializing tables, etc. 1.58 + mc = 3, // miscellaneous code - vtable replacement. 1.59 + n_regions = 4 1.60 + }; 1.61 + 1.62 + static void set_max_alignment(int alignment) KERNEL_RETURN; 1.63 + static int max_alignment() KERNEL_RETURN_(0); 1.64 + 1.65 + static void preload_and_dump(TRAPS) KERNEL_RETURN; 1.66 + static ReservedSpace* shared_rs(); 1.67 + static void set_shared_rs(ReservedSpace* rs) KERNEL_RETURN; 1.68 + 1.69 + static bool map_shared_spaces(FileMapInfo* mapinfo) KERNEL_RETURN_(false); 1.70 + static void initialize_shared_spaces() KERNEL_RETURN; 1.71 + 1.72 + // Return true if given address is in the mapped shared space. 1.73 + static bool is_in_shared_space(const void* p) KERNEL_RETURN_(false); 1.74 + 1.75 + static void generate_vtable_methods(void** vtbl_list, 1.76 + void** vtable, 1.77 + char** md_top, char* md_end, 1.78 + char** mc_top, char* mc_end); 1.79 + static void serialize(SerializeClosure* sc); 1.80 + 1.81 + // JVM/TI RedefineClasses() support: 1.82 + // Remap the shared readonly space to shared readwrite, private if 1.83 + // sharing is enabled. Simply returns true if sharing is not enabled 1.84 + // or if the remapping has already been done by a prior call. 1.85 + static bool remap_shared_readonly_as_readwrite() KERNEL_RETURN_(true); 1.86 + 1.87 + static void print_shared_spaces(); 1.88 +}; 1.89 +#endif // SHARE_VM_MEMORY_METASPACE_SHARED_HPP