Skip to content

Commit 94846db

Browse files
authored
Merge branch 'HaxeFoundation:master' into patch-3
2 parents 5afbb73 + 87e2baf commit 94846db

81 files changed

Lines changed: 2991 additions & 723 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/hx/TelemetryTracy.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#define TRACY_ENABLE
99
#include <hxcpp.h>
10-
#include "../../project/thirdparty/tracy-0.11.1/tracy/TracyC.h"
11-
#include "../../project/thirdparty/tracy-0.11.1/tracy/Tracy.hpp"
10+
#include "../../project/thirdparty/tracy-0.12.0/tracy/TracyC.h"
11+
#include "../../project/thirdparty/tracy-0.12.0/tracy/Tracy.hpp"
1212

1313
#ifdef HXCPP_TRACY_MEMORY
1414
#ifdef HXCPP_GC_MOVING
@@ -30,7 +30,7 @@
3030
::hx::strbuf TracyConcat(_hx_tracy_str_buffer, TracyLine); \
3131
int TracyConcat(_hx_tracy_str_length, TracyLine); \
3232
const char *TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine) = name.utf8_str(&TracyConcat(_hx_tracy_str_buffer, TracyLine), false, &TracyConcat(_hx_tracy_str_length, TracyLine)); \
33-
::tracy::ScopedZone TracyConcat(_hx_tracy_scoped_zone,TracyLine)(_hx_stackframe.lineNumber, _hx_stackframe.position->fileName, strlen(_hx_stackframe.position->fileName), _hx_stackframe.position->fullName, strlen(_hx_stackframe.position->fullName), TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine), TracyConcat(_hx_tracy_str_length, TracyLine));
33+
::tracy::ScopedZone TracyConcat(_hx_tracy_scoped_zone,TracyLine)(_hx_stackframe.lineNumber, _hx_stackframe.position->fileName, strlen(_hx_stackframe.position->fileName), _hx_stackframe.position->fullName, strlen(_hx_stackframe.position->fullName), TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine), TracyConcat(_hx_tracy_str_length, TracyLine), -1);
3434
#endif
3535

3636
void __hxcpp_tracy_framemark();

include/hx/Thread.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ inline bool HxCreateDetachedThread(DWORD (WINAPI *func)(void *), void *param)
8686

8787
struct HxMutex
8888
{
89+
bool mValid;
90+
pthread_mutex_t *mMutex;
91+
8992
HxMutex()
9093
{
9194
pthread_mutexattr_t mta;
@@ -96,9 +99,7 @@ struct HxMutex
9699
}
97100
~HxMutex()
98101
{
99-
if (mValid)
100-
pthread_mutex_destroy(mMutex);
101-
delete mMutex;
102+
Clean();
102103
}
103104
void Lock() { pthread_mutex_lock(mMutex); }
104105
void Unlock() { pthread_mutex_unlock(mMutex); }
@@ -107,12 +108,16 @@ struct HxMutex
107108
void Clean()
108109
{
109110
if (mValid)
111+
{
110112
pthread_mutex_destroy(mMutex);
111-
mValid = 0;
113+
mValid = false;
114+
}
115+
if (mMutex)
116+
{
117+
delete mMutex;
118+
mMutex = nullptr;
119+
}
112120
}
113-
114-
bool mValid;
115-
pthread_mutex_t *mMutex;
116121
};
117122

118123
#define THREAD_FUNC_TYPE void *
@@ -198,19 +203,20 @@ struct HxSemaphore
198203

199204
struct HxSemaphore
200205
{
206+
HxMutex mMutex;
207+
pthread_cond_t *mCondition;
208+
bool mSet;
209+
210+
201211
HxSemaphore()
202212
{
203213
mSet = false;
204-
mValid = true;
205214
mCondition = new pthread_cond_t();
206215
pthread_cond_init(mCondition,0);
207216
}
208217
~HxSemaphore()
209218
{
210-
if (mValid)
211-
{
212-
pthread_cond_destroy(mCondition);
213-
}
219+
Clean();
214220
}
215221
// For autolock
216222
inline operator HxMutex &() { return mMutex; }
@@ -294,19 +300,14 @@ struct HxSemaphore
294300
void Clean()
295301
{
296302
mMutex.Clean();
297-
if (mValid)
303+
if (mCondition)
298304
{
299-
mValid = false;
300305
pthread_cond_destroy(mCondition);
306+
delete mCondition;
307+
mCondition = nullptr;
301308
}
302-
delete mCondition;
303309
}
304310

305-
306-
HxMutex mMutex;
307-
pthread_cond_t *mCondition;
308-
bool mSet;
309-
bool mValid;
310311
};
311312

