platform/upstream/coreclr.git
4 years agoBuild tests in gbs for x86/x64 (#307) accepted/tizen/unified/20200907.144049 submit/tizen/20200901.065247
Gleb Balykov/Platform Lab /SRR/Engineer/Samsung Electronics [Tue, 25 Aug 2020 08:35:27 +0000 (11:35 +0300)]
Build tests in gbs for x86/x64 (#307)

* 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

4 years agoFix buffer overrun in JIT for Vector256<T> types on ARM64. (#35864) (#308) accepted/tizen/unified/20200811.050456 submit/tizen/20200811.004222
Timur Mustafin/Platform Lab /SRR/Engineer/Samsung Electronics [Mon, 10 Aug 2020 09:40:39 +0000 (12:40 +0300)]
Fix buffer overrun in JIT for Vector256<T> types on ARM64. (#35864) (#308)

Stop recognizing Vector256<T> types as intrinsic for ARM64 in Crossgen2.

Signed-off-by: Timur <t-mustafin@partner.samsung.com>
4 years agoImplement genProfilingEnterCallback genProfilingLeaveCallback on Arm64 (dotnet/corecl... accepted/tizen/unified/20200731.145700 submit/tizen/20200731.014213
Mikhail Kurinnoi [Thu, 23 Jul 2020 08:37:35 +0000 (11:37 +0300)]
Implement genProfilingEnterCallback genProfilingLeaveCallback on Arm64 (dotnet/coreclr#26460)

* Split genProfilingEnterCallback and genProfilingLeaveCallback into architecture specific versions
* Remove redundant genStackLevel save/restore logic on Arm, Arm64, Amd64
* Implement JIT_ProfilerEnterLeaveTailcallStub in assembly
* Define RBM_PROFILER_{ENTER,LEAVE,TAILCALL}_TRASH for TARGET_ARM64
* Define REG_PROFILER_{ENTER,LEAVE}_ARG_FUNC_ID and RBM_PROFILER_{ENTER,LEAVE}_ARG_CALLER_SP
* Simplify r0Trashed logic in src/jit/codegenarm.cpp
* Remove wrong comment in src/jit/codegenarm.cpp
* On Arm genPrologPadForReJit does nothing so remove it in src/jit/codegenarm.cpp
* Implement LinearScan::BuildNode for GT_PROF_HOOK and GT_RETURN in src/jit/lsraarm64.cpp
* Shouldn't a call to CORINFO_HELP_PROF_FCN_TAILCALL be marked as a No-GC?
* Implement genProfilingEnterCallback genProfilingLeaveCallback in src/jit/codegenarm64.cpp
* Implement NYI profiler methods in src/vm/arm64/profiler.cpp
* Implement ProfileEnterNaked ProfileLeaveNaked ProfileTailcallNaked in src/vm/arm64/asmhelpers.S
* Implement profiler helpers on win-arm64
* Remove logic for !FINAL_FRAME_LAYOUT in codegenarm64.cpp
* Remove unused macro in src\jit\target.h
* genProfilingLeaveCallback ignores helper on arm in src\jit\codegenarm.cpp
* Refactor genProfilingLeaveCallback in src\jit\codegenarm.cpp

Commit migrated from https://github.com/dotnet/coreclr/commit/d88bc184d054fe8e4915964330ca65378d59ef27

4 years ago[Tizen] Fix unsupportedCrossgenLibs.arm64 (#304) accepted/tizen/unified/20200724.124146 submit/tizen/20200723.225658
Timur Mustafin/AI Compiler Lab /SRR/Engineer/Samsung Electronics [Thu, 23 Jul 2020 22:26:39 +0000 (01:26 +0300)]
[Tizen] Fix unsupportedCrossgenLibs.arm64 (#304)

Signed-off-by: Timur <t.mustafin@partner.samsung.com>
4 years ago[Tizen] Add skips for arm64
Timur [Thu, 23 Jul 2020 10:45:33 +0000 (13:45 +0300)]
[Tizen] Add skips for arm64

Signed-off-by: Timur <t.mustafin@partner.samsung.com>
4 years ago[Tizen] Disable default build of tests
Gleb Balykov [Wed, 22 Jul 2020 08:02:06 +0000 (11:02 +0300)]
[Tizen] Disable default build of tests

To build tests for armel/arm64 add: --define 'skiptests 0'

4 years ago[Tizen] Do not pack debug dlls
Gleb Balykov [Fri, 17 Jul 2020 13:51:15 +0000 (16:51 +0300)]
[Tizen] Do not pack debug dlls

This is required to workaround rpmbuild issue (rpmbuild tries to get debug symbols from these dlls)

4 years ago[Tizen] Disable default non-portable build for armel
Gleb Balykov [Fri, 17 Jul 2020 12:51:32 +0000 (15:51 +0300)]
[Tizen] Disable default non-portable build for armel

This is required for portable build of managed part of tests. To cross build CLR for tizen use -portablebuild=false.

4 years ago[Tizen] Add skipgeneratelayout option to skip generation of coreroot
Gleb Balykov [Fri, 17 Jul 2020 12:28:45 +0000 (15:28 +0300)]
[Tizen] Add skipgeneratelayout option to skip generation of coreroot

4 years ago[Tizen] Set obj dir to be TargetRid specific
Gleb Balykov [Fri, 17 Jul 2020 09:55:06 +0000 (12:55 +0300)]
[Tizen] Set obj dir to be TargetRid specific

This allows to perform build for different arches in the same repository

4 years ago[Tizen] Add skiprestore option to skip restore of packages
Gleb Balykov [Wed, 15 Jul 2020 10:29:10 +0000 (13:29 +0300)]
[Tizen] Add skiprestore option to skip restore of packages

Partial cherry-pick of https://github.com/dotnet/coreclr/pull/27633

4 years ago[Tizen] Add flag skipstressdependencies to skip build of x64 specific .so for stress...
Gleb Balykov [Tue, 14 Jul 2020 15:54:53 +0000 (18:54 +0300)]
[Tizen] Add flag skipstressdependencies to skip build of x64 specific .so for stress testing

4 years ago[Tizen] Do not access crossgen if it is not needed
Gleb Balykov [Tue, 14 Jul 2020 15:49:49 +0000 (18:49 +0300)]
[Tizen] Do not access crossgen if it is not needed

4 years ago[Tizen] Fix issue with return from non-sourced script if tools are already initialized
Gleb Balykov [Tue, 14 Jul 2020 15:19:04 +0000 (18:19 +0300)]
[Tizen] Fix issue with return from non-sourced script if tools are already initialized

4 years ago[Tizen] Build CoreCLR tests in spec
Gleb Balykov [Mon, 13 Jul 2020 21:25:19 +0000 (00:25 +0300)]
[Tizen] Build CoreCLR tests in spec

4 years ago[Tizen] Add skips for armel
Gleb Balykov [Mon, 13 Jul 2020 20:33:33 +0000 (23:33 +0300)]
[Tizen] Add skips for armel

4 years ago[Tizen] Fix clang version passing
Gleb Balykov [Mon, 13 Jul 2020 20:33:02 +0000 (23:33 +0300)]
[Tizen] Fix clang version passing

4 years ago[Tizen] Add updated scripts to run tests
Gleb Balykov [Mon, 13 Jul 2020 13:44:25 +0000 (16:44 +0300)]
[Tizen] Add updated scripts to run tests

- CLRTest.CrossGen.targets is used as a template for crossgen part of individual test script
- runtest.sh is used for launching tests

4 years ago[Tizen] Add CoreCLR tests build dependencies v3.1.3 for armel, arm64
Gleb Balykov [Fri, 17 Jul 2020 12:44:09 +0000 (15:44 +0300)]
[Tizen] Add CoreCLR tests build dependencies v3.1.3 for armel, arm64

4 years ago[Tizen] Add CoreCLR tests BuildTools v3.1.3 for armel,arm64
Gleb Balykov [Mon, 13 Jul 2020 15:17:29 +0000 (18:17 +0300)]
[Tizen] Add CoreCLR tests BuildTools v3.1.3 for armel,arm64

4 years ago[Tizen] Enable relocations optimizations for Tizen arm64 accepted/tizen/unified/20200714.065733 submit/tizen/20200714.001703
Gleb Balykov [Wed, 8 Jul 2020 09:47:00 +0000 (12:47 +0300)]
[Tizen] Enable relocations optimizations for Tizen arm64

4 years ago[Tizen] Update CreateDictionaryLookupHelper on arm64 to support relative indirection
Gleb Balykov [Tue, 7 Jul 2020 12:32:41 +0000 (15:32 +0300)]
[Tizen] Update CreateDictionaryLookupHelper on arm64 to support relative indirection

4 years ago[Tizen] Support relative indirection for 1st and 2nd levels of vtable on arm64
Gleb Balykov [Thu, 2 Jul 2020 14:01:13 +0000 (17:01 +0300)]
[Tizen] Support relative indirection for 1st and 2nd levels of vtable on arm64

4 years ago[Tizen] Add clang8/9/10 build support (#295)
Gleb Balykov/AI Compiler Lab /SRR/Engineer/Samsung Electronics [Sun, 12 Jul 2020 21:43:32 +0000 (00:43 +0300)]
[Tizen] Add clang8/9/10 build support (#295)

4 years ago[Tizen] Unify dnetmemoryenumlib terms to match the codebase (#291) accepted/tizen_5.5_unified accepted/tizen/5.5/unified/20200729.230651 accepted/tizen/5.5/unified/wearable/hotfix/20201027.101953 accepted/tizen/unified/20200703.155115 submit/tizen/20200703.012556 submit/tizen_5.5/20200629.221218 submit/tizen_5.5/20200729.021615 submit/tizen_5.5_wearable_hotfix/20201026.184306
Mateusz Moscicki/System (PLT) /SRPOL/Engineer/Samsung Electronics [Fri, 3 Jul 2020 01:22:42 +0000 (03:22 +0200)]
[Tizen] Unify dnetmemoryenumlib terms to match the codebase (#291)

4 years ago[Tizen] Fix cross build arm64 rootfs creation (#284) accepted/tizen/unified/20200630.131323 submit/tizen/20200629.221257
Gleb Balykov/AI Compiler Lab /SRR/Engineer/Samsung Electronics [Mon, 29 Jun 2020 21:43:42 +0000 (00:43 +0300)]
[Tizen] Fix cross build arm64 rootfs creation (#284)

4 years ago[Tizen] Fix crash on accessing 0x0 while unwinding (#287)
이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 [Mon, 29 Jun 2020 21:43:30 +0000 (06:43 +0900)]
[Tizen] Fix crash on accessing 0x0 while unwinding (#287)

Change-Id: I663d0fcdcd6fd8fb4c521d9bdbb4d234c96022ae

4 years agoFix a FNV error on arm64 (#286)
정동헌/Common Platform Lab(SR)/Principal Engineer/삼성전자 [Fri, 26 Jun 2020 02:15:41 +0000 (11:15 +0900)]
Fix a FNV error on arm64 (#286)

Simple HelloWorld app can run with NI of System.Private.CoreLib.dll, HelloWorld.dll and System.Console.dll

4 years agoFix TPA map hash calculation. (#288)
Mikhail Kurinnoi/AI Compiler Lab /SRR/Staff Engineer/Samsung Electronics [Thu, 25 Jun 2020 22:30:09 +0000 (01:30 +0300)]
Fix TPA map hash calculation. (#288)

* Fix TPA map hash calculation.

The point of issue is "the Turkish-I Problem". After locale changed, towupper() provide another result for "i" and different hash are calculated in case if file name have "i" letter.

* Regression test for #37910

4 years ago[Tizen] Pass compilation flags to asm files (#285)
Gleb Balykov/AI Compiler Lab /SRR/Engineer/Samsung Electronics [Tue, 23 Jun 2020 21:35:00 +0000 (00:35 +0300)]
[Tizen] Pass compilation flags to asm files (#285)

4 years ago[Tizen] Force Inline for Generic Methods (#224) accepted/tizen/unified/20200623.124116 submit/tizen/20200622.225420
정동헌/Common Platform Lab(SR)/Principal Engineer/삼성전자 [Mon, 22 Jun 2020 22:44:28 +0000 (07:44 +0900)]
[Tizen] Force Inline for Generic Methods (#224)

This patch enables more generic method inlining for methods which are not compiled by NI.

4 years agoFix missing TransitionBlock methods (#33134) accepted/tizen/5.5/unified/20200623.152349 submit/tizen_5.5/20200623.003918
JUNG DONG-HEON [Thu, 18 Jun 2020 11:10:23 +0000 (20:10 +0900)]
Fix missing TransitionBlock methods (#33134)

4 years ago[Tizen] Add arm64 rootfs build script
Gleb Balykov [Mon, 15 Jun 2020 16:04:11 +0000 (19:04 +0300)]
[Tizen] Add arm64 rootfs build script

4 years ago[Tizen] Enable aarch64 gbs build
Gleb Balykov [Wed, 17 Jun 2020 08:21:05 +0000 (11:21 +0300)]
[Tizen] Enable aarch64 gbs build

4 years ago[Tizen] Add tizen arm64 toolchain file. Explicitly pass non-portable build to fix...
Gleb Balykov [Thu, 11 Jun 2020 12:29:13 +0000 (15:29 +0300)]
[Tizen] Add tizen arm64 toolchain file. Explicitly pass non-portable build to fix arm64 build on tizen (on armel non-portable build is default, tizen rid in general is non-portable).

4 years agoAdd JIT/Stress/ABI Tests
JUNG DONG-HEON [Tue, 9 Jun 2020 06:34:36 +0000 (15:34 +0900)]
Add JIT/Stress/ABI Tests

Cherrypick only test parts of below patches in public dotnet/runtime github
be8e050a6d27040d6c249382d99d57d973e919b2 Implement instantiating and unboxing through portable stublinker code… (#106)
0e949491faee53d2a7ad4d5649be17e98e5d3a96 Some minor ABI stress improvements
3f339687a8151e989bbb4673aab9b0abcddf5642 Mark emitted types assembly as collectible in ABI stress (dotnet/coreclr#26253)
a25dd1a45b6fdad114ffaa915550906c986aa1ca Remove redundant ABI stress tests (dotnet/coreclr#26183)
57945676a6395da61b61ce427a055e77d330db86 Fix GenerateShuffleArray to support cyclic shuffles (dotnet/coreclr#26169)
3b0ba1ee24823030a3fc7278dd064d24a49a90bb Add ABI stress tests (dotnet/coreclr#26090)

4 years agoImplement instantiating and unboxing through portable stublinker code… (#106)
JUNG DONG-HEON [Mon, 8 Jun 2020 01:20:14 +0000 (10:20 +0900)]
Implement instantiating and unboxing through portable stublinker code… (#106)

* Implement instantiating and unboxing through portable stublinker code
- Handle only the cases with register to register moves
- Shares abi processing logic with delegate shuffle thunk creation
- Architecture specific logic is relatively simple
- Do not permit use of HELPERREG in computed instantiating stubs
- Fix GetArgLoc such that it works on all architectures and OS combinations

Add a JIT stress test case for testing all of the various combinations
- Use the same calling convention test architecture that was used as part of tail call work

Rename secure delegates to wrapper delegates
- Secure delegates are no longer a feature of the runtime
- But the wrapper delegate lives on as a workaround for a weird detail of the ARM32 abi

4 years agoFix GenerateShuffleArray to support cyclic shuffles (dotnet/coreclr#26169)
JUNG DONG-HEON [Thu, 28 May 2020 02:15:47 +0000 (11:15 +0900)]
Fix GenerateShuffleArray to support cyclic shuffles (dotnet/coreclr#26169)

* Fix GenerateShuffleArray to support cyclic shuffles

The GenerateShuffleArray was not handling case when there was a cycle in
the register / stack slots shuffle and it resulted in an infinite loop
in this function. This issue is Unix Amd64 ABI specific.
To fix that, this change reworks the algorithm completely. Besides
fixing the issue, it has also better performance in some cases.
To fix the cyclic shuffling, I needed an extra helper register. However,
there was no available general purpose register available, so I had to
use xmm8 for this purpose.

* Remove special handling of the hang from ABI stress

4 years ago[x86/Linux] Fix SIGSEGV during evaluation abort routine. accepted/tizen/5.5/unified/20200608.142150 accepted/tizen/unified/20200608.144754 submit/tizen/20200607.233857 submit/tizen_5.5/20200607.233848
Mikhail Kurinnoi [Thu, 4 Jun 2020 14:48:52 +0000 (17:48 +0300)]
[x86/Linux] Fix SIGSEGV during evaluation abort routine.

In case of evaluation with implicit function call aborted by ```ICorDebugEval::Abort()```, CoreCLR crash with SIGSEGV at line https://github.com/dotnet/runtime/blob/e25517ea27311297c1e3946acb3b4382d5fa7fef/src/coreclr/src/vm/jitinterface.cpp#L14293 since ```m_pJM``` is ```NULL```.
This happens because during ```EECodeInfo::Init()``` call, ```codeAddress``` parameter provide address inside native code region (this address belong to CallDescrWorkerInternal(), libcoreclr.so), but not address inside managed code, so, ```ExecutionManager::FindCodeRange()``` can't find appropriate ```RangeSection```.

During investigation I found, that at line https://github.com/dotnet/runtime/blob/e25517ea27311297c1e3946acb3b4382d5fa7fef/src/coreclr/src/vm/stackwalk.cpp#L2584 current context was not changed properly (we have wrong ```Eip``` register value).
I found, that ```FuncEvalFrame::UpdateRegDisplay()``` code
https://github.com/dotnet/runtime/blob/e25517ea27311297c1e3946acb3b4382d5fa7fef/src/coreclr/src/debug/ee/debugger.inl#L238-L247
don't have x86/Linux support implemented.

I propose changes, that were already made for other ```UpdateRegDisplay()``` implementations in order to provide proper context for x86/Linux.

4 years ago[Tizen] Enable ASan annotation of passing to native code buffers
Andrey Kazmin [Thu, 14 May 2020 13:57:25 +0000 (16:57 +0300)]
[Tizen] Enable ASan annotation of passing to native code buffers

Turn on ASan inteceptors while marshaling managed buffers to native code.
We could not properly annotate already allocated on heap buffers, so
we have to disable pinning of such objects.
Current patch affects only pinning of native arrays.

4 years ago[Tizen] Cleanup confusing symlinks accepted/tizen/5.5/unified/20200601.002556 accepted/tizen/unified/20200601.051718 submit/tizen/20200529.025703 submit/tizen_5.5/20200529.025744
Hyungju Lee [Mon, 25 May 2020 08:19:52 +0000 (17:19 +0900)]
[Tizen] Cleanup confusing symlinks

Change-Id: I032c9ff1e0f43e39d0d05a38eb95dabe2f1b6b25

4 years agoUpdate package version to 3.1.3
Alexander Soldatov/AI Compiler Lab /SRR/Staff Engineer/Samsung Electronics [Fri, 22 May 2020 09:14:11 +0000 (12:14 +0300)]
Update package version to 3.1.3

4 years agoSet vtable offset as contained
JUNG DONG-HEON [Thu, 5 Dec 2019 07:23:39 +0000 (16:23 +0900)]
Set vtable offset as contained

- Can remove a machine instruction which adds vtable offset

4 years ago[Tizen] Change the visibility of symbols for dnetmemoryenumlib accepted/tizen/5.5/unified/20200522.160111 accepted/tizen/unified/20200529.124257 submit/tizen/20200528.065414 submit/tizen_5.5/20200512.212247
Mateusz Moscicki [Fri, 8 May 2020 11:40:06 +0000 (13:40 +0200)]
[Tizen] Change the visibility of symbols for dnetmemoryenumlib

4 years ago[Tizen] Skip tests, which throw System.OutOfMemoryException on TW3 accepted/tizen/5.5/unified/20200423.150450 accepted/tizen/unified/20200423.054553 submit/tizen/20200422.104050 submit/tizen_5.5/20200422.104039
Gleb Balykov [Tue, 24 Mar 2020 15:09:46 +0000 (18:09 +0300)]
[Tizen] Skip tests, which throw System.OutOfMemoryException on TW3

4 years ago[Tizen] Enable Debug builds for i686
Sangwook Kim [Fri, 27 Mar 2020 09:05:25 +0000 (18:05 +0900)]
[Tizen] Enable Debug builds for i686

4 years ago[Tizen] Add a config knob for importing ibc files
Swift Kim [Thu, 1 Aug 2019 06:10:49 +0000 (15:10 +0900)]
[Tizen] Add a config knob for importing ibc files

4 years agoFix PIE options (#26323) accepted/tizen/unified/20200416.080052 submit/tizen/20200415.223728
Jan Vorlicek [Fri, 23 Aug 2019 15:03:01 +0000 (17:03 +0200)]
Fix PIE options (#26323)

* Fix PIE options

We were missing passing the -pie linker option. That means that while we
were compiling our code as position independent, the executables
(not shared libraries) were not marked as position independent and
ASLR was not applied to them. They were always loaded to fixed addresses.

This change adds the missing -pie option and also replaces all the individual
settings of -fPIE / -fPIC on the targets we build by a centralized setting
of CMAKE_POSITION_INDEPENDENT_CODE variable that causes cmake to add the
appropriate compiler options everywhere.

* Fix native parts of coreclr tests build

The native parts of the tests are not built using the root CMakeLists.txt
so I am moving enabling the position independent code to configurecompiler.cmake

Change-Id: Ieafff8984ec23e5fdb00fb0c2fb017e53afbce88

4 years ago[Tizen] Fix build of Runtime_1241 test accepted/tizen/unified/20200402.155517 submit/tizen/20200402.013218
Gleb Balykov [Wed, 25 Mar 2020 15:17:50 +0000 (18:17 +0300)]
[Tizen] Fix build of Runtime_1241 test

4 years ago[Tizen] Add FEATURE_LARGEADDRESS_SUPPORT
Sangwook Kim [Tue, 18 Feb 2020 06:48:15 +0000 (15:48 +0900)]
[Tizen] Add FEATURE_LARGEADDRESS_SUPPORT

Many diagnostic tools are unaware of 32-bit applications which have
large address spaces (> 2GB). Such tools include the TraceEvent library
(required by PerfView and dotnet-trace), and Visual Studio. They assume
the address range 0x80000000 through 0xFFFFFFFF as the system space and
thus often fail to read symbols from event traces generated by CoreCLR.

This workaround is to support such scenarios by simply discarding MSBs
of 32-bit instruction pointer values in the trace output. Only a minimal
set of values required for symbol resolution are affected by this
change. Beware that you will have to manually restore the original
values when you inspect them in lldb or etc.

4 years ago[Tizen] Fix usage of ni.exe in readytorun test
Gleb Balykov [Mon, 16 Mar 2020 16:25:20 +0000 (19:25 +0300)]
[Tizen] Fix usage of ni.exe in readytorun test

4 years ago[Tizen] Add System.Private.CoreLib.pdb to coreclr-devel package
Gleb Balykov [Wed, 11 Mar 2020 13:13:19 +0000 (16:13 +0300)]
[Tizen] Add System.Private.CoreLib.pdb to coreclr-devel package

4 years ago[Tizen] Move the executables(ilasm, ildasm) to use in dotnettool from devel rpm
j-h.choi [Tue, 7 Jan 2020 07:14:33 +0000 (16:14 +0900)]
[Tizen] Move the executables(ilasm, ildasm) to use in dotnettool from devel rpm

4 years agomodify integral tryparse to use memcpy (#2295)
John Salem [Thu, 13 Feb 2020 02:14:46 +0000 (18:14 -0800)]
modify integral tryparse to use memcpy (#2295)

4 years agoFix OverflowException from IntPtr casting (#14381)
Swift Kim [Fri, 31 Jan 2020 14:27:40 +0000 (23:27 +0900)]
Fix OverflowException from IntPtr casting (#14381)

4 years ago[Tizen] Reduce arm_phdr_cb call overhead
JUNG DONG-HEON [Thu, 9 Jan 2020 07:38:00 +0000 (16:38 +0900)]
[Tizen] Reduce arm_phdr_cb call overhead

- Too many calls to arm_phdr_cb even though it get the same data.
- It caches an ARM_CB_DATA for libcoreclr.so, then reuse.

4 years ago[Tizen] RPM version of Tizen will be upgrade to 4.14.1.
Woongsuk Cho [Tue, 31 Dec 2019 04:59:26 +0000 (13:59 +0900)]
[Tizen] RPM version of Tizen will be upgrade to 4.14.1.

4 years agoChange bIsFree check in DacValidateMethodTable (#1086)
Dong-Heon Jung [Mon, 23 Dec 2019 19:11:43 +0000 (04:11 +0900)]
Change bIsFree check in DacValidateMethodTable (#1086)

Some commands of SOS validate a method table in DacValidateMethodTable.
In the function, it checks whether a method table is FreeObjectMethodTable or not with GetClass() value.
However, GetClass() should not be NULL. (There is an assert in GetClass())
In this patch, it compares pMT address with g_pFreeObjectMethodTable address only.

4 years ago[Tizen] add pie linker option to createdump
Woongsuk Cho [Thu, 12 Dec 2019 11:41:39 +0000 (20:41 +0900)]
[Tizen] add pie linker option to createdump

4 years agoHandle glibc sys/sysctl.h deprecation (#27048)
Omair Majid [Wed, 16 Oct 2019 09:25:29 +0000 (05:25 -0400)]
Handle glibc sys/sysctl.h deprecation (#27048)

glibc has deprecated sys/sysctl.h:

    In file included from /coreclr/src/pal/src/misc/sysinfo.cpp:32:
    /usr/include/sys/sysctl.h:21:2: error: "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror,-W#warnings]
    #warning "The <sys/sysctl.h> header is deprecated and will be removed."
     ^
    1 error generated.

Fix that by preferring sysconf and only including sys/sysctl.h if
HAVE_SYSCONF is not true. This mirrors the order of the implementation
code in this file (sysinfo.cpp) which checks for HAVE_SYSCONF
before HAVE_SYSCTL.

Fixes #27008

4 years ago[Tizen] Use -mstackrealign to sync up with Tizen build changes
Mikhail Kashkarov [Fri, 6 Dec 2019 15:57:11 +0000 (18:57 +0300)]
[Tizen] Use -mstackrealign to sync up with Tizen build changes

Tizen i586 now builds with -mstackrealign by default:

    "Realign the stack at entry. On the x86, the -mstackrealign option
    generates an alternate prologue and epilogue that realigns the
    run-time stack if necessary. This supports mixing legacy codes that
    keep 4-byte stack alignment with modern codes that keep 16-byte
    stack alignment for SSE compatibility. ..."

Change-Id: I36afd18998829f897c6b2b48687c4ae1d172b84b
Signed-off-by: Mikhail Kashkarov <m.kashkarov@partner.samsung.com>
4 years agoEnable NGEN for methods marked with AggressiveOptimization (#27259)
Dong-Heon Jung [Fri, 18 Oct 2019 00:23:51 +0000 (09:23 +0900)]
Enable NGEN for methods marked with AggressiveOptimization (#27259)

- Methods marked with AggressiveOptimization are not NGENed at all.
- The methods are compiled during the runtime with high JITC overhead.
- It makes launching time slower over 6% in our embedded systems.

4 years agoMark Relocation Section as NotNeeded (#25715)
Dong-Heon Jung [Fri, 30 Aug 2019 21:05:53 +0000 (06:05 +0900)]
Mark Relocation Section as NotNeeded (#25715)

- 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.

4 years ago[Tizen] Use PTRACE_GETREGSET for any arch when creating dump
Swift Kim [Mon, 18 Nov 2019 07:38:56 +0000 (16:38 +0900)]
[Tizen] Use PTRACE_GETREGSET for any arch when creating dump

Also ignore ptrace NT_FPREGSET failures for arm processes on aarch64
kernels. Fixes #25707.

4 years ago[Tizen] Add createdump to build output
Sangwook Kim [Mon, 18 Nov 2019 01:20:57 +0000 (10:20 +0900)]
[Tizen] Add createdump to build output

4 years ago[Tizen] Add coreclr_preload_assembly to CoreCLR host API
Konstantin Baladurin [Fri, 5 Jul 2019 16:36:28 +0000 (19:36 +0300)]
[Tizen] Add coreclr_preload_assembly to CoreCLR host API

4 years ago[Tizen] Enable Tizen ASan runtime support
Vyacheslav Cherkashin [Fri, 19 Jul 2019 12:05:47 +0000 (15:05 +0300)]
[Tizen] Enable Tizen ASan runtime support

Enable libasansi.so support (libasan.so with switchable interceptors).

Change-Id: I9ee9b47b7beab55f036ffc0697ffab2583e9701c
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
4 years ago[Tizen] Implement ASan wrapper for Linux AMD64
Vyacheslav Cherkashin [Mon, 29 Jul 2019 16:02:37 +0000 (19:02 +0300)]
[Tizen] Implement ASan wrapper for Linux AMD64

Change-Id: I48446ce7c8771a4c75149512bb7d8a8cb3fae8e5
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
4 years ago[Tizen] Implement ASan wrapper for Linux ARM32
Vyacheslav Cherkashin [Mon, 22 Jul 2019 10:40:47 +0000 (13:40 +0300)]
[Tizen] Implement ASan wrapper for Linux ARM32

This commit implements wrappers that allow interception transitions
from managed to external unmanaged code (CIL -> native) and back
(native -> CIL). This allows enable/disable ASan during transitions.
Due to this, we sanitize only external code, which allows us to
achieve acceptable performance.

Change-Id: I53ecdc14d28f7210cd9e7f5bd4db0c8ef5ed81fc
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
4 years ago[Tizen] Implement detecting of sanitized libraries
Andrey Drobyshev [Tue, 16 Jul 2019 12:23:18 +0000 (15:23 +0300)]
[Tizen] Implement detecting of sanitized libraries

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>
4 years agoPrevent freeing of the profiler on process shutdown.
David Mason [Wed, 18 Sep 2019 20:19:36 +0000 (13:19 -0700)]
Prevent freeing of the profiler on process shutdown.

4 years ago[Tizen] skip dotnet specific arguments in corerun
Konstantin Baladurin [Fri, 4 Oct 2019 16:45:44 +0000 (19:45 +0300)]
[Tizen] skip dotnet specific arguments in corerun

Now we use corerun to run corefx tests instead of dotnet, because last
one isn't available for Tizen/armel. So we need to skip dotnet specific
arguments, we patch corerun for it because Microsoft.DotNet.RemoteExecutor
tries to execute binary that it gets from /proc/self/maps, so we need a
binary that will behave like dotnet.

4 years agoBuild error fix on FEATURE_PREJIT=true
Swift Kim [Fri, 12 Jul 2019 06:50:08 +0000 (15:50 +0900)]
Build error fix on FEATURE_PREJIT=true

This fix is to update usages of SetupGcCoverage() under
FEATURE_PREJIT aligned to the signature change in #25261.

4 years ago[Linux/x86] Use ebp from current context during unwinding (#26789)
Konstantin Baladurin [Thu, 26 Sep 2019 17:06:57 +0000 (20:06 +0300)]
[Linux/x86] Use ebp from current context during unwinding (#26789)

pCurrentContextPointers in REGDISPLAY can contain NULLs so we need to use
ebp value from pCurrentContext. This patch contains following changes:

- GetRegdisplayFP returns ebp from pCurrentContext
- GetRegdisplayFP is used instead of *GetEbpLocation()
- Set##reg##Location also updates register value in pCurrentContext

4 years ago[JIT/x86] Fix LinearScan::allocateRegisters (#26649)
Konstantin Baladurin [Fri, 13 Sep 2019 17:28:08 +0000 (20:28 +0300)]
[JIT/x86] Fix LinearScan::allocateRegisters (#26649)

Check for `lvLRACandidate` instead of `!lvDoNotEnregister` when checking whether `this` may be enregistered and has an Interval.

4 years agoLinux/x86: fix build (#26594)
Konstantin Baladurin [Mon, 9 Sep 2019 15:40:14 +0000 (00:40 +0900)]
Linux/x86: fix build (#26594)

4 years ago[Tizen] Pack test libs to coreclr-test
Gleb Balykov [Wed, 11 Sep 2019 13:53:14 +0000 (16:53 +0300)]
[Tizen] Pack test libs to coreclr-test

4 years ago[Tizen] Add unsupported tests
Gleb Balykov [Tue, 10 Mar 2020 17:22:57 +0000 (20:22 +0300)]
[Tizen] Add unsupported tests

4 years ago[Tizen] Replace new runtest.sh, which calls dotnet internally, with old runtest.sh
Gleb Balykov [Wed, 21 Aug 2019 16:47:37 +0000 (19:47 +0300)]
[Tizen] Replace new runtest.sh, which calls dotnet internally, with old runtest.sh

4 years ago[Tizen] Partially revert a6292a6.
Mikhail Kurinnoi [Mon, 19 Aug 2019 12:06:58 +0000 (15:06 +0300)]
[Tizen] Partially revert a6292a6.

NetcoreDBG depends from PAL functions.
Instead of SOS plugin, that use PAL static libs, debugger should be able
to operate with any runtime version and can't be statically linked to PAL.

4 years agoadd access(2) call before dlopening files
Yaroslav Yamshchikov [Thu, 18 Jul 2019 10:14:14 +0000 (13:14 +0300)]
add access(2) call before dlopening files

4 years agocorbbtprof: set byte alignment for CORBBTPROF structures (#25816)
Konstantin Baladurin [Tue, 23 Jul 2019 04:01:22 +0000 (07:01 +0300)]
corbbtprof: set byte alignment for CORBBTPROF structures (#25816)

Fix patch fixes SIGBUG that occurs due to unaligned read/write

4 years agoFail to explicitly tail call on x86 unix. (#25032)
Jarret Shook [Fri, 19 Jul 2019 04:07:08 +0000 (21:07 -0700)]
Fail to explicitly tail call on x86 unix. (#25032)

* Fail to explicitly tail call on x86 unix.

* Correctly return 100

* Correct return value

* Add noway assert in morphTailCall to avoid morphing slow tail calls on unix.

* Address feedback

4 years ago[Tizen] Disable jithost arena cache
Gleb Balykov [Fri, 2 Aug 2019 14:28:27 +0000 (17:28 +0300)]
[Tizen] Disable jithost arena cache

4 years ago[Tizen] Disable IBC Logger as a default
DongHeon Jung [Thu, 18 Jul 2019 08:28:55 +0000 (17:28 +0900)]
[Tizen] Disable IBC Logger as a default

- Profile information is collected by ibc logger.
  Hower it is not used and saved into profile file.
- The patch disables IBC logger which is enabled by default.
- It disables IBC logger only with ibclogger.h file.
  IBCLOGGER_ENABLED definition is only used in ibclogger files.

4 years agoFix a build error when IBCLOGGER_ENABLED is not defined (#25691)
Dong-Heon Jung [Wed, 17 Jul 2019 03:09:40 +0000 (12:09 +0900)]
Fix a build error when IBCLOGGER_ENABLED is not defined (#25691)

- Even if DACCESS_COMPILE or CROSSGEN_COMPILE is defined,
  coreclr can be built without IBCLOGGER_ENABLED definition.

4 years ago[Tizen] Enable PGO for Linux/arm
Konstantin Baladurin [Thu, 18 Apr 2019 09:29:56 +0000 (12:29 +0300)]
[Tizen] Enable PGO for Linux/arm

4 years ago[Tizen] seperate PIC and PIE to fix x86_64 build error
Woongsuk Cho [Thu, 9 May 2019 09:02:22 +0000 (18:02 +0900)]
[Tizen] seperate PIC and PIE to fix x86_64 build error

4 years ago[Tizen] Add a library to retrieve memory regions for a coredump
Mateusz Moscicki [Wed, 10 Apr 2019 09:40:33 +0000 (11:40 +0200)]
[Tizen] Add a library to retrieve memory regions for a coredump

This is needed to save a minicoredump of .NET applications to allows
reconstruct managed stack by lldb and SOS plugin.

4 years ago[Tizen] update cscope files to be ignored
Hyungju Lee [Wed, 13 Mar 2019 00:28:54 +0000 (09:28 +0900)]
[Tizen] update cscope files to be ignored

Change-Id: Ia0e1c6aa651c4fd88dc58b901729896a7a27681d

4 years agoFix OOPStackUnwinderX86::Unwind crash when Eip is invalid
Igor Kulaychuk [Wed, 25 Apr 2018 18:31:59 +0000 (21:31 +0300)]
Fix OOPStackUnwinderX86::Unwind crash when Eip is invalid

4 years agoFix EECodeManager::GetAmbientSP on x86/Linux
Igor Kulaychuk [Fri, 20 Apr 2018 20:52:57 +0000 (23:52 +0300)]
Fix EECodeManager::GetAmbientSP on x86/Linux

4 years ago[Tizen] Add -pie to linker option
Hyungju Lee [Mon, 2 Jul 2018 00:28:08 +0000 (09:28 +0900)]
[Tizen] Add -pie to linker option

There have been no -pie linker option.
This patch adds -pie linker option into crossgen(for tizen)

This originates from 0024-Add-pie-to-linker-option.patch

4 years ago[Tizen] Add support for GBS
junghyuk.park [Mon, 25 Jun 2018 09:47:41 +0000 (18:47 +0900)]
[Tizen] Add support for GBS

4 years ago[Tizen] Add prebuilt libicu-57.1 libraries
junghyuk.park [Mon, 25 Jun 2018 07:03:57 +0000 (16:03 +0900)]
[Tizen] Add prebuilt libicu-57.1 libraries

4 years ago[Tizen] Add BuildTools v3.1.3
Gleb Balykov [Tue, 10 Mar 2020 16:22:08 +0000 (19:22 +0300)]
[Tizen] Add BuildTools v3.1.3

4 years ago[3.1] Fail FuncEval if slot backpatching lock is held by any thread (#28006)
Koundinya Veluri [Tue, 18 Feb 2020 21:46:37 +0000 (16:46 -0500)]
[3.1] Fail FuncEval if slot backpatching lock is held by any thread (#28006)

- In many cases cooperative GC mode is entered after acquiring the slot backpatching lock and the thread may block for debugger suspension while holding the lock. A FuncEval may time out on entering the lock if for example it calls a virtual or interface method for the first time. Failing the FuncEval when the lock is held enables the debugger to fall back to other options for expression evaluation.
- Also added polls for debugger suspension before acquiring the slot backpatching lock on background threads that often operate in preemptive GC mode. A common case is when the debugger breaks while the tiering delay timer is active, the timer ticks shortly afterwards (after debugger suspension completes) and if a thread pool thread is already available, the background thread would block while holding the lock. The poll checks for debugger suspension and pulses the GC mode to block before acquiring the lock.

Risks:
- The fix is only a heuristic and lessens the problem when it is detected that the lock is held by some thread. Since the lock is acquired in preemptive GC mode, it is still possible that after the check at the start of a FuncEval, another thread acquires the lock and the FuncEval may time out. The polling makes it less likely for the lock to be taken by background tiering work, for example if a FuncEval starts while rejitting a method.
- The expression evaluation experience may be worse when it is detected that the lock is held, and may still happen from unfortunate timing
- Low risk for the change itself

Port of https://github.com/dotnet/runtime/pull/2380
Fix for https://github.com/dotnet/runtime/issues/1537

4 years agoPort dotnet/runtime#31946 to release/3.1 branch (#28014)
Levi Broderick [Tue, 18 Feb 2020 21:32:57 +0000 (13:32 -0800)]
Port dotnet/runtime#31946 to release/3.1 branch (#28014)

When string.Replace is given a target string with zero collation weight, it would enter an infinite loop. It is now changed so that the call to Replace terminates when such a condition is encountered.

4 years agoFix AppDomain.SetPrincipalPolicy bug for new threads (#32104) (#28019)
Eirik Tsarpalis [Tue, 18 Feb 2020 21:31:53 +0000 (21:31 +0000)]
Fix AppDomain.SetPrincipalPolicy bug for new threads (#32104) (#28019)

* fix principal policy for new threads

Fixes #31717

Co-authored-by: Marco Rossignoli <marco.rossignoli@gmail.com>
4 years agoFix build on systems with glibc >= 2.30 (#28012)
Omair Majid [Tue, 18 Feb 2020 18:27:24 +0000 (13:27 -0500)]
Fix build on systems with glibc >= 2.30 (#28012)

On newer systems with glibc 2.30, the compiler emits a warning:

    In file included from coreclr/src/pal/src/misc/sysinfo.cpp:32:
    /usr/include/sys/sysctl.h:21:2: error: "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror,-W#warnings]
    #warning "The <sys/sysctl.h> header is deprecated and will be removed."
     ^

The glibc 2.30 release notes cover this at
https://sourceware.org/ml/libc-alpha/2019-08/msg00029.html:

* The Linux-specific <sys/sysctl.h> header and the sysctl function have been
  deprecated and will be removed from a future version of glibc.
  Application should directly access /proc instead.  For obtaining random
  bits, the getentropy function can be used.

To keep coreclr release/3.1 building, disable treating the #warning as an
error. Clang and GCC have separate flags to turn this error off.