diff --git a/runtime/compiler/control/JITClientCompilationThread.cpp b/runtime/compiler/control/JITClientCompilationThread.cpp index 7e2d4fd0c81..140261c6bb0 100644 --- a/runtime/compiler/control/JITClientCompilationThread.cpp +++ b/runtime/compiler/control/JITClientCompilationThread.cpp @@ -1788,6 +1788,8 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes std::vector ramMethods(numMethods); std::vector vTableOffsets(numMethods); std::vector methodInfos(numMethods); + // vector does not seem to work + std::vector unresolvedInCPs(numMethods); for (int32_t i = 0; i < numMethods; ++i) { int32_t cpIndex = cpIndices[i]; @@ -1796,7 +1798,7 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes TR_OpaqueMethodBlock *ramMethod = NULL; uint32_t vTableOffset = 0; TR_ResolvedJ9JITServerMethodInfo methodInfo; - bool unresolvedInCP = false; + bool unresolvedInCP = true; switch (type) { case TR_ResolvedMethodType::VirtualFromCP: @@ -1834,8 +1836,9 @@ handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::Mes ramMethods[i] = ramMethod; vTableOffsets[i] = vTableOffset; methodInfos[i] = methodInfo; + unresolvedInCPs[i] = unresolvedInCP; } - client->write(response, ramMethods, vTableOffsets, methodInfos); + client->write(response, ramMethods, vTableOffsets, methodInfos, unresolvedInCPs); } break; case MessageType::ResolvedMethod_getConstantDynamicTypeFromCP: diff --git a/runtime/compiler/control/JITServerCompilationThread.cpp b/runtime/compiler/control/JITServerCompilationThread.cpp index 476c78d89a9..016a81e16dc 100644 --- a/runtime/compiler/control/JITServerCompilationThread.cpp +++ b/runtime/compiler/control/JITServerCompilationThread.cpp @@ -1477,12 +1477,18 @@ TR::CompilationInfoPerThreadRemote::getCachedIProfilerInfo(TR_OpaqueMethodBlock * @param key Identifier used to identify a resolved method in resolved methods cache * @param method The resolved method of interest * @param vTableSlot The vTableSlot for the resolved method of interest + * @param isUnresolvedInCP The unresolvedInCP boolean value of interest * @param methodInfo Additional method info about the resolved method of interest * @return returns void */ void -TR::CompilationInfoPerThreadRemote::cacheResolvedMethod(TR_ResolvedMethodKey key, TR_OpaqueMethodBlock *method, - uint32_t vTableSlot, const TR_ResolvedJ9JITServerMethodInfo &methodInfo, int32_t ttlForUnresolved) +TR::CompilationInfoPerThreadRemote::cacheResolvedMethod(TR_ResolvedMethodKey key, + TR_OpaqueMethodBlock *method, + uint32_t vTableSlot, + const TR_ResolvedJ9JITServerMethodInfo + &methodInfo, + bool isUnresolvedInCP, + int32_t ttlForUnresolved) { static bool useCaching = !feGetEnv("TR_DisableResolvedMethodsCaching"); if (!useCaching) @@ -1518,6 +1524,7 @@ TR::CompilationInfoPerThreadRemote::cacheResolvedMethod(TR_ResolvedMethodKey key cacheEntry.persistentBodyInfo = bodyInfo; cacheEntry.persistentMethodInfo = pMethodInfo; cacheEntry.IPMethodInfo = entry; + cacheEntry.isUnresolvedInCP = isUnresolvedInCP; // time-to-live for cached unresolved methods. // Irrelevant for resolved methods. @@ -1599,7 +1606,7 @@ TR::CompilationInfoPerThreadRemote::getCachedResolvedMethod(TR_ResolvedMethodKey if (*resolvedMethod) { if (unresolvedInCP) - *unresolvedInCP = false; + *unresolvedInCP = methodCacheEntry.isUnresolvedInCP; return true; } else diff --git a/runtime/compiler/control/JITServerCompilationThread.hpp b/runtime/compiler/control/JITServerCompilationThread.hpp index 8687918a548..3135ebd5363 100644 --- a/runtime/compiler/control/JITServerCompilationThread.hpp +++ b/runtime/compiler/control/JITServerCompilationThread.hpp @@ -85,7 +85,7 @@ class CompilationInfoPerThreadRemote : public TR::CompilationInfoPerThread bool cacheIProfilerInfo(TR_OpaqueMethodBlock *method, uint32_t byteCodeIndex, TR_IPBytecodeHashTableEntry *entry); TR_IPBytecodeHashTableEntry *getCachedIProfilerInfo(TR_OpaqueMethodBlock *method, uint32_t byteCodeIndex, bool *methodInfoPresent); - void cacheResolvedMethod(TR_ResolvedMethodKey key, TR_OpaqueMethodBlock *method, uint32_t vTableSlot, const TR_ResolvedJ9JITServerMethodInfo &methodInfo, int32_t ttlForUnresolved = 2); + void cacheResolvedMethod(TR_ResolvedMethodKey key, TR_OpaqueMethodBlock *method, uint32_t vTableSlot, const TR_ResolvedJ9JITServerMethodInfo &methodInfo, bool isUnresolvedInCP, int32_t ttlForUnresolved = 2); bool getCachedResolvedMethod(TR_ResolvedMethodKey key, TR_ResolvedJ9JITServerMethod *owningMethod, TR_ResolvedMethod **resolvedMethod, bool *unresolvedInCP = NULL); TR_ResolvedMethodKey getResolvedMethodKey(TR_ResolvedMethodType type, TR_OpaqueClassBlock *ramClass, int32_t cpIndex, TR_OpaqueClassBlock *classObject = NULL); diff --git a/runtime/compiler/env/j9methodServer.cpp b/runtime/compiler/env/j9methodServer.cpp index 7fb487b4306..ae583c2aed5 100644 --- a/runtime/compiler/env/j9methodServer.cpp +++ b/runtime/compiler/env/j9methodServer.cpp @@ -387,7 +387,14 @@ TR_ResolvedJ9JITServerMethod::getResolvedPossiblyPrivateVirtualMethod(TR::Compil if (createResolvedMethod) { resolvedMethod = createResolvedMethodFromJ9Method(comp, cpIndex, vTableIndex, ramMethod, unresolvedInCP, aotStats, methodInfo); - compInfoPT->cacheResolvedMethod(compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::VirtualFromCP, (TR_OpaqueClassBlock *) _ramClass, cpIndex), (TR_OpaqueMethodBlock *) ramMethod, (uint32_t) vTableIndex, methodInfo); + compInfoPT->cacheResolvedMethod( + compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::VirtualFromCP, + (TR_OpaqueClassBlock *) _ramClass, cpIndex), + (TR_OpaqueMethodBlock *) ramMethod, + (uint32_t) vTableIndex, + methodInfo, + *unresolvedInCP + ); } } } @@ -694,7 +701,14 @@ TR_ResolvedJ9JITServerMethod::getResolvedStaticMethod(TR::Compilation * comp, I_ } else { - compInfoPT->cacheResolvedMethod(compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::Static, (TR_OpaqueClassBlock *) _ramClass, cpIndex), (TR_OpaqueMethodBlock *) ramMethod, 0, methodInfo); + compInfoPT->cacheResolvedMethod( + compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::Static, + (TR_OpaqueClassBlock *) _ramClass, cpIndex), + (TR_OpaqueMethodBlock *) ramMethod, + 0, + methodInfo, + *unresolvedInCP + ); } return resolvedMethod; @@ -751,7 +765,13 @@ TR_ResolvedJ9JITServerMethod::getResolvedSpecialMethod(TR::Compilation * comp, I } else { - compInfoPT->cacheResolvedMethod(compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::Special, clazz, cpIndex), (TR_OpaqueMethodBlock *) ramMethod, 0, methodInfo); + compInfoPT->cacheResolvedMethod( + compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::Special, clazz, cpIndex), + (TR_OpaqueMethodBlock *) ramMethod, + 0, + methodInfo, + *unresolvedInCP + ); } return resolvedMethod; @@ -882,7 +902,14 @@ TR_ResolvedJ9JITServerMethod::getResolvedInterfaceMethod(TR::Compilation * comp, // to uniquely identify it. if (resolvedMethod) { - compInfoPT->cacheResolvedMethod(compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::Interface, clazz, cpIndex, classObject), (TR_OpaqueMethodBlock *) ramMethod, 0, methodInfo); + compInfoPT->cacheResolvedMethod( + compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::Interface, + clazz, cpIndex, classObject), + (TR_OpaqueMethodBlock *) ramMethod, + 0, + methodInfo, + true + ); return resolvedMethod; } @@ -932,8 +959,14 @@ TR_ResolvedJ9JITServerMethod::getResolvedImproperInterfaceMethod(TR::Compilation j9method = NULL; } - compInfoPT->cacheResolvedMethod(compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::ImproperInterface, (TR_OpaqueClassBlock *) _ramClass, cpIndex), - (TR_OpaqueMethodBlock *) j9method, vtableOffset, methodInfo); + compInfoPT->cacheResolvedMethod( + compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::ImproperInterface, + (TR_OpaqueClassBlock *) _ramClass, cpIndex), + (TR_OpaqueMethodBlock *) j9method, + vtableOffset, + methodInfo, + true + ); if (j9method == NULL) return NULL; else @@ -997,7 +1030,14 @@ TR_ResolvedJ9JITServerMethod::getResolvedVirtualMethod(TR::Compilation * comp, T resolvedMethod = ramMethod ? new (comp->trHeapMemory()) TR_ResolvedJ9JITServerMethod((TR_OpaqueMethodBlock *) ramMethod, _fe, comp->trMemory(), methodInfo, this) : 0; } if (resolvedMethod) - compInfoPT->cacheResolvedMethod(compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::VirtualFromOffset, clazz, virtualCallOffset, classObject), ramMethod, 0, methodInfo); + compInfoPT->cacheResolvedMethod( + compInfoPT->getResolvedMethodKey(TR_ResolvedMethodType::VirtualFromOffset, + clazz, virtualCallOffset, classObject), + (TR_OpaqueMethodBlock *) ramMethod, + 0, + methodInfo, + true + ); return resolvedMethod; } @@ -1664,12 +1704,13 @@ TR_ResolvedJ9JITServerMethod::cacheResolvedMethodsCallees(int32_t ttlForUnresolv // 2. Send a remote query to mirror all uncached resolved methods _stream->write(JITServer::MessageType::ResolvedMethod_getMultipleResolvedMethods, (TR_ResolvedJ9Method *) _remoteMirror, methodTypes, cpIndices); - auto recv = _stream->read, std::vector, std::vector>(); + auto recv = _stream->read, std::vector, std::vector, std::vector>(); // 3. Cache all received resolved methods auto &ramMethods = std::get<0>(recv); auto &vTableOffsets = std::get<1>(recv); auto &methodInfos = std::get<2>(recv); + auto &unresolvedInCPs = std::get<3>(recv); TR_ASSERT(numMethods == ramMethods.size(), "Number of received methods does not match the number of requested methods"); for (int32_t i = 0; i < numMethods; ++i) { @@ -1686,6 +1727,7 @@ TR_ResolvedJ9JITServerMethod::cacheResolvedMethodsCallees(int32_t ttlForUnresolv ramMethods[i], vTableOffsets[i], methodInfos[i], + (bool) unresolvedInCPs[i], ttlForUnresolved ); } @@ -1806,7 +1848,9 @@ TR_ResolvedJ9JITServerMethod::collectImplementorsCapped( (TR_OpaqueMethodBlock *) ramMethods[i], cpIndexOrOffset, methodInfos[i], - 0); // all received methods should be resolved + true, + 0 + ); // all received methods should be resolved success = compInfoPT->getCachedResolvedMethod(key, this, &resolvedMethod); } diff --git a/runtime/compiler/env/j9methodServer.hpp b/runtime/compiler/env/j9methodServer.hpp index 95adc56b360..d5dce1fa7ad 100644 --- a/runtime/compiler/env/j9methodServer.hpp +++ b/runtime/compiler/env/j9methodServer.hpp @@ -128,6 +128,7 @@ TR_ResolvedMethodCacheEntry TR_PersistentMethodInfo *persistentMethodInfo; TR_ContiguousIPMethodHashTableEntry *IPMethodInfo; int32_t ttlForUnresolved; + bool isUnresolvedInCP; }; using TR_ResolvedMethodInfoCache = UnorderedMap; diff --git a/runtime/compiler/net/CommunicationStream.hpp b/runtime/compiler/net/CommunicationStream.hpp index 6f4631f0c76..e12dcadaa0d 100644 --- a/runtime/compiler/net/CommunicationStream.hpp +++ b/runtime/compiler/net/CommunicationStream.hpp @@ -128,7 +128,7 @@ class CommunicationStream // likely to lose an increment when merging/rebasing/etc. // static const uint8_t MAJOR_NUMBER = 1; - static const uint16_t MINOR_NUMBER = 72; // ID: PB545sJS3QOBXIIPV5JZ + static const uint16_t MINOR_NUMBER = 73; // ID: AwP1pJjbiAVBRCpcwuDt static const uint8_t PATCH_NUMBER = 0; static uint32_t CONFIGURATION_FLAGS;