312313

project/thirdparty/tracy-0.11.1/tracy/Tracy.hpp

Lines changed: 0 additions & 300 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

project/thirdparty/tracy-0.11.1/client/TracyArmCpuTable.hpp renamed to project/thirdparty/tracy-0.12.0/client/TracyArmCpuTable.hpp

File renamed without changes.

project/thirdparty/tracy-0.11.1/client/TracyCallstack.cpp renamed to project/thirdparty/tracy-0.12.0/client/TracyCallstack.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,12 @@ extern "C"
282282
t_SymFromInlineContext _SymFromInlineContext = 0;
283283
t_SymGetLineFromInlineContext _SymGetLineFromInlineContext = 0;
284284

285-
TRACY_API ___tracy_t_RtlWalkFrameChain ___tracy_RtlWalkFrameChain = 0;
285+
typedef unsigned long (__stdcall *___tracy_t_RtlWalkFrameChain)( void**, unsigned long, unsigned long );
286+
___tracy_t_RtlWalkFrameChain ___tracy_RtlWalkFrameChainPtr = nullptr;
287+
TRACY_API unsigned long ___tracy_RtlWalkFrameChain( void** callers, unsigned long count, unsigned long flags)
288+
{
289+
return ___tracy_RtlWalkFrameChainPtr(callers, count, flags);
290+
}
286291
}
287292

288293
struct ModuleCache
@@ -307,7 +312,7 @@ size_t s_krnlCacheCnt;
307312

308313
void InitCallstackCritical()
309314
{
310-
___tracy_RtlWalkFrameChain = (___tracy_t_RtlWalkFrameChain)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "RtlWalkFrameChain" );
315+
___tracy_RtlWalkFrameChainPtr = (___tracy_t_RtlWalkFrameChain)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "RtlWalkFrameChain" );
311316
}
312317

313318
void DbgHelpInit()

project/thirdparty/tracy-0.11.1/client/TracyCallstack.h renamed to project/thirdparty/tracy-0.12.0/client/TracyCallstack.h

File renamed without changes.

project/thirdparty/tracy-0.11.1/client/TracyCallstack.hpp renamed to project/thirdparty/tracy-0.12.0/client/TracyCallstack.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
namespace tracy
1111
{
12-
static tracy_force_inline void* Callstack( int /*depth*/ ) { return nullptr; }
12+
static constexpr bool has_callstack() { return false; }
13+
static tracy_force_inline void* Callstack( int32_t /*depth*/ ) { return nullptr; }
1314
}
1415

1516
#else
@@ -38,6 +39,8 @@ static tracy_force_inline void* Callstack( int /*depth*/ ) { return nullptr; }
3839
namespace tracy
3940
{
4041

42+
static constexpr bool has_callstack() { return true; }
43+
4144
struct CallstackSymbolData
4245
{
4346
const char* file;
@@ -79,11 +82,10 @@ debuginfod_client* GetDebuginfodClient();
7982

8083
extern "C"
8184
{
82-
typedef unsigned long (__stdcall *___tracy_t_RtlWalkFrameChain)( void**, unsigned long, unsigned long );
83-
TRACY_API extern ___tracy_t_RtlWalkFrameChain ___tracy_RtlWalkFrameChain;
85+
TRACY_API unsigned long ___tracy_RtlWalkFrameChain( void**, unsigned long, unsigned long );
8486
}
8587

86-
static tracy_force_inline void* Callstack( int depth )
88+
static tracy_force_inline void* Callstack( int32_t depth )
8789
{
8890
assert( depth >= 1 && depth < 63 );
8991
auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) );
@@ -112,7 +114,7 @@ static _Unwind_Reason_Code tracy_unwind_callback( struct _Unwind_Context* ctx, v
112114
return _URC_NO_REASON;
113115
}
114116

115-
static tracy_force_inline void* Callstack( int depth )
117+
static tracy_force_inline void* Callstack( int32_t depth )
116118
{
117119
assert( depth >= 1 && depth < 63 );
118120

@@ -127,7 +129,7 @@ static tracy_force_inline void* Callstack( int depth )
127129

128130
#elif TRACY_HAS_CALLSTACK == 3 || TRACY_HAS_CALLSTACK == 4 || TRACY_HAS_CALLSTACK == 6
129131

130-
static tracy_force_inline void* Callstack( int depth )
132+
static tracy_force_inline void* Callstack( int32_t depth )
131133
{
132134
assert( depth >= 1 );
133135

0 commit comments

Comments
 (0)