From bb5034594dba704b2a8d2aebfad2d9b5101c450d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 22 Jun 2018 14:09:56 +0100 Subject: [PATCH] Event alignment doesn't need to be mps_pf_align (that's wasteful on windows). Copied from Perforce Change: 194091 --- mps/code/event.c | 4 ++-- mps/code/event.h | 6 +++--- mps/code/eventcom.h | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mps/code/event.c b/mps/code/event.c index 5b4a11eac93..4a7575f3390 100644 --- a/mps/code/event.c +++ b/mps/code/event.c @@ -53,7 +53,7 @@ static Res eventClockSync(void) Res res; size_t size; - size= size_tAlignUp(sizeof(eventClockSyncStruct), MPS_PF_ALIGN); + size= size_tAlignUp(sizeof(eventClockSyncStruct), EVENT_ALIGN); eventClockSyncStruct.code = EventEventClockSyncCode; eventClockSyncStruct.size = (EventSize)size; EVENT_CLOCK(eventClockSyncStruct.clock); @@ -182,7 +182,7 @@ void EventInit(void) EVENT_PARAM_CHECK_##sort(name, index, ident) #define EVENT_CHECK(X, name, code, always, kind) \ - AVER(size_tAlignUp(sizeof(Event##name##Struct), MPS_PF_ALIGN) \ + AVER(size_tAlignUp(sizeof(Event##name##Struct), EVENT_ALIGN) \ <= EventSizeMAX); \ AVER(Event##name##Code == code); \ AVER(0 <= code); \ diff --git a/mps/code/event.h b/mps/code/event.h index 987068feb13..57865bd00f9 100644 --- a/mps/code/event.h +++ b/mps/code/event.h @@ -48,13 +48,13 @@ extern char *EventLogged[EventKindLIMIT]; extern Word EventKindControl; -/* Write event into buffer and maybe flush the buffer. */ +/* EVENT_BEGIN -- flush buffer if necessary and write event header */ #define EVENT_BEGIN(name, structSize) \ BEGIN { \ if(EVENT_ALL || Event##name##Always) { /* see config.h */ \ Event##name##Struct *_event; \ - size_t _size = size_tAlignUp(structSize, MPS_PF_ALIGN); \ + size_t _size = size_tAlignUp(structSize, EVENT_ALIGN); \ if (_size > (size_t)(EventBuffer[Event##name##Kind] \ + EventBufferSIZE \ - EventLogged[Event##name##Kind])) \ @@ -62,7 +62,7 @@ extern Word EventKindControl; AVER(_size <= (size_t)(EventBuffer[Event##name##Kind] \ + EventBufferSIZE \ - EventLogged[Event##name##Kind])); \ - _event = (void *)(EventLogged[Event##name##Kind]); \ + _event = (void *)EventLogged[Event##name##Kind]; \ _event->code = Event##name##Code; \ _event->size = (EventSize)_size; \ EVENT_CLOCK(_event->clock); diff --git a/mps/code/eventcom.h b/mps/code/eventcom.h index 29054edc777..528b8769980 100644 --- a/mps/code/eventcom.h +++ b/mps/code/eventcom.h @@ -115,6 +115,9 @@ typedef unsigned char EventFB; /* Boolean */ EVENT_LIST(EVENT_STRUCT, X) +/* Maximum alignment requirement of any event type. */ +#define EVENT_ALIGN (sizeof(EventFP)) + /* Event -- event union type *