summaryrefslogtreecommitdiff
path: root/src/vm/eventpipebuffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm/eventpipebuffer.h')
-rw-r--r--src/vm/eventpipebuffer.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vm/eventpipebuffer.h b/src/vm/eventpipebuffer.h
index 7d6287d93d..7b20883f73 100644
--- a/src/vm/eventpipebuffer.h
+++ b/src/vm/eventpipebuffer.h
@@ -20,6 +20,10 @@ class EventPipeBuffer
private:
+ // Instances of EventPipeEventInstance in the buffer must be 8-byte aligned.
+ // It is OK for the data payloads to be unaligned because they are opaque blobs that are copied via memcpy.
+ const size_t AlignmentSize = 8;
+
// A pointer to the actual buffer.
BYTE *m_pBuffer;
@@ -72,6 +76,17 @@ private:
m_pNextBuffer = pBuffer;
}
+ FORCEINLINE BYTE* GetNextAlignedAddress(BYTE *pAddress)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(m_pBuffer <= pAddress && m_pLimit > pAddress);
+
+ pAddress = (BYTE*)ALIGN_UP(pAddress, AlignmentSize);
+
+ _ASSERTE((size_t)pAddress % AlignmentSize == 0);
+ return pAddress;
+ }
+
public:
EventPipeBuffer(unsigned int bufferSize);