mirror of
https://github.com/DynamoRIO/dynamorio.git
synced 2026-10-12 02:02:04 +00:00
Inverts the drmemtrace trace buffer redzone check. Instead of re-setting the buffer to 0 every time and the redzone to -1 and identifying when to output by reading a non-0 value, we set the redzone to hold a sentinel record value: the value 1, which would be a load/store of the address 1, which seems pretty unlikely (we do see 0 in prefetches). If it does happen, we'll just output early; the output code is updated here to clobber the 1 so the same record won't trigger again. For online, with 12-byte records, we set the 1st pointer-sized bytes to the sentinel 1 and the final 4 to 0. This is a write to 0, which should also be rare. For 32-bit, we have to keep the memset, as loads and stores assume the top word is already zeroed, but 32-bit is not a performance priority. Changing the clean call skip is pretty simple on arm; on x86 it adds a redirection jump. The filter mode change checks that leverage the redzone check are more complicated and we change those to branches that skip over the other skips. On SPECCPU2017 INT this provides a 2% performance improvement, but it enables larger buffer sizes without paying a memset cost. A future update will make the main thread's buffer 8x larger, which is a 14% no-i/o improvement and half that with LZ4 output. Issue: #8125