190 // The state of AppCDS is as follows: |
190 // The state of AppCDS is as follows: |
191 // |
191 // |
192 // -> cdsUninitialized |
192 // -> cdsUninitialized |
193 // -> cdsGenCache If -Xappcds:generatecache |
193 // -> cdsGenCache If -Xappcds:generatecache |
194 // -> cdsDisabled If -Xappcds:off |
194 // -> cdsDisabled If -Xappcds:off |
195 // -> cdsEnabled If "AppCDSJVMOptions" section is present |
195 // -> cdsEnabled If "AppCDSJavaOptions" section is present |
196 // -> cdsAuto If "AppCDSJVMOptions" section is present and |
196 // -> cdsAuto If "AppCDSJavaOptions" section is present and |
197 // app.appcds.cache=auto |
197 // app.appcds.cache=auto |
198 // -> cdsDisabled Default |
198 // -> cdsDisabled Default |
199 // |
199 // |
200 void Package::PromoteAppCDSState(ISectionalPropertyContainer* Config) { |
200 void Package::PromoteAppCDSState(ISectionalPropertyContainer* Config) { |
201 Platform& platform = Platform::GetInstance(); |
201 Platform& platform = Platform::GetInstance(); |
211 break; |
211 break; |
212 } |
212 } |
213 |
213 |
214 case cdsUninitialized: { |
214 case cdsUninitialized: { |
215 if (Config->ContainsSection( |
215 if (Config->ContainsSection( |
216 keys[CONFIG_SECTION_APPCDSJVMOPTIONS]) == true) { |
216 keys[CONFIG_SECTION_APPCDSJAVAOPTIONS]) == true) { |
217 // If the AppCDS section is present then enable AppCDS. |
217 // If the AppCDS section is present then enable AppCDS. |
218 TString appCDSCacheValue; |
218 TString appCDSCacheValue; |
219 |
219 |
220 // If running with AppCDS enabled, and the configuration has |
220 // If running with AppCDS enabled, and the configuration has |
221 // been setup so "auto" is enabled, then |
221 // been setup so "auto" is enabled, then |
246 case cdsUninitialized: { |
246 case cdsUninitialized: { |
247 throw Exception(_T("Internal Error")); |
247 throw Exception(_T("Internal Error")); |
248 } |
248 } |
249 |
249 |
250 case cdsDisabled: { |
250 case cdsDisabled: { |
251 Config->GetSection(keys[CONFIG_SECTION_JVMOPTIONS], |
251 Config->GetSection(keys[CONFIG_SECTION_JAVAOPTIONS], |
252 FBootFields->FJVMArgs); |
252 FBootFields->FJVMArgs); |
253 break; |
253 break; |
254 } |
254 } |
255 |
255 |
256 case cdsGenCache: { |
256 case cdsGenCache: { |
257 Config->GetSection(keys[ |
257 Config->GetSection(keys[ |
258 CONFIG_SECTION_APPCDSGENERATECACHEJVMOPTIONS], |
258 CONFIG_SECTION_APPCDSGENERATECACHEJAVAOPTIONS], |
259 FBootFields->FJVMArgs); |
259 FBootFields->FJVMArgs); |
260 break; |
260 break; |
261 } |
261 } |
262 |
262 |
263 case cdsAuto: |
263 case cdsAuto: |
264 case cdsEnabled: { |
264 case cdsEnabled: { |
265 if (Config->GetValue(keys[CONFIG_SECTION_APPCDSJVMOPTIONS], |
265 if (Config->GetValue(keys[CONFIG_SECTION_APPCDSJAVAOPTIONS], |
266 _T( "-XX:SharedArchiveFile"), |
266 _T( "-XX:SharedArchiveFile"), |
267 FBootFields->FAppCDSCacheFileName) == true) { |
267 FBootFields->FAppCDSCacheFileName) == true) { |
268 // File names may contain the incorrect path separators. |
268 // File names may contain the incorrect path separators. |
269 // The cache file name must be corrected at this point. |
269 // The cache file name must be corrected at this point. |
270 if (FBootFields->FAppCDSCacheFileName.empty() == false) { |
270 if (FBootFields->FAppCDSCacheFileName.empty() == false) { |
273 if (iniConfig != NULL) { |
273 if (iniConfig != NULL) { |
274 FBootFields->FAppCDSCacheFileName = |
274 FBootFields->FAppCDSCacheFileName = |
275 FilePath::FixPathForPlatform( |
275 FilePath::FixPathForPlatform( |
276 FBootFields->FAppCDSCacheFileName); |
276 FBootFields->FAppCDSCacheFileName); |
277 iniConfig->SetValue(keys[ |
277 iniConfig->SetValue(keys[ |
278 CONFIG_SECTION_APPCDSJVMOPTIONS], |
278 CONFIG_SECTION_APPCDSJAVAOPTIONS], |
279 _T( "-XX:SharedArchiveFile"), |
279 _T( "-XX:SharedArchiveFile"), |
280 FBootFields->FAppCDSCacheFileName); |
280 FBootFields->FAppCDSCacheFileName); |
281 } |
281 } |
282 } |
282 } |
283 |
283 |
284 Config->GetSection(keys[CONFIG_SECTION_APPCDSJVMOPTIONS], |
284 Config->GetSection(keys[CONFIG_SECTION_APPCDSJAVAOPTIONS], |
285 FBootFields->FJVMArgs); |
285 FBootFields->FJVMArgs); |
286 } |
286 } |
287 |
287 |
288 break; |
288 break; |
289 } |
289 } |