131 // buffer memory. This value may be changed during VM initialization if
132 // "java" is launched with "-XX:MaxDirectMemorySize=<size>".
133 //
134 // The initial value of this field is arbitrary; during JRE initialization
135 // it will be reset to the value specified on the command line, if any,
136 // otherwise to Runtime.getRuntime().maxMemory().
137 //
138 private static long directMemory = 64 * 1024 * 1024;
139
140 // Returns the maximum amount of allocatable direct buffer memory.
141 // The directMemory variable is initialized during system initialization
142 // in the saveAndRemoveProperties method.
143 //
144 public static long maxDirectMemory() {
145 return directMemory;
146 }
147
148 // User-controllable flag that determines if direct buffers should be page
149 // aligned. The "-XX:+PageAlignDirectMemory" option can be used to force
150 // buffers, allocated by ByteBuffer.allocateDirect, to be page aligned.
151 private static boolean pageAlignDirectMemory;
152
153 // Returns {@code true} if the direct buffers should be page aligned. This
154 // variable is initialized by saveAndRemoveProperties.
155 public static boolean isDirectMemoryPageAligned() {
156 return pageAlignDirectMemory;
157 }
158
159 private static int classFileMajorVersion;
160 private static int classFileMinorVersion;
161 private static final int PREVIEW_MINOR_VERSION = 65535;
162
163 /**
164 * Tests if the given version is a supported {@code class}
165 * file version.
166 *
167 * A {@code class} file depends on the preview features of Java SE {@code N}
168 * if the major version is {@code N} and the minor version is 65535.
169 * This method returns {@code true} if the given version is a supported
170 * {@code class} file version regardless of whether the preview features
|
131 // buffer memory. This value may be changed during VM initialization if
132 // "java" is launched with "-XX:MaxDirectMemorySize=<size>".
133 //
134 // The initial value of this field is arbitrary; during JRE initialization
135 // it will be reset to the value specified on the command line, if any,
136 // otherwise to Runtime.getRuntime().maxMemory().
137 //
138 private static long directMemory = 64 * 1024 * 1024;
139
140 // Returns the maximum amount of allocatable direct buffer memory.
141 // The directMemory variable is initialized during system initialization
142 // in the saveAndRemoveProperties method.
143 //
144 public static long maxDirectMemory() {
145 return directMemory;
146 }
147
148 // User-controllable flag that determines if direct buffers should be page
149 // aligned. The "-XX:+PageAlignDirectMemory" option can be used to force
150 // buffers, allocated by ByteBuffer.allocateDirect, to be page aligned.
151 @Stable
152 private static boolean pageAlignDirectMemory;
153
154 // Returns {@code true} if the direct buffers should be page aligned. This
155 // variable is initialized by saveAndRemoveProperties.
156 public static boolean isDirectMemoryPageAligned() {
157 return pageAlignDirectMemory;
158 }
159
160 private static int classFileMajorVersion;
161 private static int classFileMinorVersion;
162 private static final int PREVIEW_MINOR_VERSION = 65535;
163
164 /**
165 * Tests if the given version is a supported {@code class}
166 * file version.
167 *
168 * A {@code class} file depends on the preview features of Java SE {@code N}
169 * if the major version is {@code N} and the minor version is 65535.
170 * This method returns {@code true} if the given version is a supported
171 * {@code class} file version regardless of whether the preview features
|