|
25 | 25 |
|
26 | 26 | extern "C" { |
27 | 27 |
|
| 28 | +void |
| 29 | +initializeBasicROMMethodInfo(J9StackWalkState *walkState, J9ROMMethod *romMethod) |
| 30 | +{ |
| 31 | + J9ROMMethodInfo *romMethodInfo = &walkState->romMethodInfo; |
| 32 | + memset(romMethodInfo, 0, sizeof(*romMethodInfo)); |
| 33 | + romMethodInfo->argCount = romMethod->argCount; |
| 34 | + romMethodInfo->tempCount = romMethod->tempCount; |
| 35 | + romMethodInfo->modifiers = romMethod->modifiers; |
| 36 | +#if defined(J9MAPCACHE_DEBUG) |
| 37 | + romMethodInfo->flags = J9MAPCACHE_VALID; |
| 38 | +#endif /* J9MAPCACHE_DEBUG */ |
| 39 | + if (!(romMethod->modifiers & J9AccStatic)) { |
| 40 | + if (J9UTF8_DATA(J9ROMMETHOD_NAME(romMethod))[0] == '<') { |
| 41 | + romMethodInfo->flags |= J9MAPCACHE_METHOD_IS_CONSTRUCTOR; |
| 42 | + } |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +void |
| 47 | +populateROMMethodInfo(J9StackWalkState *walkState, J9ROMMethod *romMethod, void *key) |
| 48 | +{ |
| 49 | + initializeBasicROMMethodInfo(walkState, romMethod); |
| 50 | +#if 0 |
| 51 | + bool found = false; |
| 52 | + J9Method *method = walkState->method; |
| 53 | + J9ClassLoader *classLoader = J9_CLASS_FROM_METHOD(method)->classLoader; |
| 54 | + omrthread_monitor_t mapCacheMutex = classLoader->mapCacheMutex; |
| 55 | + |
| 56 | + /* If the mapCacheMutex exists, the caching feature is enabled */ |
| 57 | + if (NULL != mapCacheMutex) { |
| 58 | + omrthread_monitor_enter(mapCacheMutex); |
| 59 | + J9HashTable *mapCache = classLoader->romMethodInfoCache; |
| 60 | + |
| 61 | + /* If the cache exists, check it for this key */ |
| 62 | + if (NULL != mapCache) { |
| 63 | + J9ROMMethodInfo exemplar = { 0 }; |
| 64 | + exemplar.key = key; |
| 65 | + J9ROMMethodInfo *entry = (J9ROMMethodInfo*)hashTableFind(mapCache, &exemplar); |
| 66 | + |
| 67 | + if (NULL != entry) { |
| 68 | + /* Cache hit - copy the info */ |
| 69 | + *romMethodInfo = *entry; |
| 70 | + } else { |
| 71 | + /* Cache miss - populate the info and cache it */ |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + omrthread_monitor_exit(mapCacheMutex); |
| 76 | + } |
| 77 | +#endif |
| 78 | +} |
| 79 | + |
| 80 | +#if 0 |
| 81 | + |
28 | 82 | /** |
29 | 83 | * @brief Map cache hash function |
30 | 84 | * @param key J9MapCacheEntry pointer |
@@ -83,7 +137,7 @@ checkCache(J9JavaVM *vm, J9ClassLoader *classLoader, void *key, J9HashTable *map |
83 | 137 | J9MapCacheEntry *entry = (J9MapCacheEntry*)hashTableFind(mapCache, &exemplar); |
84 | 138 |
|
85 | 139 | if (NULL != entry) { |
86 | | - memcpy(resultArrayBase, entry->bits, sizeof(U_32) * mapWords); |
| 140 | + memcpy(resultArrayBase, &entry->data.bits, sizeof(U_32) * mapWords); |
87 | 141 | found = true; |
88 | 142 | } |
89 | 143 | } |
@@ -135,7 +189,7 @@ updateCache(J9JavaVM *vm, J9ClassLoader *classLoader, void *key, J9HashTable **c |
135 | 189 | if (NULL != mapCache) { |
136 | 190 | J9MapCacheEntry entry = { 0 }; |
137 | 191 | entry.key = key; |
138 | | - memcpy(entry.bits, resultArrayBase, sizeof(U_32) * mapWords); |
| 192 | + memcpy(&entry.data.bits, resultArrayBase, sizeof(U_32) * mapWords); |
139 | 193 | hashTableAdd(mapCache, &entry); |
140 | 194 | } |
141 | 195 |
|
@@ -201,4 +255,7 @@ j9cached_LocalBitsForPC(J9ROMClass * romClass, J9ROMMethod * romMethod, UDATA pc |
201 | 255 | return rc; |
202 | 256 | } |
203 | 257 |
|
| 258 | +#endif |
| 259 | + |
| 260 | + |
204 | 261 | } /* extern "C" */ |
0 commit comments