@@ -534,14 +534,7 @@ public void run(Map<Method, CEntryPointData> entryPoints,
534
534
535
535
try (TemporaryBuildDirectoryProviderImpl tempDirectoryProvider = new TemporaryBuildDirectoryProviderImpl ()) {
536
536
ImageSingletons .add (TemporaryBuildDirectoryProvider .class , tempDirectoryProvider );
537
- if (ImageLayerBuildingSupport .buildingSharedLayer ()) {
538
- HostedImageLayerBuildingSupport .setupImageLayerArtifacts (imageName );
539
- }
540
537
doRun (entryPoints , javaMainSupport , imageName , k , harnessSubstitutions );
541
- if (ImageLayerBuildingSupport .buildingSharedLayer ()) {
542
- ImageSingletonsSupportImpl .HostedManagement .persist ();
543
- HostedImageLayerBuildingSupport .singleton ().archiveLayer (imageName );
544
- }
545
538
} finally {
546
539
reporter .ensureCreationStageEndCompleted ();
547
540
}
@@ -573,7 +566,7 @@ protected void doRun(Map<Method, CEntryPointData> entryPoints, JavaMainSupport j
573
566
574
567
try (DebugContext debug = new Builder (options , new GraalDebugHandlersFactory (GraalAccess .getOriginalSnippetReflection ())).build ();
575
568
DebugCloseable featureCleanup = () -> featureHandler .forEachFeature (Feature ::cleanup )) {
576
- setupNativeImage (options , entryPoints , javaMainSupport , harnessSubstitutions , debug );
569
+ setupNativeImage (imageName , options , entryPoints , javaMainSupport , harnessSubstitutions , debug );
577
570
578
571
boolean returnAfterAnalysis = runPointsToAnalysis (imageName , options , debug );
579
572
if (returnAfterAnalysis ) {
@@ -766,6 +759,12 @@ protected void doRun(Map<Method, CEntryPointData> entryPoints, JavaMainSupport j
766
759
AfterImageWriteAccessImpl afterConfig = new AfterImageWriteAccessImpl (featureHandler , loader , hUniverse , inv , tmpDir , image .getImageKind (), debug );
767
760
featureHandler .forEachFeature (feature -> feature .afterImageWrite (afterConfig ));
768
761
}
762
+ try (StopTimer t = TimerCollection .createTimerAndStart (TimerCollection .Registry .ARCHIVE_LAYER )) {
763
+ if (ImageLayerBuildingSupport .buildingSharedLayer ()) {
764
+ ImageSingletonsSupportImpl .HostedManagement .persist ();
765
+ HostedImageLayerBuildingSupport .singleton ().archiveLayer (imageName );
766
+ }
767
+ }
769
768
reporter .printCreationEnd (image .getImageFileSize (), heap .getLayerObjectCount (), image .getImageHeapSize (), codeCache .getCodeAreaSize (), numCompilations , image .getDebugInfoSize ());
770
769
}
771
770
}
@@ -902,10 +901,13 @@ protected boolean verifyAssignableTypes() {
902
901
}
903
902
904
903
@ SuppressWarnings ("try" )
905
- protected void setupNativeImage (OptionValues options , Map <Method , CEntryPointData > entryPoints , JavaMainSupport javaMainSupport ,
904
+ protected void setupNativeImage (String imageName , OptionValues options , Map <Method , CEntryPointData > entryPoints , JavaMainSupport javaMainSupport ,
906
905
SubstitutionProcessor harnessSubstitutions , DebugContext debug ) {
907
906
try (Indent ignored = debug .logAndIndent ("setup native-image builder" )) {
908
907
try (StopTimer ignored1 = TimerCollection .createTimerAndStart (TimerCollection .Registry .SETUP )) {
908
+ if (ImageLayerBuildingSupport .buildingSharedLayer ()) {
909
+ HostedImageLayerBuildingSupport .setupImageLayerArtifacts (imageName );
910
+ }
909
911
SubstrateTargetDescription target = createTarget ();
910
912
ImageSingletons .add (Platform .class , loader .platform );
911
913
ImageSingletons .add (SubstrateTargetDescription .class , target );
0 commit comments