From 3e8aa20050cf46a52b6c9dba82b794be5ceefaae Mon Sep 17 00:00:00 2001 From: Marius Pirvu Date: Mon, 21 Feb 2022 11:50:56 -0500 Subject: [PATCH] Simplify -Xaggressive code One of the effects of the `-Xaggressive` option is to enable static final field folding for the JCL classes. Static final field folding is already enabled under OSR (which is on by default) so this code is now obsolete and will be deleted in this commit. For the cases where OSR is disabled we can still enable static final field folding for JCL classes with the `TR_EnableJCLStaticFinalFieldFolding` environment variable. Signed-off-by: Marius Pirvu --- runtime/compiler/optimizer/J9TransformUtil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/compiler/optimizer/J9TransformUtil.cpp b/runtime/compiler/optimizer/J9TransformUtil.cpp index 909dd396141..6f661baeae2 100644 --- a/runtime/compiler/optimizer/J9TransformUtil.cpp +++ b/runtime/compiler/optimizer/J9TransformUtil.cpp @@ -696,7 +696,7 @@ bool J9::TransformUtil::foldFinalFieldsIn(TR_OpaqueClassBlock *clazz, const char return false; static char *enableJCLFolding = feGetEnv("TR_EnableJCLStaticFinalFieldFolding"); - if ((enableJCLFolding || comp->getOption(TR_AggressiveOpts)) + if (enableJCLFolding && isStatic && comp->fej9()->isClassLibraryClass(clazz) && comp->fej9()->isClassInitialized(clazz))