| 188 | } |
| 189 | |
| 190 | void CodeCache::addImport(void** entry, const char* name) { |
| 191 | switch (name[0]) { |
| 192 | case 'a': |
| 193 | if (strcmp(name, "aligned_alloc") == 0) { |
| 194 | saveImport(im_aligned_alloc, entry); |
| 195 | } |
| 196 | break; |
| 197 | case 'c': |
| 198 | if (strcmp(name, "calloc") == 0) { |
| 199 | saveImport(im_calloc, entry); |
| 200 | } |
| 201 | break; |
| 202 | case 'd': |
| 203 | if (strcmp(name, "dlopen") == 0) { |
| 204 | saveImport(im_dlopen, entry); |
| 205 | } |
| 206 | break; |
| 207 | case 'f': |
| 208 | if (strcmp(name, "free") == 0) { |
| 209 | saveImport(im_free, entry); |
| 210 | } |
| 211 | break; |
| 212 | case 'm': |
| 213 | if (strcmp(name, "malloc") == 0) { |
| 214 | saveImport(im_malloc, entry); |
| 215 | } |
| 216 | break; |
| 217 | case 'p': |
| 218 | if (strcmp(name, "pthread_create") == 0) { |
| 219 | saveImport(im_pthread_create, entry); |
| 220 | } else if (strcmp(name, "pthread_exit") == 0) { |
| 221 | saveImport(im_pthread_exit, entry); |
| 222 | } else if (strcmp(name, "pthread_mutex_lock") == 0) { |
| 223 | saveImport(im_pthread_mutex_lock, entry); |
| 224 | } else if (strcmp(name, "pthread_rwlock_rdlock") == 0) { |
| 225 | saveImport(im_pthread_rwlock_rdlock, entry); |
| 226 | } else if (strcmp(name, "pthread_rwlock_wrlock") == 0) { |
| 227 | saveImport(im_pthread_rwlock_wrlock, entry); |
| 228 | } else if (strcmp(name, "pthread_setspecific") == 0) { |
| 229 | saveImport(im_pthread_setspecific, entry); |
| 230 | } else if (strcmp(name, "poll") == 0) { |
| 231 | saveImport(im_poll, entry); |
| 232 | } else if (strcmp(name, "posix_memalign") == 0) { |
| 233 | saveImport(im_posix_memalign, entry); |
| 234 | } |
| 235 | break; |
| 236 | case 'r': |
| 237 | if (strcmp(name, "realloc") == 0) { |
| 238 | saveImport(im_realloc, entry); |
| 239 | } |
| 240 | break; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | void** CodeCache::findImport(ImportId id) { |
| 245 | if (!_imports_patchable) { |
no outgoing calls
no test coverage detected