summaryrefslogtreecommitdiff
path: root/src/pal
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2015-10-14 03:01:25 +0200
committerJan Vorlicek <janvorli@microsoft.com>2015-12-24 10:09:30 +0100
commit54990d90fcffbae79d72cfb2e37bb4cac4e0660c (patch)
tree299c88fa672bbdb2b4ce609df52945cf7d29326d /src/pal
parent38e554e5dcb8f6de9c014c5e1839b564a64937f6 (diff)
downloadcoreclr-54990d90fcffbae79d72cfb2e37bb4cac4e0660c.tar.gz
coreclr-54990d90fcffbae79d72cfb2e37bb4cac4e0660c.tar.bz2
coreclr-54990d90fcffbae79d72cfb2e37bb4cac4e0660c.zip
GC OS interface refactoring
This change replaces all calls of OS specific functions in the GC by a call to a platform agnostic interface. Critical sections were abstracted too. The logging file access was changed to use CRT functions instead of Windows specific APIs. A "size" member was added to the card_table_info so that we can pass the right size to the VirtualRelease method when destroying the card table. I have also fixed a bug in the gc_heap::make_card_table error path where when VirtualCommit failed, it called VirtualRelease with size that was not the reserved size, but the committed size. Other related changes - All interlocked operations moved to Interlocked class as static methods - Removed unused function prototypes - Shuffled stuff in the root CMakeLists.txt to enable building the GC sample using the settings inherited from the root CMakeLists.txt and to clean up some things that have rotted over time, like the FEATURE_xxx macros not being in one alphabetically ordered block - Fixed the VOLATILE_MEMORY_BARRIER macro in the gcenv.base.h - Replaced uint32_t thread id by EEThreadId - Removed thread handles storage (g_gc_thread) from the GC. The thread handle is closed right after the thread is launched. That allowed me to get rid of the GCThreadHandle - Renamed the methods of the EEThreadId to be easier to understand - Moved the gcenv.windows.cpp and gcenv.unix.cpp to the sample folder
Diffstat (limited to 'src/pal')
-rw-r--r--src/pal/inc/pal.h1
-rw-r--r--src/pal/src/exception/seh.cpp8
-rw-r--r--src/pal/src/misc/time.cpp10
-rw-r--r--src/pal/src/thread/context.cpp1
-rw-r--r--src/pal/tests/palsuite/eventprovider/CMakeLists.txt3
5 files changed, 11 insertions, 12 deletions
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index cec19c290e..c139efcba8 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -3547,6 +3547,7 @@ SetErrorMode(
#define MEM_RESERVE 0x2000
#define MEM_DECOMMIT 0x4000
#define MEM_RELEASE 0x8000
+#define MEM_RESET 0x80000
#define MEM_FREE 0x10000
#define MEM_PRIVATE 0x20000
#define MEM_MAPPED 0x40000
diff --git a/src/pal/src/exception/seh.cpp b/src/pal/src/exception/seh.cpp
index 87bc677296..7acb3dce1e 100644
--- a/src/pal/src/exception/seh.cpp
+++ b/src/pal/src/exception/seh.cpp
@@ -77,20 +77,16 @@ Return value :
BOOL
SEHInitialize (CPalThread *pthrCurrent, DWORD flags)
{
- BOOL bRet = FALSE;
-
#if !HAVE_MACH_EXCEPTIONS
if (!SEHInitializeSignals())
{
ERROR("SEHInitializeSignals failed!\n");
SEHCleanup();
- goto SEHInitializeExit;
+ return FALSE;
}
#endif
- bRet = TRUE;
-SEHInitializeExit:
- return bRet;
+ return TRUE;
}
/*++
diff --git a/src/pal/src/misc/time.cpp b/src/pal/src/misc/time.cpp
index 939c86996a..17fe037372 100644
--- a/src/pal/src/misc/time.cpp
+++ b/src/pal/src/misc/time.cpp
@@ -202,6 +202,7 @@ QueryPerformanceCounter(
PERF_ENTRY(QueryPerformanceCounter);
ENTRY("QueryPerformanceCounter()\n");
+ do
#if HAVE_CLOCK_MONOTONIC
{
struct timespec ts;
@@ -209,7 +210,7 @@ QueryPerformanceCounter(
{
ASSERT("clock_gettime(CLOCK_MONOTONIC) failed; errno is %d (%s)\n", errno, strerror(errno));
retval = FALSE;
- goto EXIT;
+ break;
}
lpPerformanceCount->QuadPart =
(LONGLONG)ts.tv_sec * (LONGLONG)tccSecondsToNanoSeconds + (LONGLONG)ts.tv_nsec;
@@ -230,7 +231,7 @@ QueryPerformanceCounter(
{
ASSERT("time_base_to_time() failed; errno is %d (%s)\n", errno, strerror(errno));
retval = FALSE;
- goto EXIT;
+ break;
}
lpPerformanceCount->QuadPart =
(LONGLONG)tb.tb_high * (LONGLONG)tccSecondsToNanoSeconds + (LONGLONG)tb.tb_low;
@@ -242,13 +243,14 @@ QueryPerformanceCounter(
{
ASSERT("gettimeofday() failed; errno is %d (%s)\n", errno, strerror(errno));
retval = FALSE;
- goto EXIT;
+ break;
}
lpPerformanceCount->QuadPart =
(LONGLONG)tv.tv_sec * (LONGLONG)tccSecondsToMicroSeconds + (LONGLONG)tv.tv_usec;
}
#endif // HAVE_CLOCK_MONOTONIC
-EXIT:
+ while (false);
+
LOGEXIT("QueryPerformanceCounter\n");
PERF_EXIT(QueryPerformanceCounter);
return retval;
diff --git a/src/pal/src/thread/context.cpp b/src/pal/src/thread/context.cpp
index ebd4383a71..dfb1c4baf1 100644
--- a/src/pal/src/thread/context.cpp
+++ b/src/pal/src/thread/context.cpp
@@ -220,7 +220,6 @@ BOOL CONTEXT_GetRegisters(DWORD processId, LPCONTEXT lpContext)
bRet = TRUE;
#if HAVE_BSD_REGS_T
-EXIT :
if (regFd != -1)
{
close(regFd);
diff --git a/src/pal/tests/palsuite/eventprovider/CMakeLists.txt b/src/pal/tests/palsuite/eventprovider/CMakeLists.txt
index 32b59592ee..41289f92f2 100644
--- a/src/pal/tests/palsuite/eventprovider/CMakeLists.txt
+++ b/src/pal/tests/palsuite/eventprovider/CMakeLists.txt
@@ -10,7 +10,6 @@ set(SOURCES
include_directories(${COREPAL_SOURCE_DIR}/prebuilt/inc)
include_directories(${COREPAL_SOURCE_DIR}/inc/rt)
-
add_executable(eventprovidertest
${SOURCES}
)
@@ -18,6 +17,8 @@ set(EVENT_PROVIDER_DEPENDENCIES "")
set(EVENT_PROVIDER_LINKER_OTPTIONS "")
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
+ add_definitions(-DFEATURE_EVENT_TRACE=1)
+
list(APPEND EVENT_PROVIDER_DEPENDENCIES
eventprovider
)