Skip to content

Commit fa1b389

Browse files
authored
Follow up on recent PAL cleanups (#116127)
* Avoid extra wrapper * Cleanup PalRedhawk.h * Rename MillieSeconds -> MilliSeconds * Delete g_registerModuleTraces
1 parent c048ff0 commit fa1b389

File tree

9 files changed

+18
-90
lines changed

9 files changed

+18
-90
lines changed

src/coreclr/nativeaot/Runtime/PalRedhawk.h

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,6 @@ typedef void * LPOVERLAPPED;
8383

8484
#define UNREFERENCED_PARAMETER(P) (void)(P)
8585

86-
typedef union _LARGE_INTEGER {
87-
struct {
88-
#if BIGENDIAN
89-
int32_t HighPart;
90-
uint32_t LowPart;
91-
#else
92-
uint32_t LowPart;
93-
int32_t HighPart;
94-
#endif
95-
} u;
96-
int64_t QuadPart;
97-
} LARGE_INTEGER, *PLARGE_INTEGER;
98-
99-
#define DECLARE_HANDLE(_name) typedef HANDLE _name
100-
10186
struct FILETIME
10287
{
10388
uint32_t dwLowDateTime;
@@ -106,30 +91,12 @@ struct FILETIME
10691

10792
typedef struct _CONTEXT CONTEXT, *PCONTEXT;
10893

109-
#define EXCEPTION_MAXIMUM_PARAMETERS 15 // maximum number of exception parameters
110-
111-
typedef struct _EXCEPTION_RECORD32 {
112-
uint32_t ExceptionCode;
113-
uint32_t ExceptionFlags;
114-
uintptr_t ExceptionRecord;
115-
uintptr_t ExceptionAddress;
116-
uint32_t NumberParameters;
117-
uintptr_t ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
118-
} EXCEPTION_RECORD, *PEXCEPTION_RECORD;
94+
typedef struct _EXCEPTION_RECORD EXCEPTION_RECORD, *PEXCEPTION_RECORD;
11995

12096
#define EXCEPTION_CONTINUE_EXECUTION (-1)
12197
#define EXCEPTION_CONTINUE_SEARCH (0)
12298
#define EXCEPTION_EXECUTE_HANDLER (1)
12399

124-
typedef enum _EXCEPTION_DISPOSITION {
125-
ExceptionContinueExecution,
126-
ExceptionContinueSearch,
127-
ExceptionNestedException,
128-
ExceptionCollidedUnwind
129-
} EXCEPTION_DISPOSITION;
130-
131-
#define STATUS_BREAKPOINT ((uint32_t )0x80000003L)
132-
#define STATUS_SINGLE_STEP ((uint32_t )0x80000004L)
133100
#define STATUS_ACCESS_VIOLATION ((uint32_t )0xC0000005L)
134101
#define STATUS_STACK_OVERFLOW ((uint32_t )0xC00000FDL)
135102

@@ -166,9 +133,6 @@ typedef char TCHAR;
166133

167134
#define INFINITE 0xFFFFFFFF
168135

169-
#define DUPLICATE_CLOSE_SOURCE 0x00000001
170-
#define DUPLICATE_SAME_ACCESS 0x00000002
171-
172136
#define PAGE_NOACCESS 0x01
173137
#define PAGE_READONLY 0x02
174138
#define PAGE_READWRITE 0x04

src/coreclr/nativeaot/Runtime/startup.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -224,19 +224,6 @@ bool InitGSCookie()
224224
#endif // TARGET_UNIX
225225

226226
#ifdef PROFILE_STARTUP
227-
#define STD_OUTPUT_HANDLE ((uint32_t)-11)
228-
229-
struct RegisterModuleTrace
230-
{
231-
LARGE_INTEGER Begin;
232-
LARGE_INTEGER End;
233-
};
234-
235-
const int NUM_REGISTER_MODULE_TRACES = 16;
236-
int g_registerModuleCount = 0;
237-
238-
RegisterModuleTrace g_registerModuleTraces[NUM_REGISTER_MODULE_TRACES] = { 0 };
239-
240227
static void AppendInt64(char * pBuffer, uint32_t* pLen, uint64_t value)
241228
{
242229
char localBuffer[20];
@@ -270,12 +257,6 @@ static void UninitDLL()
270257
AppendInt64(buffer, &len, g_startupTimelineEvents[GC_INIT_COMPLETE]);
271258
AppendInt64(buffer, &len, g_startupTimelineEvents[PROCESS_ATTACH_COMPLETE]);
272259

273-
for (int i = 0; i < g_registerModuleCount; i++)
274-
{
275-
AppendInt64(buffer, &len, g_registerModuleTraces[i].Begin.QuadPart);
276-
AppendInt64(buffer, &len, g_registerModuleTraces[i].End.QuadPart);
277-
}
278-
279260
buffer[len++] = '\n';
280261

281262
fwrite(buffer, len, 1, stdout);

src/coreclr/pal/src/include/pal/palinternal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@ extern "C"
251251

252252
typedef enum _TimeConversionConstants
253253
{
254-
tccSecondsToMillieSeconds = 1000, // 10^3
254+
tccSecondsToMilliSeconds = 1000, // 10^3
255255
tccSecondsToMicroSeconds = 1000000, // 10^6
256256
tccSecondsToNanoSeconds = 1000000000, // 10^9
257-
tccMillieSecondsToMicroSeconds = 1000, // 10^3
258-
tccMillieSecondsToNanoSeconds = 1000000, // 10^6
257+
tccMilliSecondsToMicroSeconds = 1000, // 10^3
258+
tccMilliSecondsToNanoSeconds = 1000000, // 10^6
259259
tccMicroSecondsToNanoSeconds = 1000, // 10^3
260260
tccSecondsTo100NanoSeconds = 10000000, // 10^7
261261
tccMicroSecondsTo100NanoSeconds = 10 // 10^1

src/coreclr/pal/src/misc/time.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ GetSystemTime(
100100
int old_seconds;
101101
int new_seconds;
102102

103-
lpSystemTime->wMilliseconds = (WORD)(timeval.tv_usec/tccMillieSecondsToMicroSeconds);
103+
lpSystemTime->wMilliseconds = (WORD)(timeval.tv_usec/tccMilliSecondsToMicroSeconds);
104104

105105
old_seconds = utPtr->tm_sec;
106106
new_seconds = timeval.tv_sec%60;

src/coreclr/pal/src/synchmgr/synchmanager.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,9 +1762,9 @@ namespace CorUnix
17621762
}
17631763
else
17641764
{
1765-
tv.tv_usec = (iTimeout % tccSecondsToMillieSeconds) *
1766-
tccMillieSecondsToMicroSeconds;
1767-
tv.tv_sec = iTimeout / tccSecondsToMillieSeconds;
1765+
tv.tv_usec = (iTimeout % tccSecondsToMilliSeconds) *
1766+
tccMilliSecondsToMicroSeconds;
1767+
tv.tv_sec = iTimeout / tccSecondsToMilliSeconds;
17681768
ptv = &tv;
17691769
}
17701770

@@ -1793,9 +1793,9 @@ namespace CorUnix
17931793
}
17941794
else
17951795
{
1796-
ts.tv_nsec = (iTimeout % tccSecondsToMillieSeconds) *
1797-
tccMillieSecondsToNanoSeconds;
1798-
ts.tv_sec = iTimeout / tccSecondsToMillieSeconds;
1796+
ts.tv_nsec = (iTimeout % tccSecondsToMilliSeconds) *
1797+
tccMilliSecondsToNanoSeconds;
1798+
ts.tv_sec = iTimeout / tccSecondsToMilliSeconds;
17991799
pts = &ts;
18001800
}
18011801

@@ -3578,8 +3578,8 @@ namespace CorUnix
35783578
#endif
35793579
if (0 == iRet)
35803580
{
3581-
ptsAbsTmo->tv_sec += dwTimeout / tccSecondsToMillieSeconds;
3582-
ptsAbsTmo->tv_nsec += (dwTimeout % tccSecondsToMillieSeconds) * tccMillieSecondsToNanoSeconds;
3581+
ptsAbsTmo->tv_sec += dwTimeout / tccSecondsToMilliSeconds;
3582+
ptsAbsTmo->tv_nsec += (dwTimeout % tccSecondsToMilliSeconds) * tccMilliSecondsToNanoSeconds;
35833583
while (ptsAbsTmo->tv_nsec >= tccSecondsToNanoSeconds)
35843584
{
35853585
ptsAbsTmo->tv_sec += 1;

src/libraries/System.Private.CoreLib/src/System/Diagnostics/Stopwatch.Unix.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ namespace System.Diagnostics
55
{
66
public partial class Stopwatch
77
{
8-
private static long QueryPerformanceFrequency()
8+
private static long GetFrequency()
99
{
1010
const long SecondsToNanoSeconds = 1000000000;
1111
return SecondsToNanoSeconds;
1212
}
1313

14-
private static long QueryPerformanceCounter()
15-
{
16-
return Interop.Sys.GetTimestamp();
17-
}
14+
public static long GetTimestamp() => Interop.Sys.GetTimestamp();
1815
}
1916
}

src/libraries/System.Private.CoreLib/src/System/Diagnostics/Stopwatch.Windows.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace System.Diagnostics
55
{
66
public partial class Stopwatch
77
{
8-
private static unsafe long QueryPerformanceFrequency()
8+
private static unsafe long GetFrequency()
99
{
1010
long resolution;
1111

@@ -16,7 +16,7 @@ private static unsafe long QueryPerformanceFrequency()
1616
return resolution;
1717
}
1818

19-
private static unsafe long QueryPerformanceCounter()
19+
public static unsafe long GetTimestamp()
2020
{
2121
long timestamp;
2222

src/libraries/System.Private.CoreLib/src/System/Diagnostics/Stopwatch.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public partial class Stopwatch
1010
private long _startTimeStamp;
1111
private bool _isRunning;
1212

13-
public static readonly long Frequency = QueryPerformanceFrequency();
13+
public static readonly long Frequency = GetFrequency();
1414
public static readonly bool IsHighResolution = true;
1515

1616
// performance-counter frequency, in counts per ticks.
@@ -93,8 +93,6 @@ public long ElapsedTicks
9393
}
9494
}
9595

96-
public static long GetTimestamp() => QueryPerformanceCounter();
97-
9896
/// <summary>Gets the elapsed time since the <paramref name="startingTimestamp"/> value retrieved using <see cref="GetTimestamp"/>.</summary>
9997
/// <param name="startingTimestamp">The timestamp marking the beginning of the time period.</param>
10098
/// <returns>A <see cref="TimeSpan"/> for the elapsed time between the starting timestamp and the time of this call.</returns>

src/mono/mono/utils/mono-time.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@
2121

2222
#define MTICKS_PER_SEC (10 * 1000 * 1000)
2323

24-
typedef enum _TimeConversionConstants
25-
{
26-
tccSecondsToMillieSeconds = 1000, // 10^3
27-
tccSecondsToMicroSeconds = 1000000, // 10^6
28-
tccSecondsToNanoSeconds = 1000000000, // 10^9
29-
tccMillieSecondsToMicroSeconds = 1000, // 10^3
30-
tccMillieSecondsToNanoSeconds = 1000000, // 10^6
31-
tccMicroSecondsToNanoSeconds = 1000, // 10^3
32-
tccSecondsTo100NanoSeconds = 10000000, // 10^7
33-
tccMicroSecondsTo100NanoSeconds = 10 // 10^1
34-
} TimeConversionConstants;
35-
3624
gint64
3725
mono_msec_ticks (void)
3826
{

0 commit comments

Comments
 (0)