From 3fae74ec922b5240ab58c1c71fa07f2e46c7072f Mon Sep 17 00:00:00 2001 From: Irwin D'Souza Date: Wed, 2 Jun 2021 13:49:18 -0400 Subject: [PATCH] Remove unused TR::CompilationTracingFacility TR::CompilationTracingFacility was only used by the debugger extensions which has been deleted. Therefore, this is all essentially dead code. Signed-off-by: Irwin D'Souza --- .../control/CompilationOperations.hpp | 48 ---------- .../compiler/control/CompilationRuntime.hpp | 8 -- .../compiler/control/CompilationThread.cpp | 42 +-------- .../control/CompilationTracingFacility.hpp | 94 ------------------- .../compiler/control/MethodToBeCompiled.cpp | 4 +- 5 files changed, 3 insertions(+), 193 deletions(-) delete mode 100644 runtime/compiler/control/CompilationOperations.hpp delete mode 100644 runtime/compiler/control/CompilationTracingFacility.hpp diff --git a/runtime/compiler/control/CompilationOperations.hpp b/runtime/compiler/control/CompilationOperations.hpp deleted file mode 100644 index 10482fa5fd4..00000000000 --- a/runtime/compiler/control/CompilationOperations.hpp +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2021 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 - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] http://openjdk.java.net/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception - *******************************************************************************/ - -#ifndef COMPILATIONOPERATIONS_HPP -#define COMPILATIONOPERATIONS_HPP - -#pragma once - -enum TR_CompilationOperations - { - OP_Empty, - OP_HasAcquiredCompilationMonitor, - OP_WillReleaseCompilationMonitor, - OP_WillNotifyCompilationMonitor, - OP_WillWaitOnCompilationMonitor, - OP_HasFinishedWaitingOnCompilationMonitor, - OP_StateChange, - OP_WillWaitOnSlotMonitorAfterCompMonRelease, // This entry will appear out-of-order - OP_CompileOnSeparateThreadEnter, - OP_WillStopCompilationThreads, - // If adding new entries, please add names as well in CompilationThread.cpp - OperationNames - OP_LastValidOperation - }; -#if (OP_LastValidOperation > 255) -#error "cannot have more than 255 operations because we use 8 bits to store then" -#endif - -#endif // COMPILATIONOPERATIONS_HPP - diff --git a/runtime/compiler/control/CompilationRuntime.hpp b/runtime/compiler/control/CompilationRuntime.hpp index 06535773f19..b197d009cf7 100644 --- a/runtime/compiler/control/CompilationRuntime.hpp +++ b/runtime/compiler/control/CompilationRuntime.hpp @@ -28,8 +28,6 @@ #include "AtomicSupport.hpp" #include "compile/CompilationTypes.hpp" #include "control/CompilationPriority.hpp" -#include "control/CompilationOperations.hpp" -#include "control/CompilationTracingFacility.hpp" #include "control/ClassHolder.hpp" #include "env/CpuUtilization.hpp" #include "env/Processors.hpp" @@ -928,9 +926,6 @@ class CompilationInfo int32_t getIprofilerMaxCount() const { return _iprofilerMaxCount; } void setIprofilerMaxCount(int32_t n) { _iprofilerMaxCount = n; } - bool compTracingEnabled() const { return _compilationTracingFacility.isInitialized(); } - void addCompilationTraceEntry(J9VMThread * vmThread, TR_CompilationOperations op, uint32_t otherData=0); - TR_SharedCacheRelocationRuntime *reloRuntime() { return &_sharedCacheReloRuntime; } int32_t incNumSeriousFailures() { return ++_numSeriousFailures; } // no atomicity guarantees for the increment @@ -1084,8 +1079,6 @@ class CompilationInfo static int32_t LARGE_QUEUE; static int32_t VERY_LARGE_QUEUE; - static const char *OperationNames[]; - struct CompilationStatistics _stats; struct CompilationStatsPerInterval _intervalStats; TR_PersistentArray *_persistedMethods; @@ -1246,7 +1239,6 @@ class CompilationInfo TR_LowPriorityCompQueue _lowPriorityCompilationScheduler; TR_JProfilingQueue _JProfilingQueue; - TR::CompilationTracingFacility _compilationTracingFacility; // Must be initialized before using TR_CpuEntitlement _cpuEntitlement; TR_JitSampleInfo _jitSampleInfo; TR_SharedCacheRelocationRuntime _sharedCacheReloRuntime; diff --git a/runtime/compiler/control/CompilationThread.cpp b/runtime/compiler/control/CompilationThread.cpp index f2bb34c7915..09955bf9a3a 100644 --- a/runtime/compiler/control/CompilationThread.cpp +++ b/runtime/compiler/control/CompilationThread.cpp @@ -950,7 +950,6 @@ void TR::CompilationInfoPerThread::setCompilationThreadState(CompilationThreadState v) { TR::CompilationInfoPerThreadBase::setCompilationThreadState(v); - getCompilationInfo()->addCompilationTraceEntry(_compilationThread, OP_StateChange, (uint8_t)v); } bool @@ -1171,12 +1170,6 @@ TR::CompilationInfo::CompilationInfo(J9JITConfig *jitConfig) : } statCompErrors.init("CompilationErrors", compilationErrorNames, 0); - // Options might not exist at this point - // - static char *compTracing = feGetEnv("TR_CompTracing"); - if (compTracing) - _compilationTracingFacility.initialize(256); // the size must be a power of two - setSamplerState(TR::CompilationInfo::SAMPLER_NOT_INITIALIZED); setIsWarmSCC(TR_maybe); @@ -1427,54 +1420,25 @@ void TR::CompilationInfo::rtlogRelease() _rtlogMonitor->exit(); } -const char * TR::CompilationInfo::OperationNames[] = - { - "EMPTY", - "HasAcquiredCompilationMonitor", - "WillReleaseCompilationMonitor", - "WillNotifyCompilationMonitor", - "WillWaitOnCompilationMonitor", - "HasFinishedWaitingOnCompilationMonitor", - "Changed state", - "WillWaitOnSlotMonitorAfterCompMonRelease", - "CompileOnSeparateThreadEnter", - "INVALID" - }; - -void TR::CompilationInfo::addCompilationTraceEntry(J9VMThread * vmThread, TR_CompilationOperations op, uint32_t otherData) - { - if (compTracingEnabled()) - { - _compilationTracingFacility.addNewEntry(vmThread, op, (uint32_t)otherData); - } - } - - void TR::CompilationInfo::acquireCompMonitor(J9VMThread *vmThread) // used when we know we have a compilation monitor { getCompilationMonitor()->enter(); - addCompilationTraceEntry(vmThread, OP_HasAcquiredCompilationMonitor); } void TR::CompilationInfo::releaseCompMonitor(J9VMThread *vmThread) // used when we know we have a compilation monitor { - addCompilationTraceEntry(vmThread, OP_WillReleaseCompilationMonitor); getCompilationMonitor()->exit(); } void TR::CompilationInfo::waitOnCompMonitor(J9VMThread *vmThread) { - addCompilationTraceEntry(vmThread, OP_WillWaitOnCompilationMonitor); getCompilationMonitor()->wait(); - addCompilationTraceEntry(vmThread, OP_HasFinishedWaitingOnCompilationMonitor); } intptr_t TR::CompilationInfo::waitOnCompMonitorTimed(J9VMThread *vmThread, int64_t millis, int32_t nanos) { intptr_t retCode; - addCompilationTraceEntry(vmThread, OP_WillWaitOnCompilationMonitor); retCode = getCompilationMonitor()->wait_timed(millis, nanos); - addCompilationTraceEntry(vmThread, OP_HasFinishedWaitingOnCompilationMonitor); return retCode; } @@ -3464,8 +3428,6 @@ void TR::CompilationInfo::stopCompilationThreads() #endif acquireCompMonitor(vmThread); - addCompilationTraceEntry(vmThread, OP_WillStopCompilationThreads); - // Cycle through all non-diagnostic threads and stop them for (uint8_t i = 0; i < getNumTotalCompilationThreads(); i++) { @@ -5860,7 +5822,7 @@ void *TR::CompilationInfo::compileOnSeparateThread(J9VMThread * vmThread, TR::Il debugPrint(vmThread, "\tapplication thread acquiring compilation monitor\n"); acquireCompMonitor(vmThread); debugPrint(vmThread, "+CM\n"); - addCompilationTraceEntry(vmThread, OP_CompileOnSeparateThreadEnter); + // Even before checking whether compilation threads are active, we need // to check if a compilation for this body has already been performed @@ -6316,7 +6278,7 @@ void *TR::CompilationInfo::compileOnSeparateThread(J9VMThread * vmThread, TR::Il // Before releasing the compilation monitor, mark that we have one more thead waiting for this entry // entry->_numThreadsWaiting++; - addCompilationTraceEntry(vmThread, OP_WillWaitOnSlotMonitorAfterCompMonRelease); + // Release the compilation monitor // debugPrint(vmThread, "\tapplication thread releasing compilation monitor\n"); diff --git a/runtime/compiler/control/CompilationTracingFacility.hpp b/runtime/compiler/control/CompilationTracingFacility.hpp deleted file mode 100644 index 0dca1409985..00000000000 --- a/runtime/compiler/control/CompilationTracingFacility.hpp +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2021 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 - * distribution and is available at https://www.eclipse.org/legal/epl-2.0/ - * or the Apache License, Version 2.0 which accompanies this distribution and - * is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * This Source Code may also be made available under the following - * Secondary Licenses when the conditions for such availability set - * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU - * General Public License, version 2 with the GNU Classpath - * Exception [1] and GNU General Public License, version 2 with the - * OpenJDK Assembly Exception [2]. - * - * [1] https://www.gnu.org/software/classpath/license.html - * [2] http://openjdk.java.net/legal/assembly-exception.html - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception - *******************************************************************************/ - -#ifndef COMPILATIONTRACINGFACILITY_HPP -#define COMPILATIONTRACINGFACILITY_HPP - -#pragma once - -#include -#include "env/TRMemory.hpp" -#include "env/jittypes.h" -#include "control/CompilationOperations.hpp" - -extern "C" { -struct J9VMThread; -} - -//---------------------------- TR_CompilationTracingEntry ------------------ -// This is used for debugging purposes and only under a JIT option to avoid overhead -//------------------------------------------------------------------------- -struct TR_CompilationTracingEntry - { - TR_PERSISTENT_ALLOC(TR_Memory::OptimizationPlan) // lie about the type as this is for debug only - uint16_t _J9VMThreadId; // last meaningful bits from the vm thread pointer - uint8_t _operation; - uint8_t _otherData; - }; // TR_CompilationTracingEntry - - -namespace TR -{ - -class CompilationTracingFacility - { - public: - TR_PERSISTENT_ALLOC(TR_Memory::OptimizationPlan) // lie about the type as this is for debug only - CompilationTracingFacility() : _circularBuffer(0),_size(0),_index(0){} // default constructor must be present - void initialize(int32_t size) - { - if (!isInitialized()) - { - if (size == (size & (-size))) // power of two test - { - //fprintf(stderr, "Allocating buffer\n"); - _circularBuffer = new (PERSISTENT_NEW) TR_CompilationTracingEntry[size]; - memset(_circularBuffer, 0, size*sizeof(TR_CompilationTracingEntry)); - _size = size; - _index = 0; - } - } - } - // Must have compilationMonitor in hand when calling this method - void addNewEntry(J9VMThread * vmThread, TR_CompilationOperations op, uint8_t otherData) - { - _circularBuffer[_index]._J9VMThreadId = compactJ9VMThreadPtr(vmThread); - _circularBuffer[_index]._operation = (uint8_t)op; - _circularBuffer[_index]._otherData = otherData; - _index = ++_index & (_size-1); // assumes size is a power of two - } - uint16_t compactJ9VMThreadPtr(J9VMThread *vmThread) const { return (uint16_t)((((uintptr_t)vmThread) >> 8) & 0xffff); } - J9VMThread *expandJ9VMThreadId(uint16_t vmThreadId) const { return (J9VMThread*)(((uintptr_t)vmThreadId) << 8);} - bool isInitialized() const { return _circularBuffer ? true : false; } - int32_t getIndex() const { return _index; } - int32_t getSize() const { return _size; } - int32_t getNextIndex(int32_t i) const { return (i+1) & (getSize()-1); } - TR_CompilationTracingEntry *getEntry(int32_t index) { return index < _size ? _circularBuffer+index : 0; } - private: - TR_CompilationTracingEntry *_circularBuffer; // will be allocated dynamically - int32_t _index; // pointing to next entry to be written (oldest) - int32_t _size; // size of the circular buffer; power of two - }; // CompilationTracingFacility - -} // namespace TR -#endif // COMPILATIONTRACINGFACILITY_HPP - diff --git a/runtime/compiler/control/MethodToBeCompiled.cpp b/runtime/compiler/control/MethodToBeCompiled.cpp index d3b0adba0d2..c1cff524085 100644 --- a/runtime/compiler/control/MethodToBeCompiled.cpp +++ b/runtime/compiler/control/MethodToBeCompiled.cpp @@ -109,15 +109,13 @@ void TR_MethodToBeCompiled::acquireSlotMonitor(J9VMThread *vmThread) { getMonitor()->enter(); // Must have the compilationMonitor in hand to be able to call this method - //addCompilationTraceEntry(vmThread, OP_HasAcquiredCompilationMonitor); //fprintf(stderr, "Thread %p has acquired slot monitor\n", vmThread); } void TR_MethodToBeCompiled::releaseSlotMonitor(J9VMThread *vmThread) { // Must have the compilationMonitor in hand to be able to call this method - //addCompilationTraceEntry(vmThread, OP_HasAcquiredCompilationMonitor); - //fprintf(stderr, "Thread %p will release slot monitor\n", vmThread); + //fprintf(stderr, "Thread %p will release slot monitor\n", vmThread); getMonitor()->exit(); }