int32_t GCConfigTest::removeObjectFromRootTable(const char *name) { OMRPORT_ACCESS_FROM_OMRVM(exampleVM->_omrVM); int32_t rt = 0; RootEntry searchEntry; RootEntry *rEntryPtr = NULL; searchEntry.name = name; rEntryPtr = (RootEntry *)hashTableFind(exampleVM->rootTable, &searchEntry); if (NULL == rEntryPtr) { rt = 1; omrtty_printf("%s:%d Failed to find root object %s in root table.\n", __FILE__, __LINE__, name); goto done; } if (0 != hashTableRemove(exampleVM->rootTable, rEntryPtr)) { rt = 1; omrtty_printf("%s:%d Failed to remove root object %s from root table!\n", __FILE__, __LINE__, name); goto done; } #if defined(OMRGCTEST_DEBUG) omrtty_printf("Remove object(%s) from root table.\n", name); #endif done: return rt; }
bool valgrindCheckObjectInPool(MM_GCExtensionsBase *extensions, uintptr_t baseAddress) { #if defined(VALGRIND_REQUEST_LOGS) VALGRIND_PRINTF("Checking for an object at 0x%lx\n", baseAddress); #endif /* defined(VALGRIND_REQUEST_LOGS) */ MUTEX_ENTER(extensions->memcheckHashTableMutex); bool exists = hashTableFind(extensions->memcheckHashTable, &baseAddress) != NULL ? true : false; MUTEX_EXIT(extensions->memcheckHashTableMutex); return exists; }
//______________________________________________________________________________ /// Finds the tunnel produced using the given public key. //______________________________________________________________________________ Tunnel* envelopeFindTunnelByPublicKey(NetInterface *ni, CryptoKey publicKey[CryptoBoxPublicKeySize]) { ASSERT(NULL != ni); ASSERT(NULL != ni->tunnelPublicKeyHashTable); ListHead *l = hashTableFind (ni->tunnelPublicKeyHashTable, publicKey); return l ? list_entry (l, Tunnel, tunnelPublicKeyList) : (Tunnel *) NULL; }
//______________________________________________________________________________ /// Finds the tunnel with the given public key. //______________________________________________________________________________ Tunnel* envelopeFindTunnelByHostname(NetInterface *ni, String *hostname) { ASSERT(NULL != ni); ASSERT(NULL != ni->tunnelHostnameHashTable); ASSERT(NULL != hostname && refSize(hostname) <= MaxHostnameSize); // RFC 1034 + terminating NULL. ListHead *l = hashTableFind (ni->tunnelHostnameHashTable, (HashKey) hostname); return l ? list_entry (l, Tunnel, tunnelHostnameList) : (Tunnel *) NULL; }
static RsslBool isStreamInUse(ProviderSession *pProvSession, RsslInt32 streamId, RsslMsgKey* key) { HashTableLink *pLink; ItemInfo *itemInfo; pLink = hashTableFind(&pProvSession->itemStreamIdTable, &streamId); if (!pLink) return RSSL_FALSE; itemInfo = HASH_TABLE_LINK_TO_OBJECT(ItemInfo, itemStreamIdTableLink, pLink); return ((rsslCompareMsgKeys(itemInfo->attributes.pMsgKey, key) != RSSL_RET_SUCCESS ) ? RSSL_TRUE : RSSL_FALSE); }
//______________________________________________________________________________ /// Finds the tunnel at a given remote address within ni. //______________________________________________________________________________ static Tunnel* _envelopeFindTunnel(NetInterface *ni, EnvelopeRemote *er) { ASSERT(NULL != ni); ASSERT(NULL != ni->tunnelIdHashTable); ASSERT(NULL != er); uchar tunnelId[TunnelIdSize]; envelopeGetTunnelId(tunnelId, ni->headers, &ni->envelopeLocal, er); ListHead *l = hashTableFind (ni->tunnelIdHashTable, tunnelId); return l ? list_entry (l, Tunnel, tunnelIdList) : (Tunnel *) NULL; }
static ItemInfo *findAlreadyOpenItem(ProviderSession *pProvSession, RsslMsg* msg, RsslItemAttributes* attribs) { HashTableLink *pLink = hashTableFind(&pProvSession->itemAttributesTable, attribs); return (pLink ? HASH_TABLE_LINK_TO_OBJECT(ItemInfo, itemAttributesTableLink, pLink) : NULL); }
omr_error_t OMR_MethodDictionary::getEntries(OMR_VMThread *vmThread, void **methodArray, size_t methodArrayCount, OMR_SampledMethodDescription *methodDescriptions, char *nameBuffer, size_t nameBytes, size_t *firstRetryMethod, size_t *nameBytesRemaining) { omr_error_t rc = OMR_ERROR_NONE; if (0 == omrthread_monitor_enter(_lock)) { OMR_SampledMethodDescription *currentMthDesc = methodDescriptions; size_t firstRetryMethodLocal = 0; size_t nameBytesAvailable = nameBytes; size_t nameBytesRemainingLocal = 0; char *nameBufferPos = nameBuffer; /* * Collect method descriptions until we encounter a description that can't fit into * the available nameBuffer. At this point, flip to RETRY mode: Stop collecting names, * and only count the remaining space required. */ for (size_t i = 0; i < methodArrayCount; i++) { OMR_MethodDictionaryEntry searchEntryHdr; /* NOTE This is only an entry header, and can't hold any propertyValues */ OMR_MethodDictionaryEntry *entry = NULL; searchEntryHdr.key = methodArray[i]; entry = (OMR_MethodDictionaryEntry *)hashTableFind(_hashTable, &searchEntryHdr); if (NULL == entry) { currentMthDesc->reasonCode = OMR_ERROR_NOT_AVAILABLE; } else { size_t nameBytesNeeded = countEntryNameBytesNeeded(entry); if (OMR_ERROR_RETRY == rc) { /* In RETRY mode. Only count the remaining space needed. */ currentMthDesc->reasonCode = OMR_ERROR_RETRY; nameBytesRemainingLocal += nameBytesNeeded; } else if (nameBytesNeeded <= nameBytesAvailable) { /* The description fits in nameBuffer. */ currentMthDesc->reasonCode = OMR_ERROR_NONE; copyEntryNameBytes(entry, currentMthDesc, nameBufferPos); nameBufferPos += nameBytesNeeded; nameBytesAvailable -= nameBytesNeeded; /* To minimize the size of the method dictionary, * delete entries that are successfully retrieved. */ _currentBytes -= nameBytesNeeded; cleanupEntryStrings(entry, this); if (0 != hashTableRemove(_hashTable, entry)) { rc = OMR_ERROR_INTERNAL; currentMthDesc->reasonCode = OMR_ERROR_INTERNAL; if (NULL != firstRetryMethod) { *firstRetryMethod = i; } break; } _currentBytes -= _sizeofEntry; } else { /* Just ran out of space in nameBuffer. Flip to RETRY mode. */ rc = OMR_ERROR_RETRY; firstRetryMethodLocal = i; currentMthDesc->reasonCode = OMR_ERROR_RETRY; nameBytesRemainingLocal += nameBytesNeeded; } } currentMthDesc = (OMR_SampledMethodDescription *)((uintptr_t)currentMthDesc + sizeof(OMR_SampledMethodDescription) + sizeof(const char *) * _numProperties); } if (OMR_ERROR_RETRY == rc) { if (NULL != firstRetryMethod) { *firstRetryMethod = firstRetryMethodLocal; } if (NULL != nameBytesRemaining) { *nameBytesRemaining = nameBytesRemainingLocal; } } omrthread_monitor_exit(_lock); } else { rc = OMR_ERROR_INTERNAL; } return rc; }
struct LRUItem * lruCacheFind(int key) { return hashTableFind(key); }