diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2016-05-02 06:37:14 +1000 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2016-05-05 08:29:27 +1000 |
commit | db9de7eb3e91820024f673bfdb6fb8064cfed20d (patch) | |
tree | 5e1c3ef0b6dee7f40fedbc118ba36cfe6ffdd1ee /rts/eventlog | |
parent | ad4392c142696d5092533480a82ed65322e9d413 (diff) | |
download | haskell-db9de7eb3e91820024f673bfdb6fb8064cfed20d.tar.gz |
rts: Replace `nat` with `uint32_t`
The `nat` type was an alias for `unsigned int` with a comment saying
it was at least 32 bits. We keep the typedef in case client code is
using it but mark it as deprecated.
Test Plan: Validated on Linux, OS X and Windows
Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20
Differential Revision: https://phabricator.haskell.org/D2166
Diffstat (limited to 'rts/eventlog')
-rw-r--r-- | rts/eventlog/EventLog.c | 30 | ||||
-rw-r--r-- | rts/eventlog/EventLog.h | 8 |
2 files changed, 19 insertions, 19 deletions
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c index db103a7f3c..9e2ed33d22 100644 --- a/rts/eventlog/EventLog.c +++ b/rts/eventlog/EventLog.c @@ -112,7 +112,7 @@ char *EventDesc[] = { typedef struct _EventType { EventTypeNum etNum; // Event Type number. - nat size; // size of the payload in bytes + uint32_t size; // size of the payload in bytes char *desc; // Description } EventType; @@ -130,7 +130,7 @@ static void postBlockMarker(EventsBuf *eb); static void closeBlockMarker(EventsBuf *ebuf); static StgBool hasRoomForEvent(EventsBuf *eb, EventTypeNum eNum); -static StgBool hasRoomForVariableEvent(EventsBuf *eb, nat payload_bytes); +static StgBool hasRoomForVariableEvent(EventsBuf *eb, uint32_t payload_bytes); static void ensureRoomForEvent(EventsBuf *eb, EventTypeNum tag); static int ensureRoomForVariableEvent(EventsBuf *eb, StgWord16 size); @@ -158,7 +158,7 @@ static inline void postWord64(EventsBuf *eb, StgWord64 i) postWord32(eb, (StgWord32)i); } -static inline void postBuf(EventsBuf *eb, StgWord8 *buf, nat size) +static inline void postBuf(EventsBuf *eb, StgWord8 *buf, uint32_t size) { memcpy(eb->pos, buf, size); eb->pos += size; @@ -214,7 +214,7 @@ void initEventLogging(void) { StgWord8 t, c; - nat n_caps; + uint32_t n_caps; char *prog; prog = stgMallocBytes(strlen(prog_name) + 1, "initEventLogging"); @@ -465,7 +465,7 @@ initEventLogging(void) void endEventLogging(void) { - nat c; + uint32_t c; // Flush all events remaining in the buffers. for (c = 0; c < n_capabilities; ++c) { @@ -486,9 +486,9 @@ endEventLogging(void) } void -moreCapEventBufs (nat from, nat to) +moreCapEventBufs (uint32_t from, uint32_t to) { - nat c; + uint32_t c; if (from > 0) { capEventBuf = stgReallocBytes(capEventBuf, to * sizeof(EventsBuf), @@ -867,7 +867,7 @@ void postHeapEvent (Capability *cap, } void postEventHeapInfo (EventCapsetID heap_capset, - nat gens, + uint32_t gens, W_ maxHeapSize, W_ allocAreaSize, W_ mblockSize, @@ -892,11 +892,11 @@ void postEventHeapInfo (EventCapsetID heap_capset, void postEventGcStats (Capability *cap, EventCapsetID heap_capset, - nat gen, + uint32_t gen, W_ copied, W_ slop, W_ fragmentation, - nat par_n_threads, + uint32_t par_n_threads, W_ par_max_copied, W_ par_tot_copied) { @@ -993,7 +993,7 @@ postEventAtTimestamp (Capability *cap, EventTimestamp ts, EventTypeNum tag) void postLogMsg(EventsBuf *eb, EventTypeNum type, char *msg, va_list ap) { char buf[BUF]; - nat size; + uint32_t size; size = vsnprintf(buf,BUF,msg,ap); if (size > BUF) { @@ -1141,7 +1141,7 @@ void resetEventsBuf(EventsBuf* eb) StgBool hasRoomForEvent(EventsBuf *eb, EventTypeNum eNum) { - nat size; + uint32_t size; size = sizeof(EventTypeNum) + sizeof(EventTimestamp) + eventTypes[eNum].size; @@ -1152,9 +1152,9 @@ StgBool hasRoomForEvent(EventsBuf *eb, EventTypeNum eNum) } } -StgBool hasRoomForVariableEvent(EventsBuf *eb, nat payload_bytes) +StgBool hasRoomForVariableEvent(EventsBuf *eb, uint32_t payload_bytes) { - nat size; + uint32_t size; size = sizeof(EventTypeNum) + sizeof(EventTimestamp) + sizeof(EventPayloadSize) + payload_bytes; @@ -1189,7 +1189,7 @@ int ensureRoomForVariableEvent(EventsBuf *eb, StgWord16 size) void postEventType(EventsBuf *eb, EventType *et) { StgWord8 d; - nat desclen; + uint32_t desclen; postInt32(eb, EVENT_ET_BEGIN); postEventTypeNum(eb, et->etNum); diff --git a/rts/eventlog/EventLog.h b/rts/eventlog/EventLog.h index abe7880fe4..ed783bc361 100644 --- a/rts/eventlog/EventLog.h +++ b/rts/eventlog/EventLog.h @@ -26,7 +26,7 @@ void endEventLogging(void); void freeEventLogging(void); void abortEventLogging(void); // #4512 - after fork child needs to abort void flushEventLog(void); // event log inherited from parent -void moreCapEventBufs (nat from, nat to); +void moreCapEventBufs (uint32_t from, uint32_t to); /* * Post a scheduler event to the capability's event buffer (an event @@ -107,7 +107,7 @@ void postHeapEvent (Capability *cap, W_ info1); void postEventHeapInfo (EventCapsetID heap_capset, - nat gens, + uint32_t gens, W_ maxHeapSize, W_ allocAreaSize, W_ mblockSize, @@ -115,11 +115,11 @@ void postEventHeapInfo (EventCapsetID heap_capset, void postEventGcStats (Capability *cap, EventCapsetID heap_capset, - nat gen, + uint32_t gen, W_ copied, W_ slop, W_ fragmentation, - nat par_n_threads, + uint32_t par_n_threads, W_ par_max_copied, W_ par_tot_copied); |