summaryrefslogtreecommitdiff
path: root/src/pal/inc
AgeCommit message (Collapse)AuthorFilesLines
2021-06-29Add YieldProcessor implementation for armsubmit/tizen/20210629.000826accepted/tizen/unified/20210629.130321Gleb Balykov1-1/+1
2020-08-25Build tests in gbs for x86/x64 (#307)submit/tizen/20200901.065247accepted/tizen/unified/20200907.144049Gleb Balykov/Platform Lab /SRR/Engineer/Samsung Electronics2-2/+2
* Add -msse2 compile option Cherry-pick of https://github.com/dotnet/runtime/pull/33135 * Use prefixed hex format in asm Cherry-pick of https://github.com/dotnet/runtime/pull/33205 * [Tizen] Add CoreCLR tests build dependencies v3.1.3 for x86 * [Tizen] Add CoreCLR tests build dependencies v3.1.3 for x64 * [Tizen] Allow build of tests for x86/x64
2020-03-25Mark Relocation Section as NotNeeded (#25715)Dong-Heon Jung1-0/+16
- After relocation, relocation section in zap image is not necessary. - Mark the section as NotNeeded by giving advice(madvise with MADV_DONTNEED) - It reduces 120~150KB PSS in tizen sample apps.
2020-03-25[Tizen] Add coreclr_preload_assembly to CoreCLR host APIKonstantin Baladurin1-1/+33
2020-03-25[Tizen] Implement detecting of sanitized librariesAndrey Drobyshev1-0/+8
Parse ".dynamic" section (ELF dynamic array tags) of the module being added, find ".rel(a).plt" section and search it for presence of '__asan_init' symbol. Change-Id: Ie7cc4c818b791b5f00713b42ba15131325b8152c Signed-off-by: Andrey Drobyshev <a.drobyshev@samsung.com>
2019-11-11[release/3.1] Reword comments for policheck (#27670)Jeremy Koritzinsky1-1/+1
* Comment rewordings required by policheck. * Use AppContainer instead of Windows Store.
2019-06-10Add support for the NetTrace EventPipe file formatnoahfalk1-0/+11
Right now the new format is not on by default, but it can be enabled using COMPlus_EventPipeNetTraceFormat = 1 for testing purposes. The plan to have a follow up PR that will add shipping configuration mechanisms and change the default setting. See the documentation in the PerfView repo for more details about the format. At a glance the goal is to create a format that is more efficient to produce, has a smaller on disk size, and offers enhanced functionality in a few areas: a) 64 bit thread id support b) Detection of dropped events via sequence numbers c) Better support for extracting subsets of the file Together with the change there was also some refactoring of the EventPipeBufferManager and EventPipeThread. This change addresses (at least in part) the following issues: #19688, #23414, #24188, #20751, #20555, #21827, #24852, #25046
2019-05-30Frkaya/gcc fix 052919 (#24845)Sinan Kaya1-1/+1
* fix compilation with gcc7.x In file included from src/inc/sstring.h:1029:0, from src/inc/ex.h:19, from src/inc/stgpool.h:28, from src/inc/../md/inc/metamodel.h:18, from src/inc/../md/inc/metamodelro.h:19, from src/inc/metadata.h:17, from src/inc/corpriv.h:21, from src/md/compiler/stdafx.h:20, from src/md/compiler/mdutil.cpp:12: src/inc/sstring.inl: In member function ‘const WCHAR* SString::GetUnicode() const’: src/inc/sstring.inl:650:5: error: nonnull argument ‘this’ compared to NULL [-Werror=nonnull-compare] if (this == NULL) ^~ add version check * Use the abstracted version of __nodebug__ * cc1: warning: command line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C
2019-05-29Use /proc/<pid>/mem to read memory in remote DBI data target. It makes the ↵Mike McLaughlin1-1/+4
test case run at (#24844) least 4 to 5 times faster than before. Fallback to old transport ReadMemory if /proc/<pid>/mem can't be opened. This happens on attach because of permissions/access, but works fine on the launch (the most important case).
2019-05-21Avoid PAL LoadLibrary simulator for regular PInvoke (#24669)Jan Kotas1-7/+0
Fixes #21009
2019-05-20Cuckoo metadata (#24498)David Wrighton2-0/+126
* Basic infra for cuckoo filter of attributes - Implement cuckoo filter lookup logic - Implement new ready to run section - Add dumper to R2RDump - Parse section on load into data structure - Implement function to query filter - Add concept of enum of well known attributes - So that attribute name hashes themselves may be cached * Wrap all even vaguely perf critical uses of attribute by name parsing with use of R2R data * Update emmintrin.h in the PAL header to contain the needed SSE2 intrinsics for the feature - Disable the presence table for non Corelib cases. Current performance data does not warrant the size increase in other generated binaries
2019-05-17Merge pull request #24520 from am11/freebsd/set-affinityJan Vorlicek1-13/+12
Fix CPUSET_T definition for FreeBSD
2019-05-16Add support for invariant casing in PAL (#24597)Michal Strehovský1-0/+3
unicodedata.cpp based on UnicodeData.txt v11.0.
2019-05-15Delete unicode API emulator (#24581)Michal Strehovský1-27/+14
2019-05-11Adjust PAL_STDCPP_COMPAT to accommodate FreeBSDAdeel1-13/+12
2019-05-08Add generate crash dump command to diagnostics server (#24460)Mike McLaughlin1-0/+8
Add the DiagnosticProtocolHelper class to deserialize and dispatch the new GenerateCoreDump command. Refactor the PAL createdump launch on unhandled exception code to used by a new PAL_GenerateCoreDump method that doesn't depend on the complus dump environment variables. Changed the "full" createdump not to include the uncommitted pages and removed the "add module metadata" workaround for SOS clrstack !UNKNOWN problem now that is fixed in SOS (crashinfo.cpp).
2019-05-01Copy all win32 resources (#24308)David Wrighton1-1/+2
- Add crossgen test to verify file version is preserved - Add support for general win32 resource copying to ReadyToRun - Copy all resources
2019-04-09Fix several issuesJan Vorlicek1-0/+5
* Fix build on OSX and Linux machines without NUMA installed - there were couple of places where I was missing ifdefs * Fix bug in nodeMaskLength computation * Remove testing change in eeconfig.cpp that has leaked into the PR * Fix GCToOSInterface::GetTotalProcessorCount for embedded GC to return all processors on the system, not just the ones enabled for the current process.
2019-04-09Remove Unix CPU groups emulationJan Vorlicek1-137/+3
This change removes CPU groups emulation from Unix PAL and modifies the GC and thread pool code accordingly.
2019-04-08Add Large pages support in GCMukul Sabharwal1-0/+1
2019-04-02Move C/C++ and platform headers to pal/inc/rt/cpp folderIlia K3-0/+0
Affected files: assert.h, emmintrin.h, and xmmintrin.h Bug: 20784
2019-03-29Unify clang with GNUCSinan Kaya2-4/+12
Enable SSE for GCC
2019-03-18Conversion issuesSinan Kaya1-2/+2
2019-03-18[EventPipe] Adding an IPC server to handle out of process communication. ↵José Rivero1-0/+11
(#23106) This is the first commit to enable a "diagnostic port" using IPC (Named Pipe on Windows and Unix Domain Socket on other platforms). This change currently enable EventPipe to be enabled/disabled without the use of a file drop. - Split the DiagnosticsIpc into (DiagnosticsIpc/IpcStream) - DiagnosticsIpc (IPC listener) is meant to be used by the Diagnostic server. - IpcStream (IPC channel) is meant to be use to communicate with the connected client. - Change the FastSerializer dependency from `CFileStream` to `StreamWriter` This abstraction is meant decouple the writing of objects in order to extend its usability. The main objective is to reuse FastSerializer to stream data through the open IPC channel. - Moved the EventPipeSessionProvider* classes to their own file. - Added a more streamlined parsing achievable by defining a simpler binary protocol (by noahfalk). 1. Only one allocation is needed for the EventPipeProviderConfiguration array, no allocations or copies are needed for strings because we can refer to them directly out of the incoming command buffer 2. No change to the EventPipe API for enable is required. EventPipeProviderConfiguration retains its current behavior of not deleting the string pointers it holds. 3. No leaks happen because the command buffer owns the string memory and ensures that it stays alive for the duration of the Enable() call.
2019-03-11Fix no-return false positives in static analyzer buildJan Vorlicek1-0/+6
There were about 800 false positive issues in the clang status analyzer build caused by the fact that various forms of asserts were not considered by the analyzer as not returning. This change adds __attribute__((analyzer_noreturn)) (wrapped in a macro) to those assertion functions.
2019-02-26GCC compatibility fixes #7 (#22810)Sinan Kaya1-1/+1
* Use thread_local for thread local storage on non MSVC targets * Use local copy of visitor rather than function parameter * Remove extra class qualifier * Replace hex number representation in ASM files * Reorder STDAPI and DLLEXPORT * Suppress conversion Suppress warning during hash add casting * Remove anonymous struct src/vm/codeversion.h:112:16: warning: ‘struct NativeCodeVersion::<anonymous union>::SyntheticStorage’ invalid; an anonymous union can only have non-static data members [-fpermissive] struct SyntheticStorage * Remove class declaration Remove extra class declaration * Remove extern C * Add implicit paranthesis src/vm/amd64/virtualcallstubcpu.hpp:735:103: warning: suggest parentheses around ‘-’ in operand of ‘&’ [-Wparentheses] resolveInit.toMiss1 = offsetof(ResolveStub,miss)-(offsetof(ResolveStub,toMiss1)+1) & 0xFF; ^ src/vm/amd64/virtualcallstubcpu.hpp:741:103: warning: suggest parentheses around ‘-’ in operand of ‘&’ [-Wparentheses] resolveInit.toMiss2 = offsetof(ResolveStub,miss)-(offsetof(ResolveStub,toMiss2)+1) & 0xFF; Add parenthesis src/vm/dataimage.cpp:631:55: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] previousRvaInfo->rva == rvaInfo->rva && previousRvaInfo->size >= rvaInfo->size Add parenthesis src/debug/daccess/daccess.cpp:6871:29: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] _ASSERTE(peFile == NULL && reflectionModule != NULL || peFile != NULL && reflectionModule == NULL); Add parenthesis src/vm/dataimage.cpp:631:57: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] (previousRvaInfo->rva == rvaInfo->rva) && (previousRvaInfo->size >= rvaInfo->size) * Initialize member 1 src/ilasm/method.cpp:35:36: warning: operation on ‘((Method*)this)->Method::m_ulColumns[0]’ may be undefined [-Wsequence-point] m_ulColumns[0]=m_ulColumns[0]=0; * Remove unknown compiler option * Abstract DLLEXPORT
2019-02-20Abstract deprecated and selectany for GCC and remove LLVM'ism where possible ↵Sinan Kaya1-4/+4
(#22662) * Abstract selectany * Fix initializer element is not constant src/corefx/System.Globalization.Native/pal_icushim.c:58:34: error: initializer element is not constant static const int MaxICUVersion = MinICUVersion + 20; * Enable ms extensions * Apply LLVM patterns to GCC * Remove deprecated function * Fix const conversion error src/corefx/System.Globalization.Native/pal_calendarData.c:390:16: warning: passing argument 1 of ‘ures_close_ptr’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] ures_close(erasResBundle); src/corefx/System.Globalization.Native/pal_calendarData.c:419:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] char* name = GetCalendarName(calendarId); * Remove old compiler option
2019-02-17Fix Integer Rounding issue and duplicate definition of __deref in sal.h (#22645)Sinan Kaya2-2/+2
* Fix large integer truncation pal/pal.h:4988:43: warning: large integer implicitly truncated to unsigned type [-Woverflow] static const SIZE_T NoTargetFrameSp = SIZE_MAX; ^~~~~~~~ * Fix compilation error with GCC /usr/include/c++/7.3.0/debug/functions.h:452:15: error: expected unqualified-id before ')' token __deref(); ^ /usr/include/c++/7.3.0/debug/functions.h:455:34: error: expected primary-expression before '<' token typename = decltype(__deref<_It>() < __deref<_It>())> ^ /usr/include/c++/7.3.0/debug/functions.h:455:38: error: expected primary-expression before '>' token typename = decltype(__deref<_It>() < __deref<_It>())> ^ /usr/include/c++/7.3.0/debug/functions.h:455:40: error: expected primary-expression before ')' token typename = decltype(__deref<_It>() < __deref<_It>())> ^
2019-02-17Delete RtlMoveMemory and tests (#22668)Adeel Mujahid1-9/+0
2019-02-16Fix visibility and signed comparison issues for GCC (#22586)Adeel Mujahid1-85/+88
* Fix visibility and signed comparison issues for GCC * Fix hidden _CLRDataCreateInstance warned by macOS * Fix indentation in vswprintf/test1 * Change void* to PVOID in implementation files
2019-02-14Gnuport cleanup 3 (#22581)Sinan Kaya2-10/+11
* Reorder extern "C" and visibility statements In file included from coreclr/src/pal/inc/pal.h:70:0, coreclr/src/pal/inc/pal_mstypes.h:30:25: error: expected unqualified-id before string constant #define EXTERN_C extern "C" ^ coreclr/src/pal/inc/rt/palrt.h:216:30: note: in expansion of macro 'EXTERN_C' #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE * Need double quotes around single quotes in error statements fix error statements Can't have ' character in error statement * Abstract __declspec(noinline) Generate compiler independent macros for noinline request. * Remove unused DBG_NOINLINE_X86__RET_INLINE * Abstract __declspec(nothrow)
2019-02-10Cleanup DLL exports (#22500)Jan Kotas2-13/+15
2019-02-09Set visibility option to hidden (#21924)Adeel Mujahid4-52/+53
2019-02-07More PAL layer cleanup for GNU and add build script support for GCC (#22369)Sinan Kaya3-6/+14
* Declare throw only when compiling for c++ Prevent the definition from getting defined multiple times and map it to throw() only when compiling c++ code. * Suppress warnings for tests Suppress: -Wno-write-strings -Wno-sign-compare -Wno-narrowing -fpermissive -Wno-int-to-pointer-cast to allow tests to compile * Add gcc option to build.sh script Following clangx.y model add -gccx.y command line arguments with gcc5 and gcc7 being the currnetly supported options. * Allow environment variable to be used for TOOLCHAIN Remove CLANG specific compiler options as well. * Hide non-GNU compiler options * Do not include local directory if cross compiling [ 0%] Building CXX object src/pal/src/eventprovider/tracepointprovider/CMakeFiles/coreclrtraceptprovider.dir/__/lttng/traceptprovdotnetruntime.cpp.o cc1plus: error: include location "/usr/local/include" is unsafe for cross-compilation [-Werror=poison-system-directories] * Suppress unknown pragma warnings src/pal/src/exception/seh-unwind.cpp:37:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] #pragma clang diagnostic pop Removing these cause compilation error on clang7 and arm as follows: In file included from /bin/obj/Linux.arm.Debug/src/pal/src/libunwind/include/libunwind.h:9: /src/pal/src/libunwind/include/libunwind-arm.h:247:9: error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat] typedef struct unw_tdep_save_loc ^ /src/pal/src/libunwind/include/libunwind-arm.h:288:9: error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat] typedef struct * plt not useful for GNU and ARM64/ARM src/pal/src/arch/arm64/callsignalhandlerwrapper.S: Assembler messages: src/pal/src/arch/arm64/callsignalhandlerwrapper.S:31: Error: unexpected characters following instruction at operand 1 -- `bl signal_handler_worker@plt' src/pal/src/arch/arm64/callsignalhandlerwrapper.S:32: Error: unexpected characters following instruction at operand 1 -- `bl signal_handler_worker@plt' * Remove double const from argv in PAL_Initialize Seeing compilation error with GNU for C source files as follows: if (PAL_Initialize(argc, argv) != 0) ^ src/pal/tests/palsuite/common/palsuite.h:21:0, from src/pal/tests/palsuite/c_runtime/asinhf/test1/test1.c:18: src/pal/inc/pal.h:374:1: note: expected ‘const char * const*’ but argument is of type ‘char **’ * Suppress format warnings using GNU for libunwind warning: format ‘%li’ expects argument of type ‘long int’, but argument 3 has type ‘int’ [-Wformat=] Debug (4, " aligned frame, offset %li\n", f->cfa_reg_offset); * Fix -fpermissive warnings for GNU * Suppress unused variable warning in libunwind src/pal/src/libunwind/include/libunwind-aarch64.h:201:5: warning: right-hand operand of comma expression has no effect [-Wunused-value] #define unw_tdep_getcontext(uc) (({ \ ~~~~~~~~~ unw_tdep_context_t *unw_ctx = (uc); \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ register uint64_t *unw_base asm ("x0") = (uint64_t*) unw_ctx->uc_mcontext.regs; \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __asm__ __volatile__ ( \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x0, x1, [%[base], #0]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x2, x3, [%[base], #16]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x4, x5, [%[base], #32]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x6, x7, [%[base], #48]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x8, x9, [%[base], #64]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x10, x11, [%[base], #80]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x12, x13, [%[base], #96]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x14, x13, [%[base], #112]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x16, x17, [%[base], #128]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x18, x19, [%[base], #144]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x20, x21, [%[base], #160]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x22, x23, [%[base], #176]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x24, x25, [%[base], #192]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x26, x27, [%[base], #208]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x28, x29, [%[base], #224]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "str x30, [%[base], #240]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "mov x1, sp\n" \ ~~~~~~~~~~~~~~~~ "stp x1, x30, [%[base], #248]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ : [base] "+r" (unw_base) : : "x1", "memory"); \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }), 0) * Fix warning: ‘memset’ used with length equal to number of elements warning Fix similar warnings to these by including the element size into total size calculation. src/pal/tests/palsuite/miscellaneous/SetEnvironmentVariableW/test1/test.cpp: In function ‘int main(int, char**)’: src/pal/tests/palsuite/miscellaneous/SetEnvironmentVariableW/test1/test.cpp:89:31: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] memset(NewValue,0,BUF_SIZE); * Define CLR specific compiler option CLR_CMAKE_COMPILER By the time toolchain.cmake is called, the compiler detection from cmake is not active. We need an intermediate definition to pass to compiler detection.
2019-02-01Preserve Vector Arg registers on Arm64 (#22257)Carol Eidt1-17/+17
* Preserve Vector Arg registers on Arm64 Fix #14371
2019-02-01Coreclr gnuport (#22129)Sinan Kaya3-16/+47
* Abstract away NOINLINE statement MSVC and GNU compilers use different attributes for noinline. Abstract away compiler differences. * Replace __sync_swap with __atomic_exchange_n __sync_swap doesn't exist on GNU. Replacing with __atomic_exchange_n which is universally available. * Define CDECL for GNUC __cdecl is not defined by default on GNU compilers. * Define gcc version of __declspec(thread) * Correct pointer casting A pointer value is usually unsigned long on most platforms. Casting it to integer causes signedness issues. Use size_t to be efficient on all 32 and 64 bit architectures. * Put quotes around the error string Correct error statement. GNU G++ is picky about the string following the error statement with ' character in it. It needs to be enclosed with double quotes. * Fix casting problem Seeing these warnings with GNU G++ compiler src/pal/src/sync/cs.cpp: In function ‘void CorUnix::InternalInitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION, DWORD, bool)’: src/pal/src/sync/cs.cpp:630:48: warning: converting to non-pointer type ‘SIZE_T {aka long unsigned int}’ from NULL [-Wconversion-null] pPalCriticalSection->OwningThread = NULL; ^ src/pal/src/sync/cs.cpp: In function ‘void CorUnix::InternalLeaveCriticalSection(CorUnix::CPalThread*, _CRITICAL_SECTION*)’: src/pal/src/sync/cs.cpp:880:43: warning: converting to non-pointer type ‘SIZE_T {aka long unsigned int}’ from NULL [-Wconversion-null] pPalCriticalSection->OwningThread = NULL; ^ * Abstract optnone compiler attribute GNU compiler doesn't support optnone attribute. pal/src/exception/seh-unwind.cpp:449:77: warning: ‘optnone’ attribute directive ignored [-Wattributes] * Set the aligned attribute for GNU compiler * Make __rotl and __rotr functions portable GNU compiler doesn't have an intrinsic for these. Open code them using the provided implementation. * Define deprecated attribute for gcc * Add throw specifier for GCC /usr/include/string.h:43:28: error: declaration of ‘void* memcpy(void*, const void*, size_t) throw ()’ has a different exception specifier size_t __n) __THROW __nonnull ((1, 2));
2019-01-15On SIGTERM default to a non-zero exit code (#21300)Tom Deseyn1-1/+1
* On SIGTERM default to a non-zero exit code * Fix Windows builds * Improve SIG_DFL/SIG_IGN handling * Remove PAL_GetTerminationExitCode * Use sa_handler/sa_sigaction based on SA_SIGINFO; remove HAVE_SIGINFO_T. * configure.cmake: remove siginfo_t check * Move restore_signal_and_resend so OSX can use it; add function documentation * Fix OSX build: include pal/process.h for gPID * Check SIG_IGN and SIG_DFL against sa_handler * Don't use sa_handler when SA_SIGINFO is set * Fix equality check * Swap order of checking SA_SIGINFO and SIG_IGN/SIG_DFL
2019-01-08Fix issue #20585 createdump explicitly uses /tmp. (#21866)Mike McLaughlin1-0/+8
Changed to PAL's GetTempPathA to get the temp path.
2019-01-02Delete lstrlen from Unix PAL (#21745)Jan Kotas4-362/+0
strlen/wcslen works just fine.
2018-12-17Delete dead code (#21562)Jan Kotas1-33/+0
- Delete clix support from PAL. "clix" was launcher in the Rotor days - like "dotnet" today. - Delete URL parsing from PALRT
2018-12-12Added support for debugging a sandboxed app on Mac (#21068)Oded Hanson1-1/+3
* Fixed bug in StackString where the size is not initialized correctly to STACK_COUNT * Added CharString and WCharString template classes and a generic CharStringFromLPCWSTR method * Added support for debugging a sandboxed app on Mac This change fixes the usage of IPC while debugging while running in a sandbox. When running in a sandbox, the temporary folder for each process will be different. Thus the pipes being created in TwoWayPipe right now would be created in different directories in the debugger process and the process being debugged. This change configures the folder to be used based on the application group ID that the sandboxed app belongs to. For the same reasons, the names sempahores being used to synchronize the debugger attach need to be prefixed with the application group ID. This change was abit more involved since the name of the semaphore is limited to 31 characters, so we had to encode the semaphore names differently to make them shorter. Last, new APIs to the debugger shim were added to support this new feature. This change only handles the runtime side and the dbgshim. An additional change to vsdbg needs to be done to use the new APIs. fixes #21066 * Fixed build breaks on non Mac Unix platforms * Fixed usage of gApplicationGroupId in non apple environments * Fixed bug in semaphore names * Got rid of usage of StackString * Made PAL_GetApplicationGroupId Apple specific * Added comment about pragma pack * Fixed comment * Added exported symbols * Duplicated applicationGroupId so it can be used from another thread during register complete callback * Renamed BitNum2ByteNum to GetExtraEncodedAreaSize to make intent clearer * Fixed nit comments * Removed redundant changes in StackString * Fixed windows build break * Fixed compilation switch from __APPLE to __APPLE__ * Added missing exports
2018-12-03Don't typedef intptr_t/uintptr_t when PAL_STDCPP_COMPAT is defined (#21165)Ilia2-6/+1
Bug: 20766
2018-11-28Move all the math functions undef #ifndef PAL_STDCPP_COMPAT (#21170)Ilia1-3/+3
Bug: 20786
2018-11-21Introduce Marshall.LoadLibrary API (#20871)Swaroop Sridhar1-3/+16
Implement Native LoadLibrary API This change commits the following changes: 1) Refactoring DllImport code to reuse LodLibrary by search for pInvoke and LoadLibrary cases 2) Implement the new Native Library API in System.Runtime.Interop.Marshall 3) Add tests for the new APIs
2018-11-12LoadLibrary refactoring (#20841)Swaroop Sridhar1-1/+6
* Refactor LoadLibrary Methods This change refactors the code in DllImport in preparation for implementing the new NativeLibrary API here: dotnet/corefx#32015 The two main changes are: 1) A change in the semantics of the internal LoadLibrary helper functions. When a native library is loaded, there are two categories of callers expecting different return values: External callers like AssemblyNative::InternalLoadUnmanagedDllFromPath() and the upcoming System.Runtime.Interop.Marshall.LoadLibrary() need the raw system handle Internal callers like LoadLibraryModule() need the PAL registered handle This change modifies the internal LoadLibraryModule* methods to work in terms of native system handles, so that external callers can obrain them directly. Methods requiring PAL-handles can register them explicitly. There is no change in external signature of DllImport class, or the native Dll cache in AppDomain class. 2) Differentiate HMODULE and NATIVE_LIBRARY_HANDLE This change defines NATIVE_LIBRARY_HANDLE type to represent raw system handles to native libraries that are not registered with the PAL (On Unix systems). The types on PAL and DlImport methods are adjusted to make this semantic distinction explicit. * Fix loading LibC via PAL_LoadLibraryDirect()
2018-11-06Loop-free GC rounding helpers with _BitScanReverse. (#20157)Jack Pappas1-0/+49
2018-11-06Added support for running in a sandbox on Mac (#20735)Oded Hanson1-0/+7
* Added support for running in a sandbox on Mac When running in a sandbox, the Mac operating system will limit access to resources, esp. the file system. Right now both Mutex and SharedMemory in the PAL are accessing the /tmp folder for which Mac does not provide the application permissions to access. Instead, the sandbox provides the ability to share information between applications by using a shared container folder. This is done by registering the application with an Application Group ID. Using this ID, we can access the shared folder and read/write from it. Since the .Net runtime can be loaded in multiple ways, we decided that the easiest way to let the runtime know what the application group ID is via an environment variable. Thus, if the NETCOREAPP_SANDBOX_APPLICATION_GROUP_ID environment variable is set (on Mac), the runtime will assume we are sandboxed, and will use the value provided as the application group ID. Note that due to limitations on semaphore file lengths, we will not allow application group IDs longer than 13 characters. This gives us 10 characters for the developer ID, and 3 extra characters for the group name. When sandbox is disabled (the environment variable is empty) then the folder for Mutex and SharedMemory will continue to be rooted in /tmp. However when the sandbox is enabled, these files will be created under /user/{loginname}/Library/Group Containers/{AppGroupId}/. Fixes #20473 * Made gApplicationContainerPath a pointer so it does not get automatically deleted by the c runtime * Made s_runtimeTempDirectoryPath and s_sharedMemoryDirectoryPath pointers so they are not automatically deleted by the c runtime * Renamed gApplicationContainerPath to gSharedFilesPath * Renamed NETCOREAPP_SANDBOX_APPLICATION_GROUP_ID to DOTNET_SANDBOX_APPLICATION_GROUP_ID * Fixed usage of VerifyStringOperation * Replaced new with InternalNew * Wrapped Apple specific code with #ifdef * Added exception handling during close * Moved VerifyStringOperation macro into SharedMemoryManager * Moved PathCharString variable declarations before AutoCleanup is declared. * Fixed initialization functions not to throw * Renamed CopyPath to BuildSharedFilesPath * Fixed misc nits * Fixed implicit conversions from BOOL to bool * Moved MAX_APPLICATION_GROUP_ID_LENGTH inside ifdef APPLE * Removed PAL_IsApplicationSandboxed
2018-11-05Adding some new functions to System.Math and System.MathF (#20788)Tanner Gooding1-1/+17
* Adding BitIncrement, BitDecrement, CopySign, MaxMagnitude, and MinMagnitude to Math and MathF * Adding FusedMultiplyAdd, IlogB, Log2, and ScaleB to Math and MathF * Adding some basic PAL tests for fma, ilogb, log2, and scalbn * Fixing a couple typos and adding clarifying comments * Fixing the MSVC _VVV FCALL declarations
2018-10-31Make BitScanForward/BitScanForward64 PAL wrappers branchless. (#20412)Jack Pappas1-23/+15
The BitScanForward/BitScanForward64 wrapper functions from the PAL and gcenv have been modified so they're faster (and branchless), while also adhering more closely to the behavior of the MSVC intrinsics. Use _BitScanForward64 when targeting 64-bit Windows. The _WIN32 macro is always defined by MSVC, even when targeting 64-bit versions of Windows. Use the _WIN64 macro instead to check whether the build is targeting 64-bit Windows, and if so, use the _BitScanForward64 intrinsic for the BitScanForward64 wrapper instead of the 32-bit-based fallback.
2018-10-08Remove mentions of Rotor from codebase (#20298)Austin Wise3-92/+5
* Moving parsing from TypeNameParser ctor to a separate method. It seems a bit odd to have the constructor parsing and then use a dummy method (MakeRotorHappy) to make it look more normal. * Remove CorMarkThreadInThreadPool. It is neither referenced nor exported. * Remove reference to rotor from securitywrapper.h * Remove reference to rotor from Strike/vm.cpp. This file is only built for Windows. * Remove reference to rotor from debugreturn.h This is the only file the defines these macros, so there is no need to undef them first. * Remove unused code refering to rotor from PAL. * Remove references to Rotor from PAL. * Remove references to deleted tests from DisabledTests.txt I can't find any evidence that this file is actually used. * Remove unneeded casts. * Remove dead and misleading code from profilinghelper.cpp. FEATURE_PROFAPI_EVENT_LOGGING is always defined when PROFILING_SUPPORTED is defined. And the entire contents of profilinghelper.cpp is surrounded with "ifdef PROFILING_SUPPORTED". So all sections in "ifndef FEATURE_PROFAPI_EVENT_LOGGING" are dead. Furthermore, in coreclr this does not use the eventlog, so the macro name is misleading. * Remove dead code in excep.cpp. This entire function is surrounded with "ifndef FEATURE_PAL". * Remove refererences to rotor from safemath.h This does not appear to cause any compile problems, so nobody was using safemath.h without _ASSERTE defined. Also S_SIZE_T_WP64BUG is not used anywhere. * Remove dead code from palclr.h. I don't know why these check to see if the macro is undefined immediately after defining them. Also the comment appears to reference some unions that are no longer in this file. * Expose ISymUnmanagedWriter2 from SymWriter as required by COM. The comment talks about the C# compiler using this, however I cannot see a way for the C# compiler to get an instance of this. It is only used internally by AssemblyBuilder and not exposed otherwise. * Restore check for _ASSERTE in safemath.h. On Windows sometimes that this file is included without _ASSERTE being defined. As the existing comment suggests, it appears that SOS explicitly does not want _ASSERTE to do anything.