Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Unnecessary Assertion in removeHCRGuards #20292

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions runtime/compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ endif()
# Add optional user-specified compiler flags that only apply to the JIT.
list(APPEND J9_CFLAGS ${J9JIT_EXTRA_CFLAGS})
list(APPEND J9_CXXFLAGS ${J9JIT_EXTRA_CXXFLAGS})
#list(APPEND J9_CFLAGS ${J9JIT_EXTRA_CFLAGS} "-DPROD_WITH_ASSUMES")
#list(APPEND J9_CXXFLAGS ${J9JIT_EXTRA_CXXFLAGS} "-DPROD_WITH_ASSUMES")

# Note: J9_CFLAGS and J9_CXXFLAGS are appended after J9_SHAREDFLAGS so that
# OMR_PLATFORM_C_COMPILE_OPTIONS and OMR_PLATFORM_CXX_COMPILE_OPTIONS
Expand Down
14 changes: 14 additions & 0 deletions runtime/compiler/env/j9method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "env/j9method.h"

#include <stdio.h>
#include <stddef.h>
#include "bcnames.h"
#include "fastJNI.h"
Expand Down Expand Up @@ -222,11 +223,15 @@ TR_J9VMBase::createResolvedMethodWithSignature(TR_Memory * trMemory, TR_OpaqueMe
#if defined(J9VM_OPT_SHARED_CLASSES) && (defined(TR_HOST_X86) || defined(TR_HOST_POWER) || defined(TR_HOST_S390) || defined(TR_HOST_ARM) || defined(TR_HOST_ARM64))
#if defined(J9VM_OPT_JITSERVER)
if (_compInfoPT->getMethodBeingCompiled()->_useAOTCacheCompilation)
{
printf("Creating aMethod %p 1\n", aMethod);
result = new (trMemory->trHeapMemory()) TR_ResolvedRelocatableJ9Method(aMethod, this, trMemory, owningMethod, vTableSlot);
}
else
#endif /* defined(J9VM_OPT_JITSERVER) */
if (TR::Options::sharedClassCache())
{
printf("Creating aMethod %p 2\n", aMethod);
result = new (trMemory->trHeapMemory()) TR_ResolvedRelocatableJ9Method(aMethod, this, trMemory, owningMethod, vTableSlot);
TR::Compilation *comp = TR::comp();
if (comp && comp->getOption(TR_UseSymbolValidationManager))
Expand Down Expand Up @@ -1009,7 +1014,14 @@ TR_ResolvedRelocatableJ9Method::TR_ResolvedRelocatableJ9Method(TR_OpaqueMethodBl
if (comp->getOption(TR_UseSymbolValidationManager))
{
TR::SymbolValidationManager *svm = comp->getSymbolValidationManager();

if (!svm->isAlreadyValidated(aMethod))
{
printf("Failure Checking %p\n", aMethod);
}

SVM_ASSERT_ALREADY_VALIDATED(svm, aMethod);

SVM_ASSERT_ALREADY_VALIDATED(svm, containingClass());
}
else if (owner)
Expand Down Expand Up @@ -1867,6 +1879,7 @@ TR_ResolvedRelocatableJ9Method::createResolvedMethodFromJ9Method(TR::Compilation
(sameLoaders = fej9->sameClassLoaders(clazzOfInlinedMethod, clazzOfCompiledMethod)) ||
isSystemClassLoader)
{
printf("Creating aMethod %p 3\n", j9method);
resolvedMethod = new (comp->trHeapMemory()) TR_ResolvedRelocatableJ9Method((TR_OpaqueMethodBlock *) j9method, _fe, comp->trMemory(), this, vTableSlot);
if (!ignoringLocalSCC && comp->getOption(TR_UseSymbolValidationManager))
{
Expand Down Expand Up @@ -7132,6 +7145,7 @@ TR_ResolvedJ9Method::getResolvedVirtualMethod(TR::Compilation * comp, TR_OpaqueC
TR_ResolvedMethod *m;
if (_fe->isAOT_DEPRECATED_DO_NOT_USE())
{
printf("Creating aMethod %p 4\n", ramMethod);
m = ramMethod ? new (comp->trHeapMemory()) TR_ResolvedRelocatableJ9Method((TR_OpaqueMethodBlock *) ramMethod, _fe, comp->trMemory(), this) : 0;
}
else
Expand Down
5 changes: 5 additions & 0 deletions runtime/compiler/env/j9methodServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
*******************************************************************************/

#include <stdio.h>
#include "j9methodServer.hpp"
#include "control/CompilationRuntime.hpp"
#include "control/CompilationThread.hpp"
Expand Down Expand Up @@ -1343,7 +1344,10 @@ TR_ResolvedJ9JITServerMethod::createResolvedMethodMirror(TR_ResolvedJ9JITServerM
if (!((TR_J9VMBase *) fe)->isAOT_DEPRECATED_DO_NOT_USE())
resolvedMethod = new (trMemory->trHeapMemory()) TR_ResolvedJ9Method(method, fe, trMemory, owningMethod, vTableSlot);
else
{
printf("Creating aMethod %p 5\n", method);
resolvedMethod = new (trMemory->trHeapMemory()) TR_ResolvedRelocatableJ9Method(method, fe, trMemory, owningMethod, vTableSlot);
}
if (!resolvedMethod) throw std::bad_alloc();

packMethodInfo(methodInfo, resolvedMethod, fe);
Expand Down Expand Up @@ -1398,6 +1402,7 @@ TR_ResolvedJ9JITServerMethod::createResolvedMethodFromJ9MethodMirror(TR_Resolved
(sameLoaders = fej9->sameClassLoaders(clazzOfInlinedMethod, clazzOfCompiledMethod)) ||
isSystemClassLoader)
{
printf("Creating aMethod %p 6\n", j9method);
resolvedMethod = new (comp->trHeapMemory()) TR_ResolvedRelocatableJ9Method((TR_OpaqueMethodBlock *) j9method, fe, comp->trMemory(), owningMethod, vTableSlot);
if (!resolvedMethod) throw std::bad_alloc();
}
Expand Down
1 change: 0 additions & 1 deletion runtime/compiler/optimizer/OSRGuardInsertion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ void TR_OSRGuardInsertion::removeHCRGuards(TR_BitVector &fearGeneratingNodes, TR
if (!node->isTheVirtualGuardForAGuardedInlinedCall()) { continue; }
TR_VirtualGuard *guardInfo = comp()->findVirtualGuardInfo(node);
TR_ASSERT(guardInfo, "we expect to get virtual guard info in HCRGuardRemoval!");
TR_ASSERT(!guardInfo->getByteCodeInfo().isInvalidByteCodeIndex(), "we expect to get valid bytecode info for a virtual guard!");

if (!guardAnalysis || guardAnalysis->_blockAnalysisInfo[cursor->getNextBlock()->getNumber()]->isEmpty())
{
Expand Down
13 changes: 13 additions & 0 deletions runtime/compiler/runtime/SymbolValidationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,10 @@ TR::SymbolValidationManager::appendNewRecord(void *value, TR::SymbolValidationRe
SVM_ASSERT(!inHeuristicRegion(), "Attempted to appendNewRecord in a heuristic region");
TR_ASSERT(!recordExists(record), "record is not new");

printf("Appending new record value %p\n", value);
if (!isAlreadyValidated(value))
{
printf("Appending new record value %p 2\n", value);
_valueToSymbolMap.insert(std::make_pair(value, getNewSymbolID()));
}
_symbolValidationRecords.push_front(record);
Expand Down Expand Up @@ -959,6 +961,7 @@ TR::SymbolValidationManager::addStaticMethodFromCPRecord(TR_OpaqueMethodBlock *m
{
TR_OpaqueClassBlock *beholder = _fej9->getClassFromCP(cp);
SVM_ASSERT_ALREADY_VALIDATED(this, beholder);
printf("adding new method record %p 1\n", method);
return addMethodRecord(new (_region) StaticMethodFromCPRecord(method, beholder, cpIndex));
}

Expand All @@ -967,6 +970,7 @@ TR::SymbolValidationManager::addSpecialMethodFromCPRecord(TR_OpaqueMethodBlock *
{
TR_OpaqueClassBlock *beholder = _fej9->getClassFromCP(cp);
SVM_ASSERT_ALREADY_VALIDATED(this, beholder);
printf("adding new method record %p 2\n", method);
return addMethodRecord(new (_region) SpecialMethodFromCPRecord(method, beholder, cpIndex));
}

Expand All @@ -975,6 +979,7 @@ TR::SymbolValidationManager::addVirtualMethodFromCPRecord(TR_OpaqueMethodBlock *
{
TR_OpaqueClassBlock *beholder = _fej9->getClassFromCP(cp);
SVM_ASSERT_ALREADY_VALIDATED(this, beholder);
printf("adding new method record %p 3\n", method);
return addMethodRecord(new (_region) VirtualMethodFromCPRecord(method, beholder, cpIndex));
}

Expand All @@ -989,6 +994,7 @@ TR::SymbolValidationManager::addVirtualMethodFromOffsetRecord(TR_OpaqueMethodBlo
if (virtualCallOffset != (int32_t)(int16_t)virtualCallOffset)
return false; // not enough space in the record

printf("adding new method record %p 4\n", method);
return addMethodRecord(new (_region) VirtualMethodFromOffsetRecord(method, beholder, virtualCallOffset, ignoreRtResolve));
}

Expand All @@ -997,6 +1003,7 @@ TR::SymbolValidationManager::addInterfaceMethodFromCPRecord(TR_OpaqueMethodBlock
{
SVM_ASSERT_ALREADY_VALIDATED(this, beholder);
SVM_ASSERT_ALREADY_VALIDATED(this, lookup);
printf("adding new method record %p 5\n", method);
return addMethodRecord(new (_region) InterfaceMethodFromCPRecord(method, beholder, lookup, cpIndex));
}

Expand All @@ -1005,6 +1012,7 @@ TR::SymbolValidationManager::addImproperInterfaceMethodFromCPRecord(TR_OpaqueMet
{
TR_OpaqueClassBlock *beholder = _fej9->getClassFromCP(cp);
SVM_ASSERT_ALREADY_VALIDATED(this, beholder);
printf("adding new method record %p 6\n", method);
return addMethodRecord(new (_region) ImproperInterfaceMethodFromCPRecord(method, beholder, cpIndex));
}

Expand All @@ -1017,6 +1025,8 @@ TR::SymbolValidationManager::addMethodFromClassAndSignatureRecord(TR_OpaqueMetho

SVM_ASSERT_ALREADY_VALIDATED(this, lookupClass);
SVM_ASSERT_ALREADY_VALIDATED(this, beholder);

printf("adding new method record %p 7\n", method);
return addMethodRecord(new (_region) MethodFromClassAndSigRecord(method, lookupClass, beholder));
}

Expand All @@ -1029,6 +1039,7 @@ TR::SymbolValidationManager::addMethodFromSingleImplementerRecord(TR_OpaqueMetho
{
SVM_ASSERT_ALREADY_VALIDATED(this, thisClass);
SVM_ASSERT_ALREADY_VALIDATED(this, callerMethod);
printf("adding new method record %p 8\n", method);
return addMethodRecord(new (_region) MethodFromSingleImplementer(method, thisClass, cpIndexOrVftSlot, callerMethod, useGetResolvedInterfaceMethod));
}

Expand All @@ -1040,6 +1051,7 @@ TR::SymbolValidationManager::addMethodFromSingleInterfaceImplementerRecord(TR_Op
{
SVM_ASSERT_ALREADY_VALIDATED(this, thisClass);
SVM_ASSERT_ALREADY_VALIDATED(this, callerMethod);
printf("adding new method record %p 9\n", method);
return addMethodRecord(new (_region) MethodFromSingleInterfaceImplementer(method, thisClass, cpIndex, callerMethod));
}

Expand All @@ -1051,6 +1063,7 @@ TR::SymbolValidationManager::addMethodFromSingleAbstractImplementerRecord(TR_Opa
{
SVM_ASSERT_ALREADY_VALIDATED(this, thisClass);
SVM_ASSERT_ALREADY_VALIDATED(this, callerMethod);
printf("adding new method record %p a\n", method);
return addMethodRecord(new (_region) MethodFromSingleAbstractImplementer(method, thisClass, vftSlot, callerMethod));
}

Expand Down