summaryrefslogtreecommitdiff
path: root/src/pal
AgeCommit message (Collapse)AuthorFilesLines
2016-01-04Fix "call to 'sqrt' is ambiguous" error when building on SunOSJonathan Taylor1-3/+3
Building on SunOS will fail with the message of "call to 'sqrt' is ambiguous" because it can't determine the type of the constant value passed to it. This change adds a cast to a double because every usage uses this data type
2016-01-03Merge pull request #2498 from taylorjonl/smartosJan Kotas1-1/+23
Fixed issue where files in /opt/local/include are not found and LTTng is required on SmartOS
2016-01-01Fixed issue where files in /opt/local/include on SunOSJonathan Taylor1-1/+23
Modified to not require LTTng on SunOS
2015-12-28Automating Event Logging Infrastructure: With this change the infrastructure ↵Rama25-42831/+17
required for Event Logging will be generated as part of build
2015-12-24GC OS interface refactoringJan Vorlicek5-12/+11
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
2015-12-21Merge pull request #2425 from erozenfeld/CheckedBuildJan Kotas3-6/+10
Enable checked builds of CoreCLR.
2015-12-21Enable checked builds of CoreCLR.Eugene Rozenfeld3-6/+10
In checked builds coreclr, mscorlib, and the test are built optimized but assertion checking is on. This adds additional coverage (the jit is optimizing and assertion checking is on), speeds up testing compared to debug, and allows testing JIT stress modes. This doesn't affect CoreFX. Several tests are currently failing in checked configuration due to newly discovered bugs (JIT asserts). We didn't see these asserts in debug mode because by default JIT is in minopt mode; we didn't see these bugs in release mode because assertion checking is off. I will file the bugs once checked build changes are in.
2015-12-19Initial support for building on SmartOStaylorjonl1-2/+4
2015-12-15Merge pull request #2341 from mikem8361/pipefile2Mike McLaughlin2-7/+47
Debugger transport pipe file cleanup - Part 2
2015-12-15Debugger transport pipe file cleanup - Part 2Mike McLaughlin2-7/+47
Clean up the pipe files in /tmp for unhandled managed exception termination. Added a simple PAL shutdown API to set (one) shutdown callback handler which is used by the debugger code to cleanup the transport thus removing the pipe files from /tmp. This callback is executed PAL_Shutdown, ExitProcess and TerminateProcess, the later used to terminate the process for an unhandled managed exception. Add the __attribute__((destructor)) to the ShutdownTransport function to cover the case if the if a third party host, the managed runtime or third party pinvoked code calls exit().
2015-12-15Build arm64 using private toolsetRahul Kumar1-1/+8
Successfully builds all binaries except sos.dll & x64 binaries
2015-12-14PAL Module/shutdown cleanup.Mike McLaughlin8-783/+559
Added a PAL_Shutdown function that cleans/shutdowns the PAL without exiting/terminating the process doing exactly what ExitProcess/TerminateProcess before exiting the process. Removed the PAL_InitializeCoreCLR export. The new coreclr_* hosting apis should be used. Moved the "is module manager initialized" check (exe_module.prev != NULL) inside the module lock to prevent races during shutdown in LOADCallDllMain. Removed LOADFreeModules so we never try to call the DLL_PROCESS_DETACH handlers. Most of this cleanup happened because I was trying to getting the DLL_PROCESS_DETACH notifications working, but there were too many opportunities for deadlock. Emulating Windows behavior isn't that important and in this case will cause more problems that it fixes. Removed PAL_RegisterLibrary*/PAL_UnregisterLibrary. They were only used in one place to load modules that don't exist anymore (rotor_palrt and sscoree). Renamed LOAD_SEH_CallDllMain to LoadCallDllMainSafe (we don't usually use _ in names) and use this function in all the places we call the DllMain handler. This combines some code in a common place and protects all DllMain calls from exceptions. Source code formatting cleanup and moved internal functions around to be next to the rest of the internal functions. Initialize pDllMain to NULL in LOADAllocModule. Get the DllMain function address into LOADAddModule so that it is initialized in the PAL_RegisterModule path. Changed PAL_UnregisterModule not to call the DllMain function.
2015-12-12Delete bad PAL test caseJan Kotas1-5/+0
2015-12-11Merge pull request #2303 from kyulee1/ilasmJan Vorlicek2-1/+4
Enable ILASM for *nix
2015-12-11Enable ILASM for *nixKyungwoo Lee2-1/+4
This enables ILASM for x-platforms. 1. Added a bunch of warning disable options mostly due to this prebuilt asmparse.cpp 2. Create a separte entry point "main" to pass WCHAR arguments. 3. PDB (CorSymWriter) part is disabled. 4. Converting/embedding resource file to binary is disabled. 5. jkotas kindly provided a code for IsTextUnicode which is unavailable on CoreCLR.
2015-12-10Merge pull request #2293 from stephentoub/tickcount_perfStephen Toub3-3/+23
Use CLOCK_MONOTONIC_COARSE in GetTickCount64
2015-12-10Use CLOCK_MONOTONIC_COARSE in GetTickCount64Stephen Toub3-3/+23
Today, GetTickCount64 is implemented to use clock_gettime with CLOCK_MONOTONIC if it's available. This provides for high-resolution, however it trades off that accuracy for some efficiency. This commit changes it to prefer CLOCK_MONOTONIC_COARSE if it's available (QueryPerformanceCounter still uses CLOCK_MONOTONIC). GetTickCount is typically used for coarse timings, e.g. used in a loop to determine whether more than 10 seconds have passed, and can have lower resolution in exchange for higher efficiency. For Windows, the MSDN docs explicitly state that it's likely to have no better than 10-15 millisecond resolution. Using CLOCK_MONOTONIC_COARSE instead of CLOCK_MONOTIC maps better to this notion, and improves Environment.TickCount throughput on my machine by ~20x. At the same time, on my machine it still provides well better than 10-15ms resolution, closer to ~4ms.
2015-12-10Merge pull request #2292 from janvorli/fix-exception-handling-by-cppJan Vorlicek1-3/+1
Fix C++ exception handling when coreclr is loaded before C++ runtime
2015-12-10Fix C++ exception handling when coreclr is loaded before C++ runtimeJan Vorlicek1-3/+1
This change fixes a problem that happens when libcoreclr.so is loaded before C++ runtime libraries. In that case, linker resolves the C++ exception handling functions against the libunwind8 and exception handling doesn't work. The fix is the same as someone has already made in the past for ARM - to add gcc_s to the library list of coreclrpal before the libunwind8. Then the linker does the right thing.
2015-12-09Disable h/w exceptions for coreclr (non-DAC) builds.Mike McLaughlin3-3/+9
Fixes the recursive GC crash. Added FEATURE_ENABLE_HARDWARE_EXCEPTIONS to the PAL sxs exception tests so the h/w exceptions generated by the test dlls are caught. Also added to SOS/strike project. Also fixed sos "clrstack -i". The sos data target needed to implement ICorDebugDataTarget4::VirtualUnwind too.
2015-12-08Use dbi's path to load dac and add RPATH to make files.Mike McLaughlin2-90/+106
Fixes VS's problems with debugging and running different versions of coreclr. Set RPATH for OSX is @loader_path and removed now unnecessary load of mscordaccore in the lldb sos plugin. Simplify the GetDacModule code to use PAL_GetPALDirectoryW instead of depending on GetModuleInst() and the module handle passed to DllMain. Changed PAL_RegisterModule not to also call the DllMain of the module so it wouldn't be called twice.
2015-12-05Remove usage of getcontextBen Pye3-50/+10
2015-12-04Implemented GetCurrentProcessorNumber and HasGetCurrentProcessorNumberWilliam Godbe4-2/+39
2015-12-02Merge pull request #2205 from sergiy-k/executablememorySergiy Kuryata4-31/+337
Implement an allocator for executable (JIT) memory in PAL
2015-12-02Some SOS fixes/cleanup (bpmd, setclrpath, setsostid).Mike McLaughlin2-40/+10
Enable the module load notification when no module or methods are found. setclrpath/setsostid print the current path/tid if no arguments. "setsostid -clear" now clears the tid/os id mapping. Added better exception hook to sos plugin to catch special CLRN exception. Before multiple lldb "Exception breakpoints" where set each time bpmd added a new bp. Added a "DoNotDeleteOrDisable" message to the exception breakpoint created. Fix bpmd on release builds. RtlpRaiseException was being inlined and the ExceptionRecord parameter was being optimized away causing the GetLastEventInformation api to failed and the special CLRN exception to be ignored. Add sos help support. "soshelp" displays help about a command.
2015-12-02Address code review feedbackSergiy Kuryata2-101/+124
2015-12-02Implement an allocator for executable (JIT) memory in PALSergiy Kuryata4-31/+314
This change improves performance of CoreCLR with Server GC enabled by about 30% according to ASP.NET benchmarks on Linux. The table below shows number of requests per second that an ASP.NET benchmark could handle on my machine before and after the change. Pipeline Before After Improvement 16 230K Req/sec 305K Req/sec 33% 256 240K Req/sec 340K Req/sec 42% The problem was that with Server GC enabled, the GC initialization code was reserving a large chunck (about 18GB on my machine) of virtual address space during runtime initialization. Unfortunately, due to implementation details of MM on Linux, GC memory was located next to the location of libcoreclr. As a result, the runtime could not allocate memory for JIT'ed code close to the coreclr library. Because of that the JIT'ed code had to use jump stubs to call functions from the runtime (which can become very expensive, for example, for write barriers). This change fixes this issue by implementing a simple allocator that tries to reserve (during process startup) a chuck of virtual memory that is located near the coreclr library (within 2GB range) that can be later used for JIT'ed code.
2015-11-30Merge pull request #1671 from wtgodbe/QueryThreadCycleTimeWilliam Godbe13-77/+481
Implemented QueryThreadCycleTime (time.cpp) & GetThreadTimes (thread.…
2015-11-24Small architecture specific changes to fix the build on linux arm64.jashook1-29/+34
2015-11-20Implemented QueryThreadCycleTime (time.cpp) & GetThreadTimes (thread.cpp) ↵William Godbe13-77/+481
for Unix and OS X, plus tests. Also added helper methods IsCurrentThread and GetThreadTimesInternal to time.cpp. Currently, GetThreadTimes returns all time as user time on Unix, since I don't yet know of a way to get user time and kernel time separately there.
2015-11-18Add new pal test that tests exceptions across multiple PALs in different ↵Mike McLaughlin10-0/+295
modules. Currently disabled for FreeBSD.
2015-11-17Merge pull request #2049 from stephentoub/uuid_generate_randomJan Kotas1-3/+3
Use uuid_generate_random instead of uuid_generate in CoCreateGuid
2015-11-17Enable CLANG sanitizers for native debug buildsSteve Harter1-0/+2
2015-11-14Use uuid_generate_random instead of uuid_generate in CoCreateGuidstephentoub1-3/+3
The PAL implementation of CoCreateGuid is currently using uuid_generate. This will be based on high-quality randomness if available, otherwise it falls back to an algorithm that incorporates the local ethernet MAC address along with the current time and a pseudo-random generator. To avoid potential privacy issues, this commit switches to using uuid_generate_random, which instead falls back purely to a pseudo-random generator.
2015-11-13Remove an unsafe memory write in HeapFreeJohn Chen1-2/+0
The PAL implementation of HeapFree assumes that the memory region always have at least 4 bytes. Depending on the heap implementation, this is not necessarily true, and can potentially cause memory corruption.
2015-11-12Fix Thread.Start while debugging bug on OSX.Mike McLaughlin10-53/+160
The OSX exception logic is running on a separate thread from the one that the exception happened. The CatchHardwareExceptionHolder::IsEnabled used to check for h/w exception holders assumed it was running on the thread the exception/holders happened not the exception notification thread. Moved the h/w exception holder count to the CPalThread object instead of a TLS thread variable so the OSX exception code can check it given a CPalThread instance. The main problem was that the stubmgr when creating a thread (for the start notification) put a breakpoint in ThePreStubPatch which is in the coreclr text section and because the h/w exception holder check was broken, it thought the breakpoint wasn't the debugger's and aborted the coreclr process. The other part of this fix is to put a h/w exception holder around the called to ThePreStubPatch in prestub.cpp. The stubmgr's delegate invoke subclass used the wrong registers for Linux/OSX to read the "this" and parameter registers. Added the proper ifdefs and registers (ecx -> rdi, rdx -> rsi) for the Unix platforms. On both Linux and OSX, the h/w exception holder check in the exception routing logic needed to check if the int3/trap is in DBG_DebugBreak so asserts always abort/core dump. Move DBG_DebugBreak to an assembly worker so the start/end address can be used for this check.
2015-11-10Merge pull request #1999 from adityamandaleeka/remove_suspensionJan Kotas13-112/+53
More PAL thread cleanup (last one)
2015-11-09Remove InternalRand.Aditya Mandaleeka1-22/+1
2015-11-09Remove thread parameter from several more PAL functions.Aditya Mandaleeka12-90/+52
2015-11-09Add support for ninja to the CoreCLR build.Pat Gavlin1-2/+8
Just what it says on the tin.
2015-11-06Merge pull request #1959 from adityamandaleeka/remove_suspensionAditya Mandaleeka9-146/+47
Remove thread parameter from a few more places in PAL
2015-11-04Remove SetConsoleCtrlHandler from Unix PALstephentoub33-2251/+1
Deleted SIGINT and SIGQUIT-related signal handling code, which means we no longer need to spin up a worker thread for all coreclr apps. Make the debugger's SetConsoleCtrlHandler usage Windows-only (from offline conversation it sounded like we might choose to delete it entirely subsequently, but for now I've left it). Removed all of the code related to SetConsoleCtrlHandler from the PAL. Deleted all tests related to SetConsoleCtrlHandler from the palsuite.
2015-11-04Remove thread parameter from shmfilelockmgr functionsAditya Mandaleeka4-37/+19
2015-11-04Remove thread parameter from some string functions in PAL.Aditya Mandaleeka3-67/+3
2015-11-04Remove thread parameter from virtual memory functions in PALAditya Mandaleeka1-13/+11
2015-11-04Remove thread parameter from some PAL initialization functions.Aditya Mandaleeka1-7/+7
2015-11-04Remove NativeVsnprintf and NativeVfprintf.Aditya Mandaleeka1-22/+7
2015-11-03Merge pull request #1946 from mikem8361/unwindiMike McLaughlin2-18/+34
Fix sos clrstack unwinding for the special HelperMethodFrame.
2015-11-03Fix sos clrstack unwinding for the special HelperMethodFrame.Mike McLaughlin2-18/+34
Add and implement new ICorDebugDataTarget4 unwind interface using lldb stack unwinder ABIs. The implementation does a linear search of the native frames for the stack pointer provided. It doesn't happen often so the performance is fine. Stub out the DBI's ICorDebugDataTarget4 (in ShimDataTarget::VirtualUnwind) for now. Since PAL_VirtualUnwindOutOfProc is disabled it makes sense to just return E_NOTIMPL. Fix bpmd command so it doesn't stop in lldb when it isn't a CLRN exception (continues).
2015-11-03Merge pull request #1940 from adityamandaleeka/remove_suspensionAditya Mandaleeka9-326/+77
Clean up PAL File functions