Tue, 11 May 2010 14:35:43 -0700
6931180: Migration to recent versions of MS Platform SDK
6951582: Build problems on win64
Summary: Changes to enable building JDK7 with Microsoft Visual Studio 2010
Reviewed-by: ohair, art, ccheung, dcubed
duke@435 | 1 | /* |
xdono@631 | 2 | * Copyright 2003-2008 Sun Microsystems, Inc. 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 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | # include "incls/_precompiled.incl" |
duke@435 | 26 | # include "incls/_restore.cpp.incl" |
duke@435 | 27 | |
duke@435 | 28 | |
duke@435 | 29 | // Closure for serializing initialization data in from a data area |
duke@435 | 30 | // (oop_array) read from the shared file. |
duke@435 | 31 | |
duke@435 | 32 | class ReadClosure : public SerializeOopClosure { |
duke@435 | 33 | private: |
duke@435 | 34 | oop** _oop_array; |
duke@435 | 35 | |
duke@435 | 36 | inline oop nextOop() { |
duke@435 | 37 | return *(*_oop_array)++; |
duke@435 | 38 | } |
duke@435 | 39 | |
duke@435 | 40 | public: |
duke@435 | 41 | ReadClosure(oop** oop_array) { _oop_array = oop_array; } |
duke@435 | 42 | |
duke@435 | 43 | void do_oop(oop* p) { |
duke@435 | 44 | assert(SharedSkipVerify || *p == NULL || *p == Universe::klassKlassObj(), |
duke@435 | 45 | "initializing previously initialized oop."); |
duke@435 | 46 | oop obj = nextOop(); |
duke@435 | 47 | assert(SharedSkipVerify || (intptr_t)obj >= 0 || (intptr_t)obj < -100, |
duke@435 | 48 | "hit tag while initializing oops."); |
duke@435 | 49 | assert(SharedSkipVerify || obj->is_oop_or_null(), "invalid oop"); |
duke@435 | 50 | *p = obj; |
duke@435 | 51 | } |
duke@435 | 52 | |
coleenp@548 | 53 | void do_oop(narrowOop* p) { ShouldNotReachHere(); } |
coleenp@548 | 54 | |
duke@435 | 55 | void do_ptr(void** p) { |
duke@435 | 56 | assert(*p == NULL, "initializing previous initialized pointer."); |
duke@435 | 57 | void* obj = nextOop(); |
duke@435 | 58 | assert((intptr_t)obj >= 0 || (intptr_t)obj < -100, |
duke@435 | 59 | "hit tag while initializing ptrs."); |
duke@435 | 60 | *p = obj; |
duke@435 | 61 | } |
duke@435 | 62 | |
duke@435 | 63 | void do_ptr(HeapWord** p) { do_ptr((void **) p); } |
duke@435 | 64 | |
duke@435 | 65 | void do_int(int* p) { |
duke@435 | 66 | *p = (int)(intptr_t)nextOop(); |
duke@435 | 67 | } |
duke@435 | 68 | |
duke@435 | 69 | void do_size_t(size_t* p) { |
duke@435 | 70 | // Assumes that size_t and pointers are the same size. |
duke@435 | 71 | *p = (size_t)nextOop(); |
duke@435 | 72 | } |
duke@435 | 73 | |
duke@435 | 74 | void do_tag(int tag) { |
duke@435 | 75 | int old_tag; |
duke@435 | 76 | do_int(&old_tag); |
duke@435 | 77 | FileMapInfo::assert_mark(tag == old_tag); |
duke@435 | 78 | } |
duke@435 | 79 | |
duke@435 | 80 | void do_region(u_char* start, size_t size) { |
duke@435 | 81 | assert((intptr_t)start % sizeof(oop) == 0, "bad alignment"); |
duke@435 | 82 | assert(size % sizeof(oop) == 0, "bad size"); |
duke@435 | 83 | do_tag((int)size); |
duke@435 | 84 | while (size > 0) { |
duke@435 | 85 | *(oop*)start = nextOop(); |
duke@435 | 86 | start += sizeof(oop); |
duke@435 | 87 | size -= sizeof(oop); |
duke@435 | 88 | } |
duke@435 | 89 | } |
duke@435 | 90 | |
duke@435 | 91 | bool reading() const { return true; } |
duke@435 | 92 | }; |
duke@435 | 93 | |
duke@435 | 94 | |
duke@435 | 95 | // Read the oop and miscellaneous data from the shared file, and |
duke@435 | 96 | // serialize it out to its various destinations. |
duke@435 | 97 | |
duke@435 | 98 | void CompactingPermGenGen::initialize_oops() { |
duke@435 | 99 | FileMapInfo *mapinfo = FileMapInfo::current_info(); |
duke@435 | 100 | |
duke@435 | 101 | char* buffer = mapinfo->region_base(md); |
duke@435 | 102 | |
duke@435 | 103 | // Skip over (reserve space for) a list of addresses of C++ vtables |
duke@435 | 104 | // for Klass objects. They get filled in later. |
duke@435 | 105 | |
duke@435 | 106 | // Skip over (reserve space for) dummy C++ vtables Klass objects. |
duke@435 | 107 | // They are used as is. |
duke@435 | 108 | |
duke@435 | 109 | void** vtbl_list = (void**)buffer; |
duke@435 | 110 | buffer += vtbl_list_size * sizeof(void*); |
duke@435 | 111 | intptr_t vtable_size = *(intptr_t*)buffer; |
duke@435 | 112 | buffer += sizeof(intptr_t); |
duke@435 | 113 | buffer += vtable_size; |
duke@435 | 114 | |
duke@435 | 115 | // Create the symbol table using the bucket array at this spot in the |
duke@435 | 116 | // misc data space. Since the symbol table is often modified, this |
duke@435 | 117 | // region (of mapped pages) will be copy-on-write. |
duke@435 | 118 | |
duke@435 | 119 | int symbolTableLen = *(intptr_t*)buffer; |
duke@435 | 120 | buffer += sizeof(intptr_t); |
duke@435 | 121 | int number_of_entries = *(intptr_t*)buffer; |
duke@435 | 122 | buffer += sizeof(intptr_t); |
duke@435 | 123 | SymbolTable::create_table((HashtableBucket*)buffer, symbolTableLen, |
duke@435 | 124 | number_of_entries); |
duke@435 | 125 | buffer += symbolTableLen; |
duke@435 | 126 | |
duke@435 | 127 | // Create the string table using the bucket array at this spot in the |
duke@435 | 128 | // misc data space. Since the string table is often modified, this |
duke@435 | 129 | // region (of mapped pages) will be copy-on-write. |
duke@435 | 130 | |
duke@435 | 131 | int stringTableLen = *(intptr_t*)buffer; |
duke@435 | 132 | buffer += sizeof(intptr_t); |
duke@435 | 133 | number_of_entries = *(intptr_t*)buffer; |
duke@435 | 134 | buffer += sizeof(intptr_t); |
duke@435 | 135 | StringTable::create_table((HashtableBucket*)buffer, stringTableLen, |
duke@435 | 136 | number_of_entries); |
duke@435 | 137 | buffer += stringTableLen; |
duke@435 | 138 | |
duke@435 | 139 | // Create the shared dictionary using the bucket array at this spot in |
duke@435 | 140 | // the misc data space. Since the shared dictionary table is never |
duke@435 | 141 | // modified, this region (of mapped pages) will be (effectively, if |
duke@435 | 142 | // not explicitly) read-only. |
duke@435 | 143 | |
duke@435 | 144 | int sharedDictionaryLen = *(intptr_t*)buffer; |
duke@435 | 145 | buffer += sizeof(intptr_t); |
duke@435 | 146 | number_of_entries = *(intptr_t*)buffer; |
duke@435 | 147 | buffer += sizeof(intptr_t); |
duke@435 | 148 | SystemDictionary::set_shared_dictionary((HashtableBucket*)buffer, |
duke@435 | 149 | sharedDictionaryLen, |
duke@435 | 150 | number_of_entries); |
duke@435 | 151 | buffer += sharedDictionaryLen; |
duke@435 | 152 | |
duke@435 | 153 | // Create the package info table using the bucket array at this spot in |
duke@435 | 154 | // the misc data space. Since the package info table is never |
duke@435 | 155 | // modified, this region (of mapped pages) will be (effectively, if |
duke@435 | 156 | // not explicitly) read-only. |
duke@435 | 157 | |
duke@435 | 158 | int pkgInfoLen = *(intptr_t*)buffer; |
duke@435 | 159 | buffer += sizeof(intptr_t); |
duke@435 | 160 | number_of_entries = *(intptr_t*)buffer; |
duke@435 | 161 | buffer += sizeof(intptr_t); |
duke@435 | 162 | ClassLoader::create_package_info_table((HashtableBucket*)buffer, pkgInfoLen, |
duke@435 | 163 | number_of_entries); |
duke@435 | 164 | buffer += pkgInfoLen; |
duke@435 | 165 | ClassLoader::verify(); |
duke@435 | 166 | |
duke@435 | 167 | // The following data in the shared misc data region are the linked |
duke@435 | 168 | // list elements (HashtableEntry objects) for the symbol table, string |
duke@435 | 169 | // table, and shared dictionary. The heap objects refered to by the |
duke@435 | 170 | // symbol table, string table, and shared dictionary are permanent and |
duke@435 | 171 | // unmovable. Since new entries added to the string and symbol tables |
duke@435 | 172 | // are always added at the beginning of the linked lists, THESE LINKED |
duke@435 | 173 | // LIST ELEMENTS ARE READ-ONLY. |
duke@435 | 174 | |
duke@435 | 175 | int len = *(intptr_t*)buffer; // skip over symbol table entries |
duke@435 | 176 | buffer += sizeof(intptr_t); |
duke@435 | 177 | buffer += len; |
duke@435 | 178 | |
duke@435 | 179 | len = *(intptr_t*)buffer; // skip over string table entries |
duke@435 | 180 | buffer += sizeof(intptr_t); |
duke@435 | 181 | buffer += len; |
duke@435 | 182 | |
duke@435 | 183 | len = *(intptr_t*)buffer; // skip over shared dictionary entries |
duke@435 | 184 | buffer += sizeof(intptr_t); |
duke@435 | 185 | buffer += len; |
duke@435 | 186 | |
duke@435 | 187 | len = *(intptr_t*)buffer; // skip over package info table entries |
duke@435 | 188 | buffer += sizeof(intptr_t); |
duke@435 | 189 | buffer += len; |
duke@435 | 190 | |
duke@435 | 191 | len = *(intptr_t*)buffer; // skip over package info table char[] arrays. |
duke@435 | 192 | buffer += sizeof(intptr_t); |
duke@435 | 193 | buffer += len; |
duke@435 | 194 | |
duke@435 | 195 | oop* oop_array = (oop*)buffer; |
duke@435 | 196 | ReadClosure rc(&oop_array); |
duke@435 | 197 | serialize_oops(&rc); |
duke@435 | 198 | } |