Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JDK 17 java.base.jmod - Base Module
JDK 17 java.base.jmod is the JMOD file for JDK 17 Base module.
JDK 17 Base module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\java.base.jmod.
JDK 17 Base module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 Base module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\java.base.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ java/nio/MappedMemoryUtils.java
/* * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package java.nio; import jdk.internal.misc.Unsafe; import java.io.FileDescriptor; import java.io.IOException; import java.io.UncheckedIOException; /* package */ class MappedMemoryUtils { static boolean isLoaded(long address, boolean isSync, long size) { // a sync mapped buffer is always loaded if (isSync) { return true; } if ((address == 0) || (size == 0)) return true; long offset = mappingOffset(address); long length = mappingLength(offset, size); return isLoaded0(mappingAddress(address, offset), length, Bits.pageCount(length)); } static void load(long address, boolean isSync, long size) { // no need to load a sync mapped buffer if (isSync) { return; } if ((address == 0) || (size == 0)) return; long offset = mappingOffset(address); long length = mappingLength(offset, size); load0(mappingAddress(address, offset), length); // Read a byte from each page to bring it into memory. A checksum // is computed as we go along to prevent the compiler from otherwise // considering the loop as dead code. Unsafe unsafe = Unsafe.getUnsafe(); int ps = Bits.pageSize(); long count = Bits.pageCount(length); long a = mappingAddress(address, offset); byte x = 0; for (long i=0; i<count; i++) { // TODO consider changing to getByteOpaque thus avoiding // dead code elimination and the need to calculate a checksum x ^= unsafe.getByte(a); a += ps; } if (unused != 0) unused = x; } // not used, but a potential target for a store, see load() for details. private static byte unused; static void unload(long address, boolean isSync, long size) { // no need to load a sync mapped buffer if (isSync) { return; } if ((address == 0) || (size == 0)) return; long offset = mappingOffset(address); long length = mappingLength(offset, size); unload0(mappingAddress(address, offset), length); } static void force(FileDescriptor fd, long address, boolean isSync, long index, long length) { if (isSync) { // simply force writeback of associated cache lines Unsafe.getUnsafe().writebackMemory(address + index, length); } else { // force writeback via file descriptor long offset = mappingOffset(address, index); try { force0(fd, mappingAddress(address, offset, index), mappingLength(offset, length)); } catch (IOException cause) { throw new UncheckedIOException(cause); } } } // native methods private static native boolean isLoaded0(long address, long length, long pageCount); private static native void load0(long address, long length); private static native void unload0(long address, long length); private static native void force0(FileDescriptor fd, long address, long length) throws IOException; // utility methods // Returns the distance (in bytes) of the buffer start from the // largest page aligned address of the mapping less than or equal // to the start address. private static long mappingOffset(long address) { return mappingOffset(address, 0); } // Returns the distance (in bytes) of the buffer element // identified by index from the largest page aligned address of // the mapping less than or equal to the element address. Computed // each time to avoid storing in every direct buffer. private static long mappingOffset(long address, long index) { int ps = Bits.pageSize(); long indexAddress = address + index; long baseAddress = alignDown(indexAddress, ps); return indexAddress - baseAddress; } // Given an offset previously obtained from calling // mappingOffset() returns the largest page aligned address of the // mapping less than or equal to the buffer start address. private static long mappingAddress(long address, long mappingOffset) { return mappingAddress(address, mappingOffset, 0); } // Given an offset previously otained from calling // mappingOffset(index) returns the largest page aligned address // of the mapping less than or equal to the address of the buffer // element identified by index. private static long mappingAddress(long address, long mappingOffset, long index) { long indexAddress = address + index; return indexAddress - mappingOffset; } // given a mappingOffset previously otained from calling // mappingOffset(index) return that offset added to the supplied // length. private static long mappingLength(long mappingOffset, long length) { return length + mappingOffset; } // align address down to page size private static long alignDown(long address, int pageSize) { // pageSize must be a power of 2 return address & ~(pageSize - 1); } }
⏎ java/nio/MappedMemoryUtils.java
Or download all of them as a single archive file:
File name: java.base-17.0.5-src.zip File size: 8883851 bytes Release date: 2022-09-13 Download
2023-09-26, 68842👍, 1💬
Popular Posts:
JDK 11 jdk.crypto.mscapi.jmod is the JMOD file for JDK 11 Crypto MSCAPI module. JDK 11 Crypto MSCAPI...
How to download and install xml-commons External Source Package? The source package contains Java so...
JDK 11 jdk.internal.vm.compiler .jmodis the JMOD file for JDK 11 Internal VM Compiler module. JDK 11...
JDOM provides a solution for using XML from Java that is as simple as Java itself. There is no compe...
How to download and install JDK (Java Development Kit) 5? If you want to write Java applications, yo...