Skip to content

Commit 7b26bfb

Browse files
authored
Remove some unnecessary indirection to DiagnosticServerAdapter/EventPipeAdapter in nativeaot (#90132)
1 parent 32a8c2d commit 7b26bfb

20 files changed

+89
-193
lines changed

src/coreclr/nativeaot/Runtime/CommonMacros.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464

6565
#ifndef __GCENV_BASE_INCLUDED__
6666

67+
#include <cstdint>
68+
6769
//
6870
// This macro returns val rounded up as necessary to be a multiple of alignment; alignment must be a power of 2
6971
//
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
void EventPipeAdapter_Initialize() {}
4+
void EventPipe_Initialize() {}
55

6-
bool DiagnosticServerAdapter_Initialize() { return false; }
7-
void DiagnosticServerAdapter_PauseForDiagnosticsMonitor() {}
6+
bool DiagnosticServer_Initialize() { return false; }
7+
void DiagnosticServer_PauseForDiagnosticsMonitor() {}
88

9-
void EventPipeAdapter_FinishInitialize() {}
9+
void EventPipe_FinishInitialize() {}
1010

1111
void EventPipe_ThreadShutdown() { }
1212

13-
void EventPipeAdapter_Shutdown() {}
14-
bool DiagnosticServerAdapter_Shutdown() { return false; }
13+
void EventPipe_Shutdown() {}
14+
bool DiagnosticServer_Shutdown() { return false; }
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
#include "eventpipeadapter.h"
5-
#include "diagnosticserveradapter.h"
4+
#include <eventpipe/ep.h>
5+
#include <eventpipe/ep-rt-aot.h>
6+
#include <eventpipe/ds-server.h>
67

7-
void EventPipeAdapter_Initialize() { EventPipeAdapter::Initialize(); }
8+
void EventPipe_Initialize() { ep_init(); }
89

9-
bool DiagnosticServerAdapter_Initialize() { return DiagnosticServerAdapter::Initialize(); }
10-
void DiagnosticServerAdapter_PauseForDiagnosticsMonitor() { DiagnosticServerAdapter::PauseForDiagnosticsMonitor();}
10+
bool DiagnosticServer_Initialize() { return ds_server_init(); }
11+
void DiagnosticServer_PauseForDiagnosticsMonitor() { ds_server_pause_for_diagnostics_monitor(); }
1112

12-
void EventPipeAdapter_FinishInitialize() { EventPipeAdapter::FinishInitialize(); }
13+
void EventPipe_FinishInitialize() { ep_finish_init(); }
1314

1415
void EventPipe_ThreadShutdown() { ep_rt_aot_thread_exited(); }
1516

16-
void EventPipeAdapter_Shutdown() { EventPipeAdapter::Shutdown(); }
17-
bool DiagnosticServerAdapter_Shutdown() { return DiagnosticServerAdapter::Shutdown(); }
17+
void EventPipe_Shutdown() { ep_shutdown(); }
18+
bool DiagnosticServer_Shutdown() { return ds_server_shutdown(); }

src/coreclr/nativeaot/Runtime/EventPipeInterface.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
#define EVENTPIPE_INTERFACE_H
66

77
// Initialize EventPipe
8-
void EventPipeAdapter_Initialize();
8+
void EventPipe_Initialize();
99

1010
// Initialize DS
11-
bool DiagnosticServerAdapter_Initialize();
12-
void DiagnosticServerAdapter_PauseForDiagnosticsMonitor();
11+
bool DiagnosticServer_Initialize();
12+
void DiagnosticServer_PauseForDiagnosticsMonitor();
1313

14-
15-
void EventPipeAdapter_FinishInitialize();
14+
void EventPipe_FinishInitialize();
1615

1716
void EventPipe_ThreadShutdown();
1817

19-
void EventPipeAdapter_Shutdown();
20-
bool DiagnosticServerAdapter_Shutdown();
18+
void EventPipe_Shutdown();
19+
bool DiagnosticServer_Shutdown();
2120

2221
void EventTracing_Initialize();
2322
#endif //EVENTPIPE_INTERFACE_H

src/coreclr/nativeaot/Runtime/PalRedhawk.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
#include <sal.h>
1919
#include <stdarg.h>
20+
#ifdef TARGET_UNIX
21+
#include <pthread.h>
22+
#endif
23+
2024
#include "CommonTypes.h"
2125
#include "CommonMacros.h"
2226
#include "gcenv.structs.h" // CRITICAL_SECTION

src/coreclr/nativeaot/Runtime/StackFrameIterator.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
#ifndef __StackFrameIterator_h__
55
#define __StackFrameIterator_h__
66

7+
#include "CommonMacros.h"
78
#include "ICodeManager.h"
9+
#include "PalRedhawk.h" // NATIVE_CONTEXT
10+
#include "regdisplay.h"
11+
12+
#include "forward_declarations.h"
813

914
struct ExInfo;
1015
typedef DPTR(ExInfo) PTR_ExInfo;
@@ -22,6 +27,7 @@ struct EHEnum
2227
EHEnumState m_state;
2328
};
2429

