author | ihse |
Tue, 13 Feb 2018 10:37:33 +0100 | |
branch | ihse-remove-mapfiles-branch |
changeset 56106 | 40e61db323c2 |
parent 47216 | 71c04702a3d5 |
child 56721 | 01b558efd286 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
56106 | 2 |
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
#include <windows.h> |
|
27 |
#include <io.h> |
|
28 |
#include <process.h> |
|
29 |
#include <stdlib.h> |
|
30 |
#include <stdio.h> |
|
31 |
#include <stdarg.h> |
|
32 |
#include <string.h> |
|
33 |
#include <sys/types.h> |
|
34 |
#include <sys/stat.h> |
|
35 |
#include <wtypes.h> |
|
39
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
36 |
#include <commctrl.h> |
2 | 37 |
|
38 |
#include <jni.h> |
|
39 |
#include "java.h" |
|
40 |
||
41 |
#define JVM_DLL "jvm.dll" |
|
42 |
#define JAVA_DLL "java.dll" |
|
43 |
||
44 |
/* |
|
45 |
* Prototypes. |
|
46 |
*/ |
|
47 |
static jboolean GetJVMPath(const char *jrepath, const char *jvmtype, |
|
48 |
char *jvmpath, jint jvmpathsize); |
|
49 |
static jboolean GetJREPath(char *path, jint pathsize); |
|
50 |
||
41558
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
51 |
#ifdef USE_REGISTRY_LOOKUP |
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
52 |
jboolean GetPublicJREHome(char *buf, jint bufsize); |
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
53 |
#endif |
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
54 |
|
7004
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
55 |
/* We supports warmup for UI stack that is performed in parallel |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
56 |
* to VM initialization. |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
57 |
* This helps to improve startup of UI application as warmup phase |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
58 |
* might be long due to initialization of OS or hardware resources. |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
59 |
* It is not CPU bound and therefore it does not interfere with VM init. |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
60 |
* Obviously such warmup only has sense for UI apps and therefore it needs |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
61 |
* to be explicitly requested by passing -Dsun.awt.warmup=true property |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
62 |
* (this is always the case for plugin/javaws). |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
63 |
* |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
64 |
* Implementation launches new thread after VM starts and use it to perform |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
65 |
* warmup code (platform dependent). |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
66 |
* This thread is later reused as AWT toolkit thread as graphics toolkit |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
67 |
* often assume that they are used from the same thread they were launched on. |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
68 |
* |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
69 |
* At the moment we only support warmup for D3D. It only possible on windows |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
70 |
* and only if other flags do not prohibit this (e.g. OpenGL support requested). |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
71 |
*/ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
72 |
#undef ENABLE_AWT_PRELOAD |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
73 |
#ifndef JAVA_ARGS /* turn off AWT preloading for javac, jar, etc */ |
7256
adb296cc2eae
6999872: java.awt.Window instantiation leads to JVM CRASH on Windows, JDK7b118+ fastdebug
amenkov
parents:
7048
diff
changeset
|
74 |
/* CR6999872: fastdebug crashes if awt library is loaded before JVM is |
adb296cc2eae
6999872: java.awt.Window instantiation leads to JVM CRASH on Windows, JDK7b118+ fastdebug
amenkov
parents:
7048
diff
changeset
|
75 |
* initialized*/ |
adb296cc2eae
6999872: java.awt.Window instantiation leads to JVM CRASH on Windows, JDK7b118+ fastdebug
amenkov
parents:
7048
diff
changeset
|
76 |
#if !defined(DEBUG) |
adb296cc2eae
6999872: java.awt.Window instantiation leads to JVM CRASH on Windows, JDK7b118+ fastdebug
amenkov
parents:
7048
diff
changeset
|
77 |
#define ENABLE_AWT_PRELOAD |
adb296cc2eae
6999872: java.awt.Window instantiation leads to JVM CRASH on Windows, JDK7b118+ fastdebug
amenkov
parents:
7048
diff
changeset
|
78 |
#endif |
7004
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
79 |
#endif |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
80 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
81 |
#ifdef ENABLE_AWT_PRELOAD |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
82 |
/* "AWT was preloaded" flag; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
83 |
* turned on by AWTPreload(). |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
84 |
*/ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
85 |
int awtPreloaded = 0; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
86 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
87 |
/* Calls a function with the name specified |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
88 |
* the function must be int(*fn)(void). |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
89 |
*/ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
90 |
int AWTPreload(const char *funcName); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
91 |
/* stops AWT preloading */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
92 |
void AWTPreloadStop(); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
93 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
94 |
/* D3D preloading */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
95 |
/* -1: not initialized; 0: OFF, 1: ON */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
96 |
int awtPreloadD3D = -1; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
97 |
/* command line parameter to swith D3D preloading on */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
98 |
#define PARAM_PRELOAD_D3D "-Dsun.awt.warmup" |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
99 |
/* D3D/OpenGL management parameters */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
100 |
#define PARAM_NODDRAW "-Dsun.java2d.noddraw" |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
101 |
#define PARAM_D3D "-Dsun.java2d.d3d" |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
102 |
#define PARAM_OPENGL "-Dsun.java2d.opengl" |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
103 |
/* funtion in awt.dll (src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp) */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
104 |
#define D3D_PRELOAD_FUNC "preloadD3D" |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
105 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
106 |
/* Extracts value of a parameter with the specified name |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
107 |
* from command line argument (returns pointer in the argument). |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
108 |
* Returns NULL if the argument does not contains the parameter. |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
109 |
* e.g.: |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
110 |
* GetParamValue("theParam", "theParam=value") returns pointer to "value". |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
111 |
*/ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
112 |
const char * GetParamValue(const char *paramName, const char *arg) { |
29742
b73f38796859
8074840: Resolve disabled warnings for libjli and libjli_static
mikael
parents:
28984
diff
changeset
|
113 |
size_t nameLen = JLI_StrLen(paramName); |
7004
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
114 |
if (JLI_StrNCmp(paramName, arg, nameLen) == 0) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
115 |
/* arg[nameLen] is valid (may contain final NULL) */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
116 |
if (arg[nameLen] == '=') { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
117 |
return arg + nameLen + 1; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
118 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
119 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
120 |
return NULL; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
121 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
122 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
123 |
/* Checks if commandline argument contains property specified |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
124 |
* and analyze it as boolean property (true/false). |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
125 |
* Returns -1 if the argument does not contain the parameter; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
126 |
* Returns 1 if the argument contains the parameter and its value is "true"; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
127 |
* Returns 0 if the argument contains the parameter and its value is "false". |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
128 |
*/ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
129 |
int GetBoolParamValue(const char *paramName, const char *arg) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
130 |
const char * paramValue = GetParamValue(paramName, arg); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
131 |
if (paramValue != NULL) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
132 |
if (JLI_StrCaseCmp(paramValue, "true") == 0) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
133 |
return 1; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
134 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
135 |
if (JLI_StrCaseCmp(paramValue, "false") == 0) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
136 |
return 0; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
137 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
138 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
139 |
return -1; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
140 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
141 |
#endif /* ENABLE_AWT_PRELOAD */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
142 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
143 |
|
2 | 144 |
static jboolean _isjavaw = JNI_FALSE; |
145 |
||
146 |
||
147 |
jboolean |
|
148 |
IsJavaw() |
|
149 |
{ |
|
150 |
return _isjavaw; |
|
151 |
} |
|
152 |
||
153 |
/* |
|
154 |
* |
|
155 |
*/ |
|
156 |
void |
|
6005 | 157 |
CreateExecutionEnvironment(int *pargc, char ***pargv, |
158 |
char *jrepath, jint so_jrepath, |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
159 |
char *jvmpath, jint so_jvmpath, |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
160 |
char *jvmcfg, jint so_jvmcfg) { |
45062 | 161 |
|
162 |
char *jvmtype; |
|
2 | 163 |
int i = 0; |
6005 | 164 |
char** argv = *pargv; |
2 | 165 |
|
166 |
/* Find out where the JRE is that we will be using. */ |
|
167 |
if (!GetJREPath(jrepath, so_jrepath)) { |
|
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
168 |
JLI_ReportErrorMessage(JRE_ERROR1); |
2 | 169 |
exit(2); |
170 |
} |
|
171 |
||
42753
40f61533b93d
8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents:
41558
diff
changeset
|
172 |
JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%sjvm.cfg", |
40f61533b93d
8066474: Remove the lib/ directory from Linux and Solaris images
erikj
parents:
41558
diff
changeset
|
173 |
jrepath, FILESEP, FILESEP); |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
174 |
|
2 | 175 |
/* Find the specified JVM type */ |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
176 |
if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) { |
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
177 |
JLI_ReportErrorMessage(CFG_ERROR7); |
2 | 178 |
exit(1); |
179 |
} |
|
6005 | 180 |
|
181 |
jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE); |
|
182 |
if (JLI_StrCmp(jvmtype, "ERROR") == 0) { |
|
183 |
JLI_ReportErrorMessage(CFG_ERROR9); |
|
184 |
exit(4); |
|
185 |
} |
|
2 | 186 |
|
187 |
jvmpath[0] = '\0'; |
|
188 |
if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath)) { |
|
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
189 |
JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath); |
2 | 190 |
exit(4); |
191 |
} |
|
192 |
/* If we got here, jvmpath has been correctly initialized. */ |
|
7004
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
193 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
194 |
/* Check if we need preload AWT */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
195 |
#ifdef ENABLE_AWT_PRELOAD |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
196 |
argv = *pargv; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
197 |
for (i = 0; i < *pargc ; i++) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
198 |
/* Tests the "turn on" parameter only if not set yet. */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
199 |
if (awtPreloadD3D < 0) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
200 |
if (GetBoolParamValue(PARAM_PRELOAD_D3D, argv[i]) == 1) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
201 |
awtPreloadD3D = 1; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
202 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
203 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
204 |
/* Test parameters which can disable preloading if not already disabled. */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
205 |
if (awtPreloadD3D != 0) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
206 |
if (GetBoolParamValue(PARAM_NODDRAW, argv[i]) == 1 |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
207 |
|| GetBoolParamValue(PARAM_D3D, argv[i]) == 0 |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
208 |
|| GetBoolParamValue(PARAM_OPENGL, argv[i]) == 1) |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
209 |
{ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
210 |
awtPreloadD3D = 0; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
211 |
/* no need to test the rest of the parameters */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
212 |
break; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
213 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
214 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
215 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
216 |
#endif /* ENABLE_AWT_PRELOAD */ |
2 | 217 |
} |
218 |
||
3111
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
219 |
|
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
220 |
static jboolean |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
221 |
LoadMSVCRT() |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
222 |
{ |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
223 |
// Only do this once |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
224 |
static int loaded = 0; |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
225 |
char crtpath[MAXPATHLEN]; |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
226 |
|
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
227 |
if (!loaded) { |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
228 |
/* |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
229 |
* The Microsoft C Runtime Library needs to be loaded first. A copy is |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
230 |
* assumed to be present in the "JRE path" directory. If it is not found |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
231 |
* there (or "JRE path" fails to resolve), skip the explicit load and let |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
232 |
* nature take its course, which is likely to be a failure to execute. |
28984
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
233 |
* The makefiles will provide the correct lib contained in quotes in the |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
234 |
* macro MSVCR_DLL_NAME. |
3111
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
235 |
*/ |
28984
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
236 |
#ifdef MSVCR_DLL_NAME |
3111
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
237 |
if (GetJREPath(crtpath, MAXPATHLEN)) { |
16077 | 238 |
if (JLI_StrLen(crtpath) + JLI_StrLen("\\bin\\") + |
28984
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
239 |
JLI_StrLen(MSVCR_DLL_NAME) >= MAXPATHLEN) { |
6535
77ffd0e75bfb
6390477: (launcher) replace unsafe usages of sprintf with snprintf
ksrini
parents:
6522
diff
changeset
|
240 |
JLI_ReportErrorMessage(JRE_ERROR11); |
77ffd0e75bfb
6390477: (launcher) replace unsafe usages of sprintf with snprintf
ksrini
parents:
6522
diff
changeset
|
241 |
return JNI_FALSE; |
77ffd0e75bfb
6390477: (launcher) replace unsafe usages of sprintf with snprintf
ksrini
parents:
6522
diff
changeset
|
242 |
} |
28984
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
243 |
(void)JLI_StrCat(crtpath, "\\bin\\" MSVCR_DLL_NAME); /* Add crt dll */ |
3111
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
244 |
JLI_TraceLauncher("CRT path is %s\n", crtpath); |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
245 |
if (_access(crtpath, 0) == 0) { |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
246 |
if (LoadLibrary(crtpath) == 0) { |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
247 |
JLI_ReportErrorMessage(DLL_ERROR4, crtpath); |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
248 |
return JNI_FALSE; |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
249 |
} |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
250 |
} |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
251 |
} |
28984
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
252 |
#endif /* MSVCR_DLL_NAME */ |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
253 |
#ifdef MSVCP_DLL_NAME |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
254 |
if (GetJREPath(crtpath, MAXPATHLEN)) { |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
255 |
if (JLI_StrLen(crtpath) + JLI_StrLen("\\bin\\") + |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
256 |
JLI_StrLen(MSVCP_DLL_NAME) >= MAXPATHLEN) { |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
257 |
JLI_ReportErrorMessage(JRE_ERROR11); |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
258 |
return JNI_FALSE; |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
259 |
} |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
260 |
(void)JLI_StrCat(crtpath, "\\bin\\" MSVCP_DLL_NAME); /* Add prt dll */ |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
261 |
JLI_TraceLauncher("PRT path is %s\n", crtpath); |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
262 |
if (_access(crtpath, 0) == 0) { |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
263 |
if (LoadLibrary(crtpath) == 0) { |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
264 |
JLI_ReportErrorMessage(DLL_ERROR4, crtpath); |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
265 |
return JNI_FALSE; |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
266 |
} |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
267 |
} |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
268 |
} |
12031ba2dc38
8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
erikj
parents:
27938
diff
changeset
|
269 |
#endif /* MSVCP_DLL_NAME */ |
3111
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
270 |
loaded = 1; |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
271 |
} |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
272 |
return JNI_TRUE; |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
273 |
} |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
274 |
|
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
275 |
|
2 | 276 |
/* |
277 |
* Find path to JRE based on .exe's location or registry settings. |
|
278 |
*/ |
|
279 |
jboolean |
|
280 |
GetJREPath(char *path, jint pathsize) |
|
281 |
{ |
|
282 |
char javadll[MAXPATHLEN]; |
|
283 |
struct stat s; |
|
284 |
||
285 |
if (GetApplicationHome(path, pathsize)) { |
|
286 |
/* Is JRE co-located with the application? */ |
|
6005 | 287 |
JLI_Snprintf(javadll, sizeof(javadll), "%s\\bin\\" JAVA_DLL, path); |
2 | 288 |
if (stat(javadll, &s) == 0) { |
6005 | 289 |
JLI_TraceLauncher("JRE path is %s\n", path); |
290 |
return JNI_TRUE; |
|
2 | 291 |
} |
31690 | 292 |
/* ensure storage for path + \jre + NULL */ |
293 |
if ((JLI_StrLen(path) + 4 + 1) > (size_t) pathsize) { |
|
294 |
JLI_TraceLauncher("Insufficient space to store JRE path\n"); |
|
295 |
return JNI_FALSE; |
|
296 |
} |
|
2 | 297 |
/* Does this app ship a private JRE in <apphome>\jre directory? */ |
6005 | 298 |
JLI_Snprintf(javadll, sizeof (javadll), "%s\\jre\\bin\\" JAVA_DLL, path); |
2 | 299 |
if (stat(javadll, &s) == 0) { |
300 |
JLI_StrCat(path, "\\jre"); |
|
6005 | 301 |
JLI_TraceLauncher("JRE path is %s\n", path); |
302 |
return JNI_TRUE; |
|
2 | 303 |
} |
304 |
} |
|
305 |
||
34960
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
306 |
/* Try getting path to JRE from path to JLI.DLL */ |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
307 |
if (GetApplicationHomeFromDll(path, pathsize)) { |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
308 |
JLI_Snprintf(javadll, sizeof(javadll), "%s\\bin\\" JAVA_DLL, path); |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
309 |
if (stat(javadll, &s) == 0) { |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
310 |
JLI_TraceLauncher("JRE path is %s\n", path); |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
311 |
return JNI_TRUE; |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
312 |
} |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
313 |
} |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
314 |
|
41558
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
315 |
#ifdef USE_REGISTRY_LOOKUP |
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
316 |
/* Lookup public JRE using Windows registry. */ |
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
317 |
if (GetPublicJREHome(path, pathsize)) { |
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
318 |
JLI_TraceLauncher("JRE path is %s\n", path); |
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
319 |
return JNI_TRUE; |
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
320 |
} |
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
321 |
#endif |
750de2810ded
8168093: Need a way for the launcher to query the JRE location using Windows registry.
asemenyuk
parents:
40945
diff
changeset
|
322 |
|
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
323 |
JLI_ReportErrorMessage(JRE_ERROR8 JAVA_DLL); |
2 | 324 |
return JNI_FALSE; |
325 |
} |
|
326 |
||
327 |
/* |
|
328 |
* Given a JRE location and a JVM type, construct what the name the |
|
329 |
* JVM shared library will be. Return true, if such a library |
|
330 |
* exists, false otherwise. |
|
331 |
*/ |
|
332 |
static jboolean |
|
333 |
GetJVMPath(const char *jrepath, const char *jvmtype, |
|
334 |
char *jvmpath, jint jvmpathsize) |
|
335 |
{ |
|
336 |
struct stat s; |
|
337 |
if (JLI_StrChr(jvmtype, '/') || JLI_StrChr(jvmtype, '\\')) { |
|
6005 | 338 |
JLI_Snprintf(jvmpath, jvmpathsize, "%s\\" JVM_DLL, jvmtype); |
2 | 339 |
} else { |
16077 | 340 |
JLI_Snprintf(jvmpath, jvmpathsize, "%s\\bin\\%s\\" JVM_DLL, |
341 |
jrepath, jvmtype); |
|
2 | 342 |
} |
343 |
if (stat(jvmpath, &s) == 0) { |
|
344 |
return JNI_TRUE; |
|
345 |
} else { |
|
346 |
return JNI_FALSE; |
|
347 |
} |
|
348 |
} |
|
349 |
||
350 |
/* |
|
351 |
* Load a jvm from "jvmpath" and initialize the invocation functions. |
|
352 |
*/ |
|
353 |
jboolean |
|
354 |
LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn) |
|
355 |
{ |
|
356 |
HINSTANCE handle; |
|
357 |
||
358 |
JLI_TraceLauncher("JVM path is %s\n", jvmpath); |
|
359 |
||
360 |
/* |
|
361 |
* The Microsoft C Runtime Library needs to be loaded first. A copy is |
|
362 |
* assumed to be present in the "JRE path" directory. If it is not found |
|
363 |
* there (or "JRE path" fails to resolve), skip the explicit load and let |
|
364 |
* nature take its course, which is likely to be a failure to execute. |
|
1776
33e9405ab91b
6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents:
1331
diff
changeset
|
365 |
* |
2 | 366 |
*/ |
3111
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
367 |
LoadMSVCRT(); |
2 | 368 |
|
369 |
/* Load the Java VM DLL */ |
|
370 |
if ((handle = LoadLibrary(jvmpath)) == 0) { |
|
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
371 |
JLI_ReportErrorMessage(DLL_ERROR4, (char *)jvmpath); |
2 | 372 |
return JNI_FALSE; |
373 |
} |
|
374 |
||
375 |
/* Now get the function addresses */ |
|
376 |
ifn->CreateJavaVM = |
|
377 |
(void *)GetProcAddress(handle, "JNI_CreateJavaVM"); |
|
378 |
ifn->GetDefaultJavaVMInitArgs = |
|
379 |
(void *)GetProcAddress(handle, "JNI_GetDefaultJavaVMInitArgs"); |
|
380 |
if (ifn->CreateJavaVM == 0 || ifn->GetDefaultJavaVMInitArgs == 0) { |
|
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
381 |
JLI_ReportErrorMessage(JNI_ERROR1, (char *)jvmpath); |
2 | 382 |
return JNI_FALSE; |
383 |
} |
|
384 |
||
385 |
return JNI_TRUE; |
|
386 |
} |
|
387 |
||
388 |
/* |
|
34960
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
389 |
* Removes the trailing file name and one sub-folder from a path. |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
390 |
* If buf is "c:\foo\bin\javac", then put "c:\foo" into buf. |
2 | 391 |
*/ |
392 |
jboolean |
|
34960
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
393 |
TruncatePath(char *buf) |
2 | 394 |
{ |
395 |
char *cp; |
|
396 |
*JLI_StrRChr(buf, '\\') = '\0'; /* remove .exe file name */ |
|
397 |
if ((cp = JLI_StrRChr(buf, '\\')) == 0) { |
|
398 |
/* This happens if the application is in a drive root, and |
|
40945
f241705723ea
8165524: Better detect JRE that Linux JLI will be using
ksrini
parents:
39761
diff
changeset
|
399 |
* there is no bin directory. */ |
2 | 400 |
buf[0] = '\0'; |
401 |
return JNI_FALSE; |
|
402 |
} |
|
40945
f241705723ea
8165524: Better detect JRE that Linux JLI will be using
ksrini
parents:
39761
diff
changeset
|
403 |
*cp = '\0'; /* remove the bin\ part */ |
2 | 404 |
return JNI_TRUE; |
405 |
} |
|
406 |
||
407 |
/* |
|
34960
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
408 |
* Retrieves the path to the JRE home by locating the executable file |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
409 |
* of the current process and then truncating the path to the executable |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
410 |
*/ |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
411 |
jboolean |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
412 |
GetApplicationHome(char *buf, jint bufsize) |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
413 |
{ |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
414 |
GetModuleFileName(NULL, buf, bufsize); |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
415 |
return TruncatePath(buf); |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
416 |
} |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
417 |
|
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
418 |
/* |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
419 |
* Retrieves the path to the JRE home by locating JLI.DLL and |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
420 |
* then truncating the path to JLI.DLL |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
421 |
*/ |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
422 |
jboolean |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
423 |
GetApplicationHomeFromDll(char *buf, jint bufsize) |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
424 |
{ |
40945
f241705723ea
8165524: Better detect JRE that Linux JLI will be using
ksrini
parents:
39761
diff
changeset
|
425 |
HMODULE module; |
f241705723ea
8165524: Better detect JRE that Linux JLI will be using
ksrini
parents:
39761
diff
changeset
|
426 |
DWORD flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | |
f241705723ea
8165524: Better detect JRE that Linux JLI will be using
ksrini
parents:
39761
diff
changeset
|
427 |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT; |
34960
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
428 |
|
40945
f241705723ea
8165524: Better detect JRE that Linux JLI will be using
ksrini
parents:
39761
diff
changeset
|
429 |
if (GetModuleHandleEx(flags, (LPCSTR)&GetJREPath, &module) != 0) { |
f241705723ea
8165524: Better detect JRE that Linux JLI will be using
ksrini
parents:
39761
diff
changeset
|
430 |
if (GetModuleFileName(module, buf, bufsize) != 0) { |
f241705723ea
8165524: Better detect JRE that Linux JLI will be using
ksrini
parents:
39761
diff
changeset
|
431 |
return TruncatePath(buf); |
f241705723ea
8165524: Better detect JRE that Linux JLI will be using
ksrini
parents:
39761
diff
changeset
|
432 |
} |
f241705723ea
8165524: Better detect JRE that Linux JLI will be using
ksrini
parents:
39761
diff
changeset
|
433 |
} |
f241705723ea
8165524: Better detect JRE that Linux JLI will be using
ksrini
parents:
39761
diff
changeset
|
434 |
return JNI_FALSE; |
34960
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
435 |
} |
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
436 |
|
75262319b048
8145409: Better detect JRE that JLI will be using
dcherepanov
parents:
31690
diff
changeset
|
437 |
/* |
2 | 438 |
* Support for doing cheap, accurate interval timing. |
439 |
*/ |
|
440 |
static jboolean counterAvailable = JNI_FALSE; |
|
441 |
static jboolean counterInitialized = JNI_FALSE; |
|
442 |
static LARGE_INTEGER counterFrequency; |
|
443 |
||
444 |
jlong CounterGet() |
|
445 |
{ |
|
446 |
LARGE_INTEGER count; |
|
447 |
||
448 |
if (!counterInitialized) { |
|
449 |
counterAvailable = QueryPerformanceFrequency(&counterFrequency); |
|
450 |
counterInitialized = JNI_TRUE; |
|
451 |
} |
|
452 |
if (!counterAvailable) { |
|
453 |
return 0; |
|
454 |
} |
|
455 |
QueryPerformanceCounter(&count); |
|
456 |
return (jlong)(count.QuadPart); |
|
457 |
} |
|
458 |
||
459 |
jlong Counter2Micros(jlong counts) |
|
460 |
{ |
|
461 |
if (!counterAvailable || !counterInitialized) { |
|
462 |
return 0; |
|
463 |
} |
|
464 |
return (counts * 1000 * 1000)/counterFrequency.QuadPart; |
|
465 |
} |
|
16077 | 466 |
/* |
467 |
* windows snprintf does not guarantee a null terminator in the buffer, |
|
468 |
* if the computed size is equal to or greater than the buffer size, |
|
16091
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
469 |
* as well as error conditions. This function guarantees a null terminator |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
470 |
* under all these conditions. An unreasonable buffer or size will return |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
471 |
* an error value. Under all other conditions this function will return the |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
472 |
* size of the bytes actually written minus the null terminator, similar |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
473 |
* to ansi snprintf api. Thus when calling this function the caller must |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
474 |
* ensure storage for the null terminator. |
16077 | 475 |
*/ |
16091
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
476 |
int |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
477 |
JLI_Snprintf(char* buffer, size_t size, const char* format, ...) { |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
478 |
int rc; |
16077 | 479 |
va_list vl; |
16091
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
480 |
if (size == 0 || buffer == NULL) |
16077 | 481 |
return -1; |
16091
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
482 |
buffer[0] = '\0'; |
16077 | 483 |
va_start(vl, format); |
16091
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
484 |
rc = vsnprintf(buffer, size, format, vl); |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
485 |
va_end(vl); |
16077 | 486 |
/* force a null terminator, if something is amiss */ |
16091
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
487 |
if (rc < 0) { |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
488 |
/* apply ansi semantics */ |
16077 | 489 |
buffer[size - 1] = '\0'; |
29742
b73f38796859
8074840: Resolve disabled warnings for libjli and libjli_static
mikael
parents:
28984
diff
changeset
|
490 |
return (int)size; |
16091
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
491 |
} else if (rc == size) { |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
492 |
/* force a null terminator */ |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
493 |
buffer[size - 1] = '\0'; |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
494 |
} |
16077 | 495 |
return rc; |
496 |
} |
|
497 |
||
56106 | 498 |
JNIEXPORT void |
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
499 |
JLI_ReportErrorMessage(const char* fmt, ...) { |
2 | 500 |
va_list vl; |
501 |
va_start(vl,fmt); |
|
502 |
||
503 |
if (IsJavaw()) { |
|
504 |
char *message; |
|
505 |
||
506 |
/* get the length of the string we need */ |
|
507 |
int n = _vscprintf(fmt, vl); |
|
508 |
||
509 |
message = (char *)JLI_MemAlloc(n + 1); |
|
510 |
_vsnprintf(message, n, fmt, vl); |
|
511 |
message[n]='\0'; |
|
512 |
MessageBox(NULL, message, "Java Virtual Machine Launcher", |
|
513 |
(MB_OK|MB_ICONSTOP|MB_APPLMODAL)); |
|
514 |
JLI_MemFree(message); |
|
515 |
} else { |
|
516 |
vfprintf(stderr, fmt, vl); |
|
517 |
fprintf(stderr, "\n"); |
|
518 |
} |
|
519 |
va_end(vl); |
|
520 |
} |
|
521 |
||
522 |
/* |
|
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
523 |
* Just like JLI_ReportErrorMessage, except that it concatenates the system |
2 | 524 |
* error message if any, its upto the calling routine to correctly |
525 |
* format the separation of the messages. |
|
526 |
*/ |
|
56106 | 527 |
JNIEXPORT void |
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
528 |
JLI_ReportErrorMessageSys(const char *fmt, ...) |
2 | 529 |
{ |
530 |
va_list vl; |
|
531 |
||
532 |
int save_errno = errno; |
|
533 |
DWORD errval; |
|
534 |
jboolean freeit = JNI_FALSE; |
|
535 |
char *errtext = NULL; |
|
536 |
||
537 |
va_start(vl, fmt); |
|
538 |
||
539 |
if ((errval = GetLastError()) != 0) { /* Platform SDK / DOS Error */ |
|
540 |
int n = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM| |
|
541 |
FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_ALLOCATE_BUFFER, |
|
542 |
NULL, errval, 0, (LPTSTR)&errtext, 0, NULL); |
|
543 |
if (errtext == NULL || n == 0) { /* Paranoia check */ |
|
544 |
errtext = ""; |
|
545 |
n = 0; |
|
546 |
} else { |
|
547 |
freeit = JNI_TRUE; |
|
548 |
if (n > 2) { /* Drop final CR, LF */ |
|
549 |
if (errtext[n - 1] == '\n') n--; |
|
550 |
if (errtext[n - 1] == '\r') n--; |
|
551 |
errtext[n] = '\0'; |
|
552 |
} |
|
553 |
} |
|
554 |
} else { /* C runtime error that has no corresponding DOS error code */ |
|
555 |
errtext = strerror(save_errno); |
|
556 |
} |
|
557 |
||
558 |
if (IsJavaw()) { |
|
559 |
char *message; |
|
560 |
int mlen; |
|
561 |
/* get the length of the string we need */ |
|
562 |
int len = mlen = _vscprintf(fmt, vl) + 1; |
|
563 |
if (freeit) { |
|
7028
adadd244f506
6989469: (launcher) compiler warnings in jli native code
ksrini
parents:
6535
diff
changeset
|
564 |
mlen += (int)JLI_StrLen(errtext); |
2 | 565 |
} |
566 |
||
567 |
message = (char *)JLI_MemAlloc(mlen); |
|
568 |
_vsnprintf(message, len, fmt, vl); |
|
569 |
message[len]='\0'; |
|
570 |
||
571 |
if (freeit) { |
|
572 |
JLI_StrCat(message, errtext); |
|
573 |
} |
|
574 |
||
575 |
MessageBox(NULL, message, "Java Virtual Machine Launcher", |
|
576 |
(MB_OK|MB_ICONSTOP|MB_APPLMODAL)); |
|
577 |
||
578 |
JLI_MemFree(message); |
|
579 |
} else { |
|
580 |
vfprintf(stderr, fmt, vl); |
|
581 |
if (freeit) { |
|
582 |
fprintf(stderr, "%s", errtext); |
|
583 |
} |
|
584 |
} |
|
585 |
if (freeit) { |
|
586 |
(void)LocalFree((HLOCAL)errtext); |
|
587 |
} |
|
588 |
va_end(vl); |
|
589 |
} |
|
590 |
||
56106 | 591 |
JNIEXPORT void |
592 |
JLI_ReportExceptionDescription(JNIEnv * env) { |
|
2 | 593 |
if (IsJavaw()) { |
594 |
/* |
|
595 |
* This code should be replaced by code which opens a window with |
|
596 |
* the exception detail message, for now atleast put a dialog up. |
|
597 |
*/ |
|
598 |
MessageBox(NULL, "A Java Exception has occurred.", "Java Virtual Machine Launcher", |
|
599 |
(MB_OK|MB_ICONSTOP|MB_APPLMODAL)); |
|
600 |
} else { |
|
601 |
(*env)->ExceptionDescribe(env); |
|
602 |
} |
|
603 |
} |
|
604 |
||
605 |
/* |
|
606 |
* Wrapper for platform dependent unsetenv function. |
|
607 |
*/ |
|
608 |
int |
|
609 |
UnsetEnv(char *name) |
|
610 |
{ |
|
611 |
int ret; |
|
612 |
char *buf = JLI_MemAlloc(JLI_StrLen(name) + 2); |
|
613 |
buf = JLI_StrCat(JLI_StrCpy(buf, name), "="); |
|
614 |
ret = _putenv(buf); |
|
615 |
JLI_MemFree(buf); |
|
616 |
return (ret); |
|
617 |
} |
|
618 |
||
619 |
/* --- Splash Screen shared library support --- */ |
|
620 |
||
621 |
static const char* SPLASHSCREEN_SO = "\\bin\\splashscreen.dll"; |
|
622 |
||
623 |
static HMODULE hSplashLib = NULL; |
|
624 |
||
625 |
void* SplashProcAddress(const char* name) { |
|
626 |
char libraryPath[MAXPATHLEN]; /* some extra space for JLI_StrCat'ing SPLASHSCREEN_SO */ |
|
627 |
||
628 |
if (!GetJREPath(libraryPath, MAXPATHLEN)) { |
|
629 |
return NULL; |
|
630 |
} |
|
631 |
if (JLI_StrLen(libraryPath)+JLI_StrLen(SPLASHSCREEN_SO) >= MAXPATHLEN) { |
|
632 |
return NULL; |
|
633 |
} |
|
634 |
JLI_StrCat(libraryPath, SPLASHSCREEN_SO); |
|
635 |
||
636 |
if (!hSplashLib) { |
|
637 |
hSplashLib = LoadLibrary(libraryPath); |
|
638 |
} |
|
639 |
if (hSplashLib) { |
|
640 |
return GetProcAddress(hSplashLib, name); |
|
641 |
} else { |
|
642 |
return NULL; |
|
643 |
} |
|
644 |
} |
|
645 |
||
646 |
void SplashFreeLibrary() { |
|
647 |
if (hSplashLib) { |
|
648 |
FreeLibrary(hSplashLib); |
|
649 |
hSplashLib = NULL; |
|
650 |
} |
|
651 |
} |
|
652 |
||
653 |
/* |
|
654 |
* Block current thread and continue execution in a new thread |
|
655 |
*/ |
|
656 |
int |
|
657 |
ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) { |
|
658 |
int rslt = 0; |
|
659 |
unsigned thread_id; |
|
660 |
||
661 |
#ifndef STACK_SIZE_PARAM_IS_A_RESERVATION |
|
662 |
#define STACK_SIZE_PARAM_IS_A_RESERVATION (0x10000) |
|
663 |
#endif |
|
664 |
||
665 |
/* |
|
666 |
* STACK_SIZE_PARAM_IS_A_RESERVATION is what we want, but it's not |
|
667 |
* supported on older version of Windows. Try first with the flag; and |
|
668 |
* if that fails try again without the flag. See MSDN document or HotSpot |
|
669 |
* source (os_win32.cpp) for details. |
|
670 |
*/ |
|
671 |
HANDLE thread_handle = |
|
672 |
(HANDLE)_beginthreadex(NULL, |
|
673 |
(unsigned)stack_size, |
|
674 |
continuation, |
|
675 |
args, |
|
676 |
STACK_SIZE_PARAM_IS_A_RESERVATION, |
|
677 |
&thread_id); |
|
678 |
if (thread_handle == NULL) { |
|
679 |
thread_handle = |
|
680 |
(HANDLE)_beginthreadex(NULL, |
|
681 |
(unsigned)stack_size, |
|
682 |
continuation, |
|
683 |
args, |
|
684 |
0, |
|
685 |
&thread_id); |
|
686 |
} |
|
7004
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
687 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
688 |
/* AWT preloading (AFTER main thread start) */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
689 |
#ifdef ENABLE_AWT_PRELOAD |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
690 |
/* D3D preloading */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
691 |
if (awtPreloadD3D != 0) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
692 |
char *envValue; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
693 |
/* D3D routines checks env.var J2D_D3D if no appropriate |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
694 |
* command line params was specified |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
695 |
*/ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
696 |
envValue = getenv("J2D_D3D"); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
697 |
if (envValue != NULL && JLI_StrCaseCmp(envValue, "false") == 0) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
698 |
awtPreloadD3D = 0; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
699 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
700 |
/* Test that AWT preloading isn't disabled by J2D_D3D_PRELOAD env.var */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
701 |
envValue = getenv("J2D_D3D_PRELOAD"); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
702 |
if (envValue != NULL && JLI_StrCaseCmp(envValue, "false") == 0) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
703 |
awtPreloadD3D = 0; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
704 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
705 |
if (awtPreloadD3D < 0) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
706 |
/* If awtPreloadD3D is still undefined (-1), test |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
707 |
* if it is turned on by J2D_D3D_PRELOAD env.var. |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
708 |
* By default it's turned OFF. |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
709 |
*/ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
710 |
awtPreloadD3D = 0; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
711 |
if (envValue != NULL && JLI_StrCaseCmp(envValue, "true") == 0) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
712 |
awtPreloadD3D = 1; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
713 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
714 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
715 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
716 |
if (awtPreloadD3D) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
717 |
AWTPreload(D3D_PRELOAD_FUNC); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
718 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
719 |
#endif /* ENABLE_AWT_PRELOAD */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
720 |
|
2 | 721 |
if (thread_handle) { |
722 |
WaitForSingleObject(thread_handle, INFINITE); |
|
723 |
GetExitCodeThread(thread_handle, &rslt); |
|
724 |
CloseHandle(thread_handle); |
|
725 |
} else { |
|
726 |
rslt = continuation(args); |
|
727 |
} |
|
7004
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
728 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
729 |
#ifdef ENABLE_AWT_PRELOAD |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
730 |
if (awtPreloaded) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
731 |
AWTPreloadStop(); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
732 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
733 |
#endif /* ENABLE_AWT_PRELOAD */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
734 |
|
2 | 735 |
return rslt; |
736 |
} |
|
737 |
||
1323
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
738 |
/* Unix only, empty on windows. */ |
2 | 739 |
void SetJavaLauncherPlatformProps() {} |
39
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
740 |
|
1323
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
741 |
/* |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
742 |
* The implementation for finding classes from the bootstrap |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
743 |
* class loader, refer to java.h |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
744 |
*/ |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
745 |
static FindClassFromBootLoader_t *findBootClass = NULL; |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
746 |
|
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
747 |
jclass FindBootStrapClass(JNIEnv *env, const char *classname) |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
748 |
{ |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
749 |
HMODULE hJvm; |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
750 |
|
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
751 |
if (findBootClass == NULL) { |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
752 |
hJvm = GetModuleHandle(JVM_DLL); |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
753 |
if (hJvm == NULL) return NULL; |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
754 |
/* need to use the demangled entry point */ |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
755 |
findBootClass = (FindClassFromBootLoader_t *)GetProcAddress(hJvm, |
3834
16342ebd576d
6864028: Update the java launcher to use the new entry point JVM_FindClassFromBootLoader
mchung
parents:
3111
diff
changeset
|
756 |
"JVM_FindClassFromBootLoader"); |
1323
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
757 |
if (findBootClass == NULL) { |
3834
16342ebd576d
6864028: Update the java launcher to use the new entry point JVM_FindClassFromBootLoader
mchung
parents:
3111
diff
changeset
|
758 |
JLI_ReportErrorMessage(DLL_ERROR4, "JVM_FindClassFromBootLoader"); |
1323
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
759 |
return NULL; |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
760 |
} |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
761 |
} |
3834
16342ebd576d
6864028: Update the java launcher to use the new entry point JVM_FindClassFromBootLoader
mchung
parents:
3111
diff
changeset
|
762 |
return findBootClass(env, classname); |
1323
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
763 |
} |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
764 |
|
39
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
765 |
void |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
766 |
InitLauncher(boolean javaw) |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
767 |
{ |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
768 |
INITCOMMONCONTROLSEX icx; |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
769 |
|
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
770 |
/* |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
771 |
* Required for javaw mode MessageBox output as well as for |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
772 |
* HotSpot -XX:+ShowMessageBoxOnError in java mode, an empty |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
773 |
* flag field is sufficient to perform the basic UI initialization. |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
774 |
*/ |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
775 |
memset(&icx, 0, sizeof(INITCOMMONCONTROLSEX)); |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
776 |
icx.dwSize = sizeof(INITCOMMONCONTROLSEX); |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
777 |
InitCommonControlsEx(&icx); |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
778 |
_isjavaw = javaw; |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
779 |
JLI_SetTraceLauncher(); |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
780 |
} |
7004
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
781 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
782 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
783 |
/* ============================== */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
784 |
/* AWT preloading */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
785 |
#ifdef ENABLE_AWT_PRELOAD |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
786 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
787 |
typedef int FnPreloadStart(void); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
788 |
typedef void FnPreloadStop(void); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
789 |
static FnPreloadStop *fnPreloadStop = NULL; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
790 |
static HMODULE hPreloadAwt = NULL; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
791 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
792 |
/* |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
793 |
* Starts AWT preloading |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
794 |
*/ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
795 |
int AWTPreload(const char *funcName) |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
796 |
{ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
797 |
int result = -1; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
798 |
/* load AWT library once (if several preload function should be called) */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
799 |
if (hPreloadAwt == NULL) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
800 |
/* awt.dll is not loaded yet */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
801 |
char libraryPath[MAXPATHLEN]; |
29742
b73f38796859
8074840: Resolve disabled warnings for libjli and libjli_static
mikael
parents:
28984
diff
changeset
|
802 |
size_t jrePathLen = 0; |
7004
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
803 |
HMODULE hJava = NULL; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
804 |
HMODULE hVerify = NULL; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
805 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
806 |
while (1) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
807 |
/* awt.dll depends on jvm.dll & java.dll; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
808 |
* jvm.dll is already loaded, so we need only java.dll; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
809 |
* java.dll depends on MSVCRT lib & verify.dll. |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
810 |
*/ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
811 |
if (!GetJREPath(libraryPath, MAXPATHLEN)) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
812 |
break; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
813 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
814 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
815 |
/* save path length */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
816 |
jrePathLen = JLI_StrLen(libraryPath); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
817 |
|
25538 | 818 |
if (jrePathLen + JLI_StrLen("\\bin\\verify.dll") >= MAXPATHLEN) { |
819 |
/* jre path is too long, the library path will not fit there; |
|
820 |
* report and abort preloading |
|
821 |
*/ |
|
822 |
JLI_ReportErrorMessage(JRE_ERROR11); |
|
823 |
break; |
|
824 |
} |
|
825 |
||
7004
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
826 |
/* load msvcrt 1st */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
827 |
LoadMSVCRT(); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
828 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
829 |
/* load verify.dll */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
830 |
JLI_StrCat(libraryPath, "\\bin\\verify.dll"); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
831 |
hVerify = LoadLibrary(libraryPath); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
832 |
if (hVerify == NULL) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
833 |
break; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
834 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
835 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
836 |
/* restore jrePath */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
837 |
libraryPath[jrePathLen] = 0; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
838 |
/* load java.dll */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
839 |
JLI_StrCat(libraryPath, "\\bin\\" JAVA_DLL); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
840 |
hJava = LoadLibrary(libraryPath); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
841 |
if (hJava == NULL) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
842 |
break; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
843 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
844 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
845 |
/* restore jrePath */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
846 |
libraryPath[jrePathLen] = 0; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
847 |
/* load awt.dll */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
848 |
JLI_StrCat(libraryPath, "\\bin\\awt.dll"); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
849 |
hPreloadAwt = LoadLibrary(libraryPath); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
850 |
if (hPreloadAwt == NULL) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
851 |
break; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
852 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
853 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
854 |
/* get "preloadStop" func ptr */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
855 |
fnPreloadStop = (FnPreloadStop *)GetProcAddress(hPreloadAwt, "preloadStop"); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
856 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
857 |
break; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
858 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
859 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
860 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
861 |
if (hPreloadAwt != NULL) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
862 |
FnPreloadStart *fnInit = (FnPreloadStart *)GetProcAddress(hPreloadAwt, funcName); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
863 |
if (fnInit != NULL) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
864 |
/* don't forget to stop preloading */ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
865 |
awtPreloaded = 1; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
866 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
867 |
result = fnInit(); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
868 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
869 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
870 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
871 |
return result; |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
872 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
873 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
874 |
/* |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
875 |
* Terminates AWT preloading |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
876 |
*/ |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
877 |
void AWTPreloadStop() { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
878 |
if (fnPreloadStop != NULL) { |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
879 |
fnPreloadStop(); |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
880 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
881 |
} |
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
882 |
|
3f92ea1ffcac
6867515: Reduce impact of D3D initializion on startup time
amenkov
parents:
6535
diff
changeset
|
883 |
#endif /* ENABLE_AWT_PRELOAD */ |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
884 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
885 |
int |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
886 |
JVMInit(InvocationFunctions* ifn, jlong threadStackSize, |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
887 |
int argc, char **argv, |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
888 |
int mode, char *what, int ret) |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
889 |
{ |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
890 |
ShowSplashScreen(); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
891 |
return ContinueInNewThread(ifn, threadStackSize, argc, argv, mode, what, ret); |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
892 |
} |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
893 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
894 |
void |
30467
075f4f160f19
8076264: [macosx] Launching app on MacOSX requires enclosing class
serb
parents:
29742
diff
changeset
|
895 |
PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm) |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
896 |
{ |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
897 |
// stubbed out for windows and *nixes. |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
898 |
} |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
899 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
900 |
void |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
901 |
RegisterThread() |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
902 |
{ |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
903 |
// stubbed out for windows and *nixes. |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
904 |
} |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
905 |
|
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
906 |
/* |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
907 |
* on windows, we return a false to indicate this option is not applicable |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
908 |
*/ |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
909 |
jboolean |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
910 |
ProcessPlatformOption(const char *arg) |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
911 |
{ |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
912 |
return JNI_FALSE; |
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
9842
diff
changeset
|
913 |
} |
13411
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
914 |
|
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
915 |
/* |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
916 |
* At this point we have the arguments to the application, and we need to |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
917 |
* check with original stdargs in order to compare which of these truly |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
918 |
* needs expansion. cmdtoargs will specify this if it finds a bare |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
919 |
* (unquoted) argument containing a glob character(s) ie. * or ? |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
920 |
*/ |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
921 |
jobjectArray |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
922 |
CreateApplicationArgs(JNIEnv *env, char **strv, int argc) |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
923 |
{ |
29742
b73f38796859
8074840: Resolve disabled warnings for libjli and libjli_static
mikael
parents:
28984
diff
changeset
|
924 |
int i, j, idx; |
b73f38796859
8074840: Resolve disabled warnings for libjli and libjli_static
mikael
parents:
28984
diff
changeset
|
925 |
size_t tlen; |
13411
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
926 |
jobjectArray outArray, inArray; |
39640
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
927 |
char *arg, **nargv; |
13411
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
928 |
jboolean needs_expansion = JNI_FALSE; |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
929 |
jmethodID mid; |
39640
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
930 |
int stdargc; |
13411
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
931 |
StdArg *stdargs; |
39640
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
932 |
int *appArgIdx; |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
933 |
int isTool; |
13411
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
934 |
jclass cls = GetLauncherHelperClass(env); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
935 |
NULL_CHECK0(cls); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
936 |
|
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
937 |
if (argc == 0) { |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
938 |
return NewPlatformStringArray(env, strv, argc); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
939 |
} |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
940 |
// the holy grail we need to compare with. |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
941 |
stdargs = JLI_GetStdArgs(); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
942 |
stdargc = JLI_GetStdArgc(); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
943 |
|
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
944 |
// sanity check, this should never happen |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
945 |
if (argc > stdargc) { |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
946 |
JLI_TraceLauncher("Warning: app args is larger than the original, %d %d\n", argc, stdargc); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
947 |
JLI_TraceLauncher("passing arguments as-is.\n"); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
948 |
return NewPlatformStringArray(env, strv, argc); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
949 |
} |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
950 |
|
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
951 |
// sanity check, match the args we have, to the holy grail |
39640
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
952 |
idx = JLI_GetAppArgIndex(); |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
953 |
isTool = (idx == 0); |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
954 |
if (isTool) { idx++; } // skip tool name |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
955 |
JLI_TraceLauncher("AppArgIndex: %d points to %s\n", idx, stdargs[idx].arg); |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
956 |
|
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
957 |
appArgIdx = calloc(argc, sizeof(int)); |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
958 |
for (i = idx, j = 0; i < stdargc; i++) { |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
959 |
if (isTool) { // filter -J used by tools to pass JVM options |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
960 |
arg = stdargs[i].arg; |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
961 |
if (arg[0] == '-' && arg[1] == 'J') { |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
962 |
continue; |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
963 |
} |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
964 |
} |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
965 |
appArgIdx[j++] = i; |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
966 |
} |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
967 |
// sanity check, ensure same number of arguments for application |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
968 |
if (j != argc) { |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
969 |
JLI_TraceLauncher("Warning: app args count doesn't match, %d %d\n", j, argc); |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
970 |
JLI_TraceLauncher("passing arguments as-is.\n"); |
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
971 |
JLI_MemFree(appArgIdx); |
13411
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
972 |
return NewPlatformStringArray(env, strv, argc); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
973 |
} |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
974 |
|
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
975 |
// make a copy of the args which will be expanded in java if required. |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
976 |
nargv = (char **)JLI_MemAlloc(argc * sizeof(char*)); |
39640
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
977 |
for (i = 0; i < argc; i++) { |
39761 | 978 |
jboolean arg_expand; |
39640
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
979 |
j = appArgIdx[i]; |
39761 | 980 |
arg_expand = (JLI_StrCmp(stdargs[j].arg, strv[i]) == 0) |
981 |
? stdargs[j].has_wildcard |
|
982 |
: JNI_FALSE; |
|
13411
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
983 |
if (needs_expansion == JNI_FALSE) |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
984 |
needs_expansion = arg_expand; |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
985 |
|
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
986 |
// indicator char + String + NULL terminator, the java method will strip |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
987 |
// out the first character, the indicator character, so no matter what |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
988 |
// we add the indicator |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
989 |
tlen = 1 + JLI_StrLen(strv[i]) + 1; |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
990 |
nargv[i] = (char *) JLI_MemAlloc(tlen); |
16091
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
991 |
if (JLI_Snprintf(nargv[i], tlen, "%c%s", arg_expand ? 'T' : 'F', |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
992 |
strv[i]) < 0) { |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
993 |
return NULL; |
4eb1062acb5b
8002091: tools/launcher/ToolsOpts.java test started to fail since 7u11 b01 on Windows
ksrini
parents:
16077
diff
changeset
|
994 |
} |
13411
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
995 |
JLI_TraceLauncher("%s\n", nargv[i]); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
996 |
} |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
997 |
|
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
998 |
if (!needs_expansion) { |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
999 |
// clean up any allocated memory and return back the old arguments |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1000 |
for (i = 0 ; i < argc ; i++) { |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1001 |
JLI_MemFree(nargv[i]); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1002 |
} |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1003 |
JLI_MemFree(nargv); |
39640
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
1004 |
JLI_MemFree(appArgIdx); |
13411
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1005 |
return NewPlatformStringArray(env, strv, argc); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1006 |
} |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1007 |
NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls, |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1008 |
"expandArgs", |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1009 |
"([Ljava/lang/String;)[Ljava/lang/String;")); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1010 |
|
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1011 |
// expand the arguments that require expansion, the java method will strip |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1012 |
// out the indicator character. |
22279
877c94f9476b
8031494: [launcher] java launcher should check for JNI Pending exceptions.
ksrini
parents:
22066
diff
changeset
|
1013 |
NULL_CHECK0(inArray = NewPlatformStringArray(env, nargv, argc)); |
13411
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1014 |
outArray = (*env)->CallStaticObjectMethod(env, cls, mid, inArray); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1015 |
for (i = 0; i < argc; i++) { |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1016 |
JLI_MemFree(nargv[i]); |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1017 |
} |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1018 |
JLI_MemFree(nargv); |
39640
6f1a839ff43d
8132379: -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
henryjen
parents:
34960
diff
changeset
|
1019 |
JLI_MemFree(appArgIdx); |
13411
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1020 |
return outArray; |
224a28370893
7146424: Wildcard expansion for single entry classpath
ksrini
parents:
12047
diff
changeset
|
1021 |
} |