@@ -359,7 +359,9 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, String ol
359
359
* precision of implicit stack traces. But for optimized release builds, including pgo
360
360
* builds, it is a valuable image size reduction.
361
361
*/
362
- SubstrateOptions .ReduceImplicitExceptionStackTraceInformation .update (values , newLevel == OptimizationLevel .O3 );
362
+ if (!values .containsKey (SubstrateOptions .ReduceImplicitExceptionStackTraceInformation )) {
363
+ SubstrateOptions .ReduceImplicitExceptionStackTraceInformation .update (values , newLevel == OptimizationLevel .O3 );
364
+ }
363
365
364
366
GraalOptions .OptimizeLongJumps .update (values , !newLevel .isOneOf (OptimizationLevel .O0 , OptimizationLevel .BUILD_TIME ));
365
367
@@ -375,18 +377,18 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, String ol
375
377
};
376
378
377
379
public static void configureOs (EconomicMap <OptionKey <?>, Object > values ) {
378
- enable (GraalOptions .ReduceCodeSize , values );
379
- enable (ReduceImplicitExceptionStackTraceInformation , values );
380
- enable (GraalOptions .OptimizeLongJumps , values );
380
+ enableForOs (GraalOptions .ReduceCodeSize , values );
381
+ enableForOs (ReduceImplicitExceptionStackTraceInformation , values );
382
+ enableForOs (GraalOptions .OptimizeLongJumps , values );
381
383
382
384
/*
383
385
* Remove all loop optimizations that can increase code size, i.e., duplicate a loop body
384
386
* somehow.
385
387
*/
386
- disable (GraalOptions .LoopPeeling , values );
387
- disable (GraalOptions .LoopUnswitch , values );
388
- disable (GraalOptions .FullUnroll , values );
389
- disable (GraalOptions .PartialUnroll , values );
388
+ disableForOs (GraalOptions .LoopPeeling , values );
389
+ disableForOs (GraalOptions .LoopUnswitch , values );
390
+ disableForOs (GraalOptions .FullUnroll , values );
391
+ disableForOs (GraalOptions .PartialUnroll , values );
390
392
391
393
/*
392
394
* Do not align code to further reduce code size.
@@ -396,17 +398,17 @@ public static void configureOs(EconomicMap<OptionKey<?>, Object> values) {
396
398
GraalOptions .IsolatedLoopHeaderAlignment .update (values , 0 );
397
399
// We cannot check for architecture at the moment because ImageSingletons has not been
398
400
// initialized yet
399
- disable (AMD64Assembler .Options .UseBranchesWithin32ByteBoundary , values );
401
+ disableForOs (AMD64Assembler .Options .UseBranchesWithin32ByteBoundary , values );
400
402
401
403
/*
402
404
* Do not run PEA - it can fan out allocations too much.
403
405
*/
404
- disable (GraalOptions .PartialEscapeAnalysis , values );
406
+ disableForOs (GraalOptions .PartialEscapeAnalysis , values );
405
407
406
408
/*
407
409
* Do not fan out division.
408
410
*/
409
- disable (GraalOptions .OptimizeDiv , values );
411
+ disableForOs (GraalOptions .OptimizeDiv , values );
410
412
411
413
/*
412
414
* Do more conditional elimination.
@@ -416,14 +418,22 @@ public static void configureOs(EconomicMap<OptionKey<?>, Object> values) {
416
418
/*
417
419
* Every dead code elimination should be non-optional
418
420
*/
419
- disable (DeadCodeEliminationPhase .Options .ReduceDCE , values );
421
+ disableForOs (DeadCodeEliminationPhase .Options .ReduceDCE , values );
420
422
}
421
423
422
- public static void disable (OptionKey <Boolean > key , EconomicMap <OptionKey <?>, Object > values ) {
424
+ /**
425
+ * Sets {@code key} to false in {@code values} as a consequence of {@code -Os} having been
426
+ * specified. This silently overrides any existing value for {@code key} in {@code values}.
427
+ */
428
+ public static void disableForOs (OptionKey <Boolean > key , EconomicMap <OptionKey <?>, Object > values ) {
423
429
key .update (values , false );
424
430
}
425
431
426
- public static void enable (OptionKey <Boolean > key , EconomicMap <OptionKey <?>, Object > values ) {
432
+ /**
433
+ * Sets {@code key} to true in {@code values} as a consequence of {@code -Os} having been
434
+ * specified. This silently overrides any existing value for {@code key} in {@code values}.
435
+ */
436
+ public static void enableForOs (OptionKey <Boolean > key , EconomicMap <OptionKey <?>, Object > values ) {
427
437
key .update (values , true );
428
438
}
429
439
0 commit comments