Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit f16e13d

Browse files
committed
Merge branch 'FXCIUnix' of https://github.com/A-And/coreclr into FXCIUnix
2 parents 304939d + 1e87033 commit f16e13d

File tree

312 files changed

+8885
-3540
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

312 files changed

+8885
-3540
lines changed

BuildToolsVersion.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.0-preview1-02920-01
1+
2.2.0-preview1-03002-01

Documentation/building/linux-instructions.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ In order to get clang-3.9, llvm-3.9 and lldb-3.9 on Ubuntu 14.04, we need to add
3838
~$ wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
3939
~$ sudo apt-get update
4040

41-
Note: arm clang has a known issue with CompareExchange (#15074), so for arm you have to use clang-4.0 or higher, the official build uses clang-5.0.
42-
41+
Note: ARM clang has a known issue with CompareExchange ([#15074](https://github.com/dotnet/coreclr/issues/15074)), so for ARM you must use clang-4.0 or higher. The official build uses clang-5.0.
42+
4343
For other version of Debian/Ubuntu, please visit http://apt.llvm.org/.
4444

4545
Then install the packages you need:
@@ -98,6 +98,29 @@ After the build is complete you will be able to find the output in the `bin` fol
9898
Build for ARM/Linux
9999
===================
100100

101+
The CI system and official builds use Docker to build ARM for Linux (for example, see the latest build [here](https://ci.dot.net/job/dotnet_coreclr/job/master/job/arm_cross_checked_ubuntu/lastSuccessfulBuild/consoleText)). The Docker container has pre-built rootfs directories containing the required tools. To build this way, do the following:
102+
103+
* Install Docker, probably Community Edition, on Windows, Mac, or Linux, from https://www.docker.com/. Some useful post-install setup is:
104+
* Linux: add your user to the docker group, this will avoid running docker with `sudo`:
105+
106+
`sudo usermod -a <your account name> -G docker`
107+
108+
* Windows: switch to Linux containers. This can be done by right clicking on the Docker icon in the lower right corner and clicking "Switch to Linux containers".
109+
* Build using the Docker container (this is a `bash` script, for simplicity):
110+
111+
```
112+
ROOT=/Users/me/git/coreclr
113+
DOCKER_ARGS="run -i --rm -v ${ROOT}:/mnt/coreclr -w /mnt/coreclr -e ROOTFS_DIR=/crossrootfs/arm -e CAC_ROOTFS_DIR=/crossrootfs/x86 microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-e435274-20180426002420"
114+
docker ${DOCKER_ARGS} /mnt/coreclr/build.sh arm checked cross crosscomponent
115+
docker ${DOCKER_ARGS} /mnt/coreclr/build-test.sh arm checked cross generatelayoutonly
116+
```
117+
118+
Make sure you update the `ROOT` environment to point to your git clone of the coreclr repo.
119+
120+
The current Docker tag being used by the CI can be found in the `getDockerImageName` function in the [netci.groovy](https://github.com/dotnet/coreclr/blob/master/netci.groovy) file.
121+
122+
Libunwind issue
123+
---------------
101124
Libunwind-arm requires fixes that are not included in Ubuntu 14.04, yet. The fix allows libunwind-arm not to break when it is ordered to access unaccessible memory locations.
102125

103126
First, import the patch from the libunwind upstream: http://git.savannah.gnu.org/gitweb/?p=libunwind.git;a=commit;h=770152268807e460184b4152e23aba9c86601090
@@ -124,7 +147,7 @@ index 1ed3dbf..c643032 100644
124147
```
125148

126149
Additional optimization levels for ARM/Linux: -Oz and -Ofast
127-
============================================================
150+
------------------------------------------------------------
128151

129152
This instruction is to enable additional optimization levels such as -Oz and -Ofast on ARM/Linux. The below table shows what we have to enable for the code optimization of the CoreCLR run-time either the size or speed on embedded devices.
130153

Documentation/coding-guidelines/clr-jit-coding-conventions.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ Note that these conventions are different from the CLR C++ Coding Conventions, d
125125
* [15.5.9 Global class objects](#15.5.9)
126126
* [15.6 Exceptions](#15.6)
127127
* [15.7 Code tuning for performance optimization](#15.7)
128-
* [15.8 Obsoleting functions, classes and macros](#15.8)
128+
* [15.8 Memory allocation](#15.8)
129+
* [15.9 Obsoleting functions, classes and macros](#15.9)
129130

130131
# <a name="4"/>4 Principles
131132

@@ -1938,7 +1939,45 @@ In general, code should be written to be readable first, and optimized for perfo
19381939
19391940
In the case of tight loops and code that has been analyzed to be a performance bottleneck, performance optimizations take a higher priority. Talk to the performance team if in doubt.
19401941
1941-
## <a name="15.8"/>15.8 Obsoleting functions, classes and macros
1942+
## <a name="15.8"/>15.8 Memory allocation
1943+
1944+
All memory required during the compilation of a method must be allocated using the `Compiler`'s arena allocator. This allocator takes care of deallocating all the memory when compilation ends, avoiding memory leaks and simplifying memory management.
1945+
1946+
However, the use of an arena allocator can increase memory usage and it's worth considering its impact when writing JIT code. Simple code changes can have a significant impact on memory usage, such as hoisting a `std::vector` variable out of a loop:
1947+
```c++
1948+
std::vector<int> outer; // same memory gets used for all iterations
1949+
for (...)
1950+
{
1951+
std::vector<int> inner; // this will allocate memory on every iteration
1952+
// and previously allocated memory is simply wasted
1953+
}
1954+
```
1955+
Node based data structures (e.g linked lists) may benefit from retaining and reusing removed nodes, provided that maintaining free lists doesn't add significant cost.
1956+
1957+
The arena allocator should not be used directly. `Compiler::getAllocator(CompMemKind)` returns a `CompAllocator` object that wraps the arena allocator and supports memory usage tracking when `MEASURE_MEM_ALLOC` is enabled. It's best to use a meaningful memory kind (e.g. not `CMK_Generic`) but exceptions can be made for small allocations. `CompAllocator` objects are always pointer sized and can be freely copied and stored (useful to avoid repeated `CompMemKind` references).
1958+
1959+
The `new (CompAllocator)` operator should be preferred over `CompAllocator::allocate(size_t)`. The later is intended to be used only when constructors must not be run, such as when allocating arrays for containers like `std::vector`.
1960+
```c++
1961+
// typical object allocation
1962+
RangeCheck* p = new (compiler->getAllocator(CMK_RangeCheck)) RangeCheck(compiler);
1963+
// slightly shorter alternative
1964+
RangeCheck* p = new (compiler, CMK_RangeCheck) RangeCheck(compiler);
1965+
// allocate an array with default initialized elements
1966+
LclVarDsc* p = new (compiler->getAllocator(CMK_LvaTable)) LclVarDsc[lvaCount];
1967+
// use list initialization to zero out an array
1968+
unsigned* p = new (compiler->getAllocator(CMK_LvaTable)) unsigned[lvaTrackedCount] { };
1969+
// use CompAllocator::allocate to allocate memory without doing any initialization...
1970+
LclVarDsc* p = compiler->getAllocator(CMK_LvaTable).allocate<LclVarDsc>(lvaCount);
1971+
// ... and construct elements in place as needed
1972+
new (&p[i], jitstd::placement_t()) LclVarDsc(compiler)
1973+
```
1974+
Note that certain classes (e.g. `GenTree`) provide their own `new` operator overloads, those should be used instead of the general purpose `new (CompAllocator)` operator.
1975+
1976+
`jitstd` container classes accept a `CompAllocator` object by implicit conversion from `CompAllocator` to `jitstd::allocator`.
1977+
1978+
Debug/checked code that needs to allocate memory outside of method compilation can use the `HostAllocator` class and the associated `new` operator. This is a normal memory allocator that requires manual memory deallocation.
1979+
1980+
## <a name="15.9"/>15.9 Obsoleting functions, classes and macros
19421981
19431982
The Visual C++ compiler has support built in for marking various user defined constructs as deprecated. This functionality is accessed via one of two mechanisms:
19441983

ILAsmVersion.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.0-preview1-26621-01
1+
3.0.0-preview1-26703-04

build-test.cmd

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,19 @@ REM ===
358358
REM === Create the test overlay
359359
REM ===
360360
REM =========================================================================================
361+
362+
set RuntimeIdArg=
363+
if defined __RuntimeId (
364+
set RuntimeIdArg=-RuntimeID="%__RuntimeId%"
365+
)
366+
367+
set TargetsWindowsArg=
368+
if "%__TargetsWindows%"=="1" (
369+
set TargetsWindowsArg=-TargetsWindows=true
370+
) else if "%__TargetsWindows%"=="0" (
371+
set TargetsWindowsArg=-TargetsWindows=false
372+
)
373+
361374
echo %__MsgPrefix%Creating test overlay...
362375

363376
set __BuildLogRootName=Tests_Overlay_Managed
@@ -403,19 +416,6 @@ if defined __SkipManaged goto SkipBuildingWrappers
403416

404417
echo %__MsgPrefix%Creating test wrappers...
405418

406-
set RuntimeIdArg=
407-
set TargetsWindowsArg=
408-
409-
if defined __RuntimeId (
410-
set RuntimeIdArg=-RuntimeID="%__RuntimeId%"
411-
)
412-
413-
if "%__TargetsWindows%"=="1" (
414-
set TargetsWindowsArg=-TargetsWindows=true
415-
) else if "%__TargetsWindows%"=="0" (
416-
set TargetsWindowsArg=-TargetsWindows=false
417-
)
418-
419419
set __BuildLogRootName=Tests_XunitWrapper
420420
set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
421421
set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn

build-test.sh

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -193,25 +193,18 @@ generate_layout()
193193

194194
generate_testhost()
195195
{
196-
generate_corefx_helpers
197196
export TEST_HOST=$xUnitTestBinBase/testhost
198197

199198
if [ -d "${TEST_HOST}" ]; then
200199
rm -rf $TEST_HOST
201200
fi
202-
201+
202+
echo "${__MsgPrefix}Creating test overlay..."
203203
mkdir -p $TEST_HOST
204204

205205
build_Tests_internal "Tests_Generate_TestHost" "${__ProjectDir}/tests/runtest.proj" "-testHost" "Creating test host"
206206
}
207207

208-
generate_corefx_helpers()
209-
{
210-
local coreFXTestSetupUtilityName=CoreFX.TestUtils.TestFileSetup
211-
local coreFXTestSetupUtility="${__ProjectDir}/tests/src/Common/CoreFX/TestFileSetup/${coreFXTestSetupUtilityName}.csproj"
212-
213-
build_Tests_internal "${coreFXTestSetupUtilityName}" "${coreFXTestSetupUtility}" " " "Building CoreFX Test Helper Projects"
214-
}
215208

216209
build_Tests()
217210
{
@@ -767,22 +760,21 @@ fi
767760
# Specify path to be set for CMAKE_INSTALL_PREFIX.
768761
# This is where all built CoreClr libraries will copied to.
769762
export __CMakeBinDir="$__BinDir"
770-
echo check for $__BinDir
771-
if [ ! -d "$__BinDir" ]; then
763+
if [ [ ! -d "$__BinDir" ] || [ ! -d "$__BinDir/bin" ] ]; then
764+
if [ [ -z "$__GenerateLayoutOnly" ] && -z [ "$__GenerateTestHostOnly" ] ]; then
772765

773-
echo "Cannot find build directory for the CoreCLR Product."
774-
echo "Please make sure CoreCLR and native tests are built before building managed tests."
775-
echo "Example use: './build.sh $__BuildArch $__BuildType' "
766+
echo "Cannot find build directory for the CoreCLR native tests."
767+
echo "Please make sure native tests are built before building managed tests."
768+
echo "Example use: './build.sh $__BuildArch $__BuildType' without -skiptests switch"
769+
else
770+
echo "Cannot find build directory for the CoreCLR Product."
771+
echo "Please make sure CoreCLR and native tests are built before building managed tests."
772+
echo "Example use: './build.sh $__BuildArch $__BuildType' "
773+
fi
776774
exit 1
777775
fi
778776

779-
if [[ (-z "$__GenerateLayoutOnly") && (-z "$__GenerateTestHostOnly") && (! -d "$__BinDir/bin") ]]; then
780-
781-
echo "Cannot find build directory for the CoreCLR native tests."
782-
echo "Please make sure native tests are built before building managed tests."
783-
echo "Example use: './build.sh $__BuildArch $__BuildType' without -skiptests switch"
784-
exit 1
785-
fi
777+
786778

787779
# Configure environment if we are doing a cross compile.
788780
if [ $__CrossBuild == 1 ]; then

clrdefinitions.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ add_definitions(-DFEATURE_STRONGNAME_MIGRATION)
195195
if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
196196
add_definitions(-DFEATURE_STUBS_AS_IL)
197197
endif ()
198+
if (FEATURE_NGEN_RELOCS_OPTIMIZATIONS)
199+
add_definitions(-DFEATURE_NGEN_RELOCS_OPTIMIZATIONS)
200+
endif(FEATURE_NGEN_RELOCS_OPTIMIZATIONS)
198201
add_definitions(-DFEATURE_SVR_GC)
199202
add_definitions(-DFEATURE_SYMDIFF)
200203
add_definitions(-DFEATURE_TIERED_COMPILATION)

cross/armel/tizen-fetch.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ if [ ! -d $TMPDIR ]; then
5151
mkdir -p $TMPDIR
5252
fi
5353

54-
TIZEN_URL=http://download.tizen.org/snapshots/tizen
54+
TIZEN_URL=http://download.tizen.org/releases/milestone/tizen
5555
BUILD_XML=build.xml
5656
REPOMD_XML=repomd.xml
5757
PRIMARY_XML=primary.xml
@@ -154,8 +154,8 @@ fetch_tizen_pkgs()
154154
done
155155
}
156156

157-
Inform "Initialize arm 4.0-base"
158-
fetch_tizen_pkgs_init arm 4.0-base
157+
Inform "Initialize arm base"
158+
fetch_tizen_pkgs_init standard base
159159
Inform "fetch common packages"
160160
fetch_tizen_pkgs armv7l gcc glibc glibc-devel libicu libicu-devel
161161
fetch_tizen_pkgs noarch linux-glibc-devel
@@ -164,8 +164,8 @@ fetch_tizen_pkgs armv7l lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwi
164164
Inform "fetch corefx packages"
165165
fetch_tizen_pkgs armv7l libcom_err libcom_err-devel zlib zlib-devel libopenssl libopenssl-devel krb5 krb5-devel libcurl libcurl-devel
166166

167-
Inform "Initialize standard 4.0-unified"
168-
fetch_tizen_pkgs_init standard 4.0-unified
167+
Inform "Initialize standard unified"
168+
fetch_tizen_pkgs_init standard unified
169169
Inform "fetch corefx packages"
170170
fetch_tizen_pkgs armv7l gssdp gssdp-devel
171171

cross/armel/tizen/tizen-dotnet.ks

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ rootpw tizen
88
desktop --autologinuser=root
99
user --name root --groups audio,video --password 'tizen'
1010

11-
repo --name=standard --baseurl=http://download.tizen.org/snapshots/tizen/4.0-unified/latest/repos/standard/packages/ --ssl_verify=no
12-
repo --name=base --baseurl=http://download.tizen.org/snapshots/tizen/4.0-base/latest/repos/arm/packages/ --ssl_verify=no
11+
repo --name=standard --baseurl=http://download.tizen.org/releases/milestone/tizen/unified/latest/repos/standard/packages/ --ssl_verify=no
12+
repo --name=base --baseurl=http://download.tizen.org/releases/milestone/tizen/base/latest/repos/standard/packages/ --ssl_verify=no
1313

1414
%packages
1515
tar

dependencies.props

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@
2323

2424
<!-- Source of truth for dependency tooling: the commit hash of the dotnet/versions master branch as of the last auto-upgrade. -->
2525
<PropertyGroup>
26-
<CoreFxCurrentRef>232e7f9230fcc7c6c8ea8c955e113f897403a0e7</CoreFxCurrentRef>
27-
<CoreClrCurrentRef>232e7f9230fcc7c6c8ea8c955e113f897403a0e7</CoreClrCurrentRef>
28-
<BuildToolsCurrentRef>3b09a6a5fd370dfb8b7af43ca0a93114efdaa0a1</BuildToolsCurrentRef>
29-
<PgoDataCurrentRef>1f57485574742714a2401175bce892597bbf86bb</PgoDataCurrentRef>
26+
<CoreFxCurrentRef>70c44f38436f4ae4734e792e06cefba1e412f9fc</CoreFxCurrentRef>
27+
<CoreClrCurrentRef>d8a64e527e67cae4bb3c9d93379fd43aa317165b</CoreClrCurrentRef>
28+
<BuildToolsCurrentRef>3b2844e866d3898d43d98aad0e3e57dd5675d259</BuildToolsCurrentRef>
29+
<PgoDataCurrentRef>d8a64e527e67cae4bb3c9d93379fd43aa317165b</PgoDataCurrentRef>
3030
</PropertyGroup>
3131

3232
<!-- Tests/infrastructure dependency versions. -->
3333
<PropertyGroup>
34-
<MicrosoftPrivateCoreFxNETCoreAppPackageVersion>4.6.0-preview1-26621-01</MicrosoftPrivateCoreFxNETCoreAppPackageVersion>
35-
<MicrosoftNETCorePlatformsPackageVersion>2.2.0-preview1-26621-01</MicrosoftNETCorePlatformsPackageVersion>
36-
<PgoDataPackageVersion>99.99.99-master-20180621-0050</PgoDataPackageVersion>
37-
<MicrosoftNETCoreRuntimeCoreCLRPackageVersion>2.2.0-preview1-26621-01</MicrosoftNETCoreRuntimeCoreCLRPackageVersion>
34+
<MicrosoftPrivateCoreFxNETCoreAppPackageVersion>4.6.0-preview1-26628-03</MicrosoftPrivateCoreFxNETCoreAppPackageVersion>
35+
<MicrosoftNETCorePlatformsPackageVersion>3.0.0-preview1-26628-03</MicrosoftNETCorePlatformsPackageVersion>
36+
<PgoDataPackageVersion>99.99.99-master-20180703-0030</PgoDataPackageVersion>
37+
<MicrosoftNETCoreRuntimeCoreCLRPackageVersion>3.0.0-preview1-26703-04</MicrosoftNETCoreRuntimeCoreCLRPackageVersion>
3838
<XunitPackageVersion>2.2.0-beta2-build3300</XunitPackageVersion>
3939
<XunitConsoleNetcorePackageVersion>2.2.0-preview1-02830-02</XunitConsoleNetcorePackageVersion>
4040
<XunitPerformanceApiPackageVersion>1.0.0-beta-build0015</XunitPerformanceApiPackageVersion>
@@ -51,7 +51,7 @@
5151
<!-- Package versions used as toolsets -->
5252
<PropertyGroup>
5353
<FeedTasksPackage>Microsoft.DotNet.Build.Tasks.Feed</FeedTasksPackage>
54-
<FeedTasksPackageVersion>2.2.0-preview1-02920-01</FeedTasksPackageVersion>
54+
<FeedTasksPackageVersion>2.2.0-preview1-03002-01</FeedTasksPackageVersion>
5555
</PropertyGroup>
5656

5757
<!-- Publish symbol build task package -->

0 commit comments

Comments
 (0)