30+
class StackFrameIterator;
2531
EXTERN_C FC_BOOL_RET FASTCALL RhpSfiInit(StackFrameIterator* pThis, PAL_LIMITED_CONTEXT* pStackwalkCtx, CLR_BOOL instructionFault);
2632
EXTERN_C FC_BOOL_RET FASTCALL RhpSfiNext(StackFrameIterator* pThis, uint32_t* puExCollideClauseIdx, CLR_BOOL* pfUnwoundReversePInvoke);
2733

src/coreclr/nativeaot/Runtime/diagnosticserveradapter.h

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/coreclr/nativeaot/Runtime/disabledeventpipeinternal.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
#include "common.h"
5-
#include "eventpipeadapter.h"
4+
#include "CommonTypes.h"
5+
#include "CommonMacros.h"
6+
#include "PalRedhawk.h"
67

7-
#ifdef FEATURE_PERFTRACING
8+
#include <eventpipe/ep.h>
89

9-
#include "gcenv.h"
10-
#include "regdisplay.h"
11-
#include "StackFrameIterator.h"
12-
#include "thread.h"
13-
#include "SpinLock.h"
10+
#ifdef FEATURE_PERFTRACING
1411

1512
struct EventPipeEventInstanceData;
1613

1714
struct EventPipeSessionInfo;
1815

1916
EXTERN_C NATIVEAOT_API uint64_t __cdecl RhEventPipeInternal_Enable(
20-
LPCWSTR outputFile,
17+
const WCHAR* outputFile,
2118
EventPipeSerializationFormat format,
2219
uint32_t circularBufferSizeInMB,
2320
/* COR_PRF_EVENTPIPE_PROVIDER_CONFIG */ const void * pProviders,
@@ -31,7 +28,7 @@ EXTERN_C NATIVEAOT_API void __cdecl RhEventPipeInternal_Disable(uint64_t session
3128
}
3229

3330
EXTERN_C NATIVEAOT_API intptr_t __cdecl RhEventPipeInternal_CreateProvider(
34-
LPCWSTR providerName,
31+
const WCHAR* providerName,
3532
EventPipeCallback pCallbackFunc,
3633
void* pCallbackContext)
3734
{
@@ -50,7 +47,7 @@ EXTERN_C NATIVEAOT_API intptr_t __cdecl RhEventPipeInternal_DefineEvent(
5047
return 0;
5148
}
5249

53-
EXTERN_C NATIVEAOT_API intptr_t __cdecl RhEventPipeInternal_GetProvider(LPCWSTR providerName)
50+
EXTERN_C NATIVEAOT_API intptr_t __cdecl RhEventPipeInternal_GetProvider(const WCHAR* providerName)
5451
{
5552
return 0;
5653
}

src/coreclr/nativeaot/Runtime/disabledruntimeeventinternal.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
#include "eventpipeadapter.h"
4+
#include "CommonTypes.h"
5+
#include "CommonMacros.h"
6+
#include "PalRedhawk.h"
57

68
#ifdef FEATURE_PERFTRACING
79

@@ -78,7 +80,7 @@ EXTERN_C NATIVEAOT_API void __cdecl NativeRuntimeEventSource_LogThreadPoolIOPack
7880
{
7981
}
8082

81-
EXTERN_C NATIVEAOT_API void __cdecl NativeRuntimeEventSource_LogExceptionThrown(LPCWSTR exceptionTypeName, LPCWSTR exceptionMessage, void* faultingIP, HRESULT hresult)
83+
EXTERN_C NATIVEAOT_API void __cdecl NativeRuntimeEventSource_LogExceptionThrown(const WCHAR* exceptionTypeName, const WCHAR* exceptionMessage, void* faultingIP, HRESULT hresult)
8284
{
8385
}
8486

src/coreclr/nativeaot/Runtime/eventpipe/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ list(APPEND GEN_EVENTPIPE_SOURCES
107107
list(APPEND AOT_EVENTPIPE_MANAGED_TO_NATIVE_SOURCES
108108
${RUNTIME_DIR}/eventpipeinternal.cpp
109109
${RUNTIME_DIR}/eventpipeadapter.h
110-
${RUNTIME_DIR}/diagnosticserveradapter.h
111110
${RUNTIME_DIR}/EnabledEventPipeInterface.cpp
112111
${RUNTIME_DIR}/runtimeeventinternal.cpp
113112
)

0 commit comments

Comments
 (0)