@@ -548,14 +548,7 @@ public void run(Map<Method, CEntryPointData> entryPoints,
548
548
549
549
try (TemporaryBuildDirectoryProviderImpl tempDirectoryProvider = new TemporaryBuildDirectoryProviderImpl ()) {
550
550
ImageSingletons .add (TemporaryBuildDirectoryProvider .class , tempDirectoryProvider );
551
- if (ImageLayerBuildingSupport .buildingSharedLayer ()) {
552
- HostedImageLayerBuildingSupport .setupImageLayerArtifacts (imageName );
553
- }
554
551
doRun (entryPoints , javaMainSupport , imageName , k , harnessSubstitutions );
555
- if (ImageLayerBuildingSupport .buildingSharedLayer ()) {
556
- ImageSingletonsSupportImpl .HostedManagement .persist ();
557
- HostedImageLayerBuildingSupport .singleton ().archiveLayer (imageName );
558
- }
559
552
} finally {
560
553
reporter .ensureCreationStageEndCompleted ();
561
554
}
@@ -587,7 +580,7 @@ protected void doRun(Map<Method, CEntryPointData> entryPoints, JavaMainSupport j
587
580
588
581
try (DebugContext debug = new Builder (options , new GraalDebugHandlersFactory (GraalAccess .getOriginalSnippetReflection ())).build ();
589
582
DebugCloseable featureCleanup = () -> featureHandler .forEachFeature (Feature ::cleanup )) {
590
- setupNativeImage (options , entryPoints , javaMainSupport , harnessSubstitutions , debug );
583
+ setupNativeImage (imageName , options , entryPoints , javaMainSupport , harnessSubstitutions , debug );
591
584
592
585
boolean returnAfterAnalysis = runPointsToAnalysis (imageName , options , debug );
593
586
if (returnAfterAnalysis ) {
@@ -780,6 +773,12 @@ protected void doRun(Map<Method, CEntryPointData> entryPoints, JavaMainSupport j
780
773
AfterImageWriteAccessImpl afterConfig = new AfterImageWriteAccessImpl (featureHandler , loader , hUniverse , inv , tmpDir , image .getImageKind (), debug );
781
774
featureHandler .forEachFeature (feature -> feature .afterImageWrite (afterConfig ));
782
775
}
776
+ try (StopTimer t = TimerCollection .createTimerAndStart (TimerCollection .Registry .ARCHIVE_LAYER )) {
777
+ if (ImageLayerBuildingSupport .buildingSharedLayer ()) {
778
+ ImageSingletonsSupportImpl .HostedManagement .persist ();
779
+ HostedImageLayerBuildingSupport .singleton ().archiveLayer (imageName );
780
+ }
781
+ }
783
782
reporter .printCreationEnd (image .getImageFileSize (), heap .getLayerObjectCount (), image .getImageHeapSize (), codeCache .getCodeAreaSize (), numCompilations , image .getDebugInfoSize ());
784
783
}
785
784
}
@@ -916,10 +915,13 @@ protected boolean verifyAssignableTypes() {
916
915
}
917
916
918
917
@ SuppressWarnings ("try" )
919
- protected void setupNativeImage (OptionValues options , Map <Method , CEntryPointData > entryPoints , JavaMainSupport javaMainSupport ,
918
+ protected void setupNativeImage (String imageName , OptionValues options , Map <Method , CEntryPointData > entryPoints , JavaMainSupport javaMainSupport ,
920
919
SubstitutionProcessor harnessSubstitutions , DebugContext debug ) {
921
920
try (Indent ignored = debug .logAndIndent ("setup native-image builder" )) {
922
921
try (StopTimer ignored1 = TimerCollection .createTimerAndStart (TimerCollection .Registry .SETUP )) {
922
+ if (ImageLayerBuildingSupport .buildingSharedLayer ()) {
923
+ HostedImageLayerBuildingSupport .setupImageLayerArtifacts (imageName );
924
+ }
923
925
SubstrateTargetDescription target = createTarget ();
924
926
ImageSingletons .add (Platform .class , loader .platform );
925
927
ImageSingletons .add (SubstrateTargetDescription .class , target );
0 commit comments