| 76 | } |
| 77 | |
| 78 | void CodeCache::add(const void* start, int length, const char* name, bool update_bounds) { |
| 79 | char* name_copy = NativeFunc::create(name, _lib_index); |
| 80 | // Replace non-printable characters |
| 81 | for (char* s = name_copy; *s != 0; s++) { |
| 82 | if (*s < ' ') *s = '?'; |
| 83 | } |
| 84 | |
| 85 | if (_count >= _capacity) { |
| 86 | expand(); |
| 87 | } |
| 88 | |
| 89 | const void* end = (const char*)start + length; |
| 90 | _blobs[_count]._start = start; |
| 91 | _blobs[_count]._end = end; |
| 92 | _blobs[_count]._name = name_copy; |
| 93 | _count++; |
| 94 | |
| 95 | if (update_bounds) { |
| 96 | updateBounds(start, end); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | void CodeCache::updateBounds(const void* start, const void* end) { |
| 101 | if (start < _min_address) _min_address = start; |
no outgoing calls