From 9163a4f917cbffd9c2a94662bbb015f8f10fdbb7 Mon Sep 17 00:00:00 2001 From: Rahil Shah Date: Tue, 10 Jul 2018 09:42:06 -0400 Subject: [PATCH] Comment and reword assert in Recompilation for jProfiling jProfiling should not use either sampling or counting to trip recompilation. For this kind of method bodies, we have emitted recompilation test to check method invocation count and loop frequency against tuned threshold to trip recompilation. Signed-off-by: Rahil Shah --- runtime/compiler/control/J9Recompilation.cpp | 4 ++++ runtime/compiler/p/codegen/PPCRecompilation.cpp | 4 ++-- runtime/compiler/x/codegen/X86Recompilation.cpp | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/runtime/compiler/control/J9Recompilation.cpp b/runtime/compiler/control/J9Recompilation.cpp index 7115943433a..c63939bfe84 100644 --- a/runtime/compiler/control/J9Recompilation.cpp +++ b/runtime/compiler/control/J9Recompilation.cpp @@ -207,6 +207,10 @@ J9::Recompilation::beforeOptimization() // if (self()->isProfilingCompilation()) // this asks the bodyInfo { + // JProfiling should not use either sampling or counting mechanism to trip recompilation. + // Even though _useSampling is set to true here, at the end of compilation we disable sampling + // causing us to rely only on the in-body recompilation test that relies on block frequency counter + // to trip recompilation making sure we have enough profiling data to use in recompilation. _useSampling = _compilation->getProfilingMode() != JitProfiling; self()->findOrCreateProfileInfo()->setProfilingCount (DEFAULT_PROFILING_COUNT); self()->findOrCreateProfileInfo()->setProfilingFrequency (DEFAULT_PROFILING_FREQUENCY); diff --git a/runtime/compiler/p/codegen/PPCRecompilation.cpp b/runtime/compiler/p/codegen/PPCRecompilation.cpp index 06402853c87..9b5e93421d0 100644 --- a/runtime/compiler/p/codegen/PPCRecompilation.cpp +++ b/runtime/compiler/p/codegen/PPCRecompilation.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corp. and others + * Copyright (c) 2000, 2018 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -167,7 +167,7 @@ TR::Instruction *TR_PPCRecompilation::generatePrologue(TR::Instruction *cursor) else { // This only applies to JitProfiling, as JProfiling uses sampling - TR_ASSERT(_compilation->getProfilingMode() == JitProfiling, "JProfiling should use sampling to trigger recompilation"); + TR_ASSERT(_compilation->getProfilingMode() == JitProfiling, "JProfiling should not use counting mechanism to trip recompilation"); cursor = generateTrg1Src1ImmInstruction(cg(), TR::InstOpCode::cmpi4, firstNode, cr0, gr0, 0, cursor); // this is just padding for consistent code length diff --git a/runtime/compiler/x/codegen/X86Recompilation.cpp b/runtime/compiler/x/codegen/X86Recompilation.cpp index d5986d5f5aa..deb6561267f 100644 --- a/runtime/compiler/x/codegen/X86Recompilation.cpp +++ b/runtime/compiler/x/codegen/X86Recompilation.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corp. and others + * Copyright (c) 2000, 2018 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -182,7 +182,7 @@ TR::Instruction *TR_X86Recompilation::generatePrologue(TR::Instruction *cursor) else { // This only applies to JitProfiling, as JProfiling uses sampling - TR_ASSERT(_compilation->getProfilingMode() == JitProfiling, "JProfiling should use sampling to trigger recompilation"); + TR_ASSERT(_compilation->getProfilingMode() == JitProfiling, "JProfiling should not use counting mechanism to trigger recompilation"); cursor = new (trHeapMemory()) TR::X86MemImmInstruction(cursor, CMP4MemImms, mRef, 0, cg()); }