< prev index next >

src/java.base/share/classes/java/lang/System.java

Print this page
rev 52582 : 4947890: Minimize JNI upcalls in system-properties initialization
Reviewed-by: erikj

*** 70,79 **** --- 70,80 ---- import jdk.internal.access.SharedSecrets; import jdk.internal.misc.VM; import jdk.internal.logger.LoggerFinderLoader; import jdk.internal.logger.LazyLoggers; import jdk.internal.logger.LocalizedLoggerWrapper; + import jdk.internal.util.SystemProps; import jdk.internal.vm.annotation.Stable; import sun.reflect.annotation.AnnotationType; import sun.nio.ch.Interruptible; import sun.security.util.SecurityConstants;
*** 603,613 **** * <dt>user.dir <dd>User's current working directory * </dl> */ private static Properties props; - private static native Properties initProperties(Properties props); /** * Determines the current system properties. * * First, if there is a security manager, its --- 604,613 ----
*** 797,809 **** public static void setProperties(Properties props) { SecurityManager sm = getSecurityManager(); if (sm != null) { sm.checkPropertiesAccess(); } if (props == null) { ! props = new Properties(); ! initProperties(props); VersionProps.init(props); } System.props = props; } --- 797,809 ---- public static void setProperties(Properties props) { SecurityManager sm = getSecurityManager(); if (sm != null) { sm.checkPropertiesAccess(); } + if (props == null) { ! props = SystemProps.initProperties(); VersionProps.init(props); } System.props = props; }
*** 1964,1981 **** */ private static void initPhase1() { // VM might invoke JNU_NewStringPlatform() to set those encoding // sensitive properties (user.home, user.name, boot.class.path, etc.) ! // during "props" initialization, in which it may need access, via ! // System.getProperty(), to the related system encoding property that ! // have been initialized (put into "props") at early stage of the ! // initialization. So make sure the "props" is available at the ! // very beginning of the initialization and all system properties to ! // be put into it directly. ! props = new Properties(84); ! initProperties(props); // initialized by the VM VersionProps.init(props); // There are certain system configurations that may be controlled by // VM options such as the maximum amount of direct memory and // Integer cache size used to support the object identity semantics --- 1964,1976 ---- */ private static void initPhase1() { // VM might invoke JNU_NewStringPlatform() to set those encoding // sensitive properties (user.home, user.name, boot.class.path, etc.) ! // during "props" initialization. ! // The charset is initialized in System.c and does not depend on the Properties. ! props = SystemProps.initProperties(); VersionProps.init(props); // There are certain system configurations that may be controlled by // VM options such as the maximum amount of direct memory and // Integer cache size used to support the object identity semantics
*** 1991,2001 **** // can only be accessed by the internal implementation. Remove // certain system properties that are not intended for public access. VM.saveAndRemoveProperties(props); lineSeparator = props.getProperty("line.separator"); - StaticProperty.javaHome(); // Load StaticProperty to cache the property values FileInputStream fdIn = new FileInputStream(FileDescriptor.in); FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out); FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err); setIn0(new BufferedInputStream(fdIn)); --- 1986,1995 ----
< prev index next >