1879N/A * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A#
ifndef O_BINARY // if defined (Win32) use binary files. 605N/A// Complain and stop. All error conditions occurring during the writing of 0N/A// an archive file should stop the process. Unrecoverable errors during 0N/A// the reading of the archive file should stop the process. 0N/A // This occurs very early during initialization: tty is not initialized. 605N/A "An error has occurred while processing the" 0N/A " shared archive file.\n");
0N/A// Complain and continue. Recoverable errors during the reading of the 0N/A// archive file may continue (with sharing disabled). 0N/A// If we continue, then disable shared spaces and close the file. 0N/A// Fill in the fileMapInfo structure with data about this VM instance. 0N/A // The following fields are for sanity checks for whether this archive 0N/A // will function correctly with this JVM and the bootclasspath it's 0N/A // JVM version string ... changes on each build. 0N/A // Build checks on classpath and jar files 0N/A // Jar file - record timestamp and file size. 0N/A // If we can't access a jar file in the boot path, then we can't 0N/A // make assumptions about where classes get loaded from. 0N/A // If directories appear in boot classpath, they must be empty to 0N/A // avoid having to verify each individual class file. 0N/A// Read the FileMapInfo information from the file. 0N/A// Read the FileMapInfo information from the file. 0N/A // Not locating the shared archive is ok. 0N/A// Write the FileMapInfo information to the file. 0N/A // Remove the existing file in case another process has it open. 0N/A// Write the header to the file, seek to the next allocation boundary. 0N/A// Dump shared spaces to file. 0N/A// Dump region to file. 0N/A// Dump bytes to file -- at the current file position. 0N/A // It is dangerous to leave the corrupted shared archive file around, 0N/A // close and remove the file. See bug 6372906. 0N/A// Align file position to an allocation unit boundary. 0N/A // Seek one byte back from the target and write a byte to insure 0N/A // that the written file is the correct length. 0N/A// Dump bytes to file -- at the current file position. 0N/A// Close the shared archive file. This does NOT unmap mapped regions. 0N/A// Memory map a shared space from the archive file. 0N/A// Remap the shared readonly space to shared readwrite, private. 0N/A // the space is already readwrite so we are done 0N/A// Memory map a region in the address space. 4064N/A // This memory still belongs to JavaHeap 0N/A// Memory map a region in the address space. 0N/A// Unmap a memory region in the address space. 0N/A// Open the shared archive file, read and validate the header 0N/A// information (version, boot classpath, etc.). If initialization 0N/A// fails, shared spaces are disabled and the file is closed. [See 0N/A " version or build of HotSpot.");
0N/A // Cannot verify interpreter yet, as it can only be created after the GC 0N/A // heap has been initialized. 0N/A // Build checks on classpath and jar files 0N/A // Jar file - verify timestamp and file size. 0N/A " the shared archive file.");
0N/A // If directories appear in boot classpath, they must be empty to 0N/A // avoid having to verify each individual class file. 0N/A " less than the number the shared archive was created with.");
0N/A// The following method is provided to see whether a given pointer 0N/A// falls in the mapped shared space. 0N/A// p, The given pointer 0N/A// True if the p is within the mapped shared space, otherwise, false.