1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Harden client code against unaligned memory access.

There shouldn't be any changes in generated code on modern
architectures, as the memcpy will be reduced to a store/load operation
identical to the one generated with plain struct member access.

GetTime( cpu ) needs special handling, as the MSVC intrinsic for rdtscp
can't store cpu identifier in a register. Using intermediate variable
would cause store to stack, read from stack, store to the destination
address. Since rdtscp is only available on x86, which handles unaligned
stores without any problems, we can have one place with direct struct
member access.
This commit is contained in:
Bartosz Taudul
2018-03-31 14:03:55 +02:00
parent 685432a85f
commit 3b03e849f0
7 changed files with 247 additions and 186 deletions
+2 -2
View File
@@ -31,8 +31,8 @@ enum { WelcomeMessageProgramNameSize = 64 };
struct WelcomeMessage
{
double timerMul;
uint64_t initBegin;
uint64_t initEnd;
int64_t initBegin;
int64_t initEnd;
uint64_t delay;
uint64_t resolution;
uint64_t epoch;