summaryrefslogtreecommitdiff
path: root/rts/eventlog
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-08-19 10:42:34 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-10-11 23:45:10 -0400
commit9b572d541d1d356d7836408ffa98a7b300d02174 (patch)
tree7ba6b55f8f6818e3698c69a67d5309b06dcff47b /rts/eventlog
parent6b0d2022699d3d8b446d024ee837c0d07e2c1aa0 (diff)
downloadhaskell-9b572d541d1d356d7836408ffa98a7b300d02174.tar.gz
Separate IPE source file from span
The source file name can very often be shared across many IPE entries whereas the source coordinates are generally unique. Separate the two to exploit sharing of the former.
Diffstat (limited to 'rts/eventlog')
-rw-r--r--rts/eventlog/EventLog.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index 4ed48c4412..9b10666768 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -166,7 +166,7 @@ static inline void postWord64(EventsBuf *eb, StgWord64 i)
postWord32(eb, (StgWord32)i);
}
-static inline void postBuf(EventsBuf *eb, StgWord8 *buf, uint32_t size)
+static inline void postBuf(EventsBuf *eb, const StgWord8 *buf, uint32_t size)
{
memcpy(eb->pos, buf, size);
eb->pos += size;
@@ -1419,10 +1419,13 @@ void postIPE(const InfoProvEnt *ipe)
StgWord ty_desc_len = strlen(ipe->prov.ty_desc);
StgWord label_len = strlen(ipe->prov.label);
StgWord module_len = strlen(ipe->prov.module);
- StgWord srcloc_len = strlen(ipe->prov.srcloc);
+ StgWord src_file_len = strlen(ipe->prov.src_file);
+ StgWord src_span_len = strlen(ipe->prov.src_span);
+
// 8 for the info word
- // 6 for the number of strings in the payload as postString adds 1 to the length
- StgWord len = 8+table_name_len+closure_desc_len+ty_desc_len+label_len+module_len+srcloc_len+6;
+ // 1 null after each string
+ // 1 colon between src_file and src_span
+ StgWord len = 8+table_name_len+1+closure_desc_len+1+ty_desc_len+1+label_len+1+module_len+1+src_file_len+1+src_span_len+1;
ensureRoomForVariableEvent(&eventBuf, len);
postEventHeader(&eventBuf, EVENT_IPE);
postPayloadSize(&eventBuf, len);
@@ -1432,7 +1435,13 @@ void postIPE(const InfoProvEnt *ipe)
postString(&eventBuf, ipe->prov.ty_desc);
postString(&eventBuf, ipe->prov.label);
postString(&eventBuf, ipe->prov.module);
- postString(&eventBuf, ipe->prov.srcloc);
+
+ // Manually construct the location field: "<file>:<span>\0"
+ postBuf(&eventBuf, (const StgWord8*) ipe->prov.src_file, src_file_len);
+ StgWord8 colon = ':';
+ postBuf(&eventBuf, &colon, 1);
+ postString(&eventBuf, ipe->prov.src_span);
+
RELEASE_LOCK(&eventBufMutex);
}