Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions buildscripts/build-managed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ build_managed_corert()
ToolchainMilestone=testing
fi

$__ProjectRoot/Tools/msbuild.sh "$__buildproj" /m /nologo /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__buildlog" /t:Build /p:RepoPath=$__ProjectRoot /p:RepoLocalBuild="true" /p:RelativeProductBinDir=$__RelativeProductBinDir /p:CleanedTheBuild=$__CleanBuild /p:NuPkgRid=$__NugetRuntimeId /p:TestNugetRuntimeId=$__NugetRuntimeId /p:OSGroup=$__BuildOS /p:Configuration=$__BuildType /p:Platform=$__BuildArch /p:COMPUTERNAME=$(hostname) /p:USERNAME=$(id -un) /p:ToolchainMilestone=${ToolchainMilestone} $__UnprocessedBuildArgs $__ExtraMsBuildArgs
__buildarch="$__BuildArch"
if [ "$__buildarch" = "armel" ]; then
__buildarch=arm
__ExtraMsBuildArgs="$__ExtraMsBuildArgs /p:BinDirPlatform=armel"
fi

$__ProjectRoot/Tools/msbuild.sh "$__buildproj" /m /nologo /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__buildlog" /t:Build /p:RepoPath=$__ProjectRoot /p:RepoLocalBuild="true" /p:RelativeProductBinDir=$__RelativeProductBinDir /p:CleanedTheBuild=$__CleanBuild /p:NuPkgRid=$__NugetRuntimeId /p:TestNugetRuntimeId=$__NugetRuntimeId /p:OSGroup=$__BuildOS /p:Configuration=$__BuildType /p:Platform=$__buildarch /p:COMPUTERNAME=$(hostname) /p:USERNAME=$(id -un) /p:ToolchainMilestone=${ToolchainMilestone} $__UnprocessedBuildArgs $__ExtraMsBuildArgs
export BUILDERRORLEVEL=$?

echo
Expand All @@ -56,4 +62,4 @@ if $__buildmanaged; then
build_managed_corert

# Build complete
fi
fi
4 changes: 2 additions & 2 deletions buildscripts/build-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ if [ "$BUILDVARS_DONE" != 1 ]; then
fi

pushd ${__ProjectRoot}/tests
source ${__ProjectRoot}/tests/runtest.sh $__BuildOS $__BuildArch $__BuildType -dotnetclipath $__dotnetclipath
source ${__ProjectRoot}/tests/runtest.sh $__BuildOS $__BuildArch $__BuildType -cross $__CrossBuild -dotnetclipath $__dotnetclipath
TESTERRORLEVEL=$?
popd
if [ $TESTERRORLEVEL != 0 ]; then
exit $TESTERRORLEVEL
fi
fi
83 changes: 83 additions & 0 deletions src/Native/Runtime/arm/AllocFast.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,87 @@

#include <unixasmmacros.inc>

.syntax unified
.thumb

// TODO: Implement Arm support

// Allocate non-array, non-finalizable object. If the allocation doesn't fit into the current thread's
// allocation context then automatically fallback to the slow allocation path.
// r0 == EEType
LEAF_ENTRY RhpNewFast, _TEXT
#ifdef _DEBUG
bl C_FUNC(NYI_Assert)
#endif
LEAF_END RhpNewFast, _TEXT

// Allocate non-array object with finalizer.
// r0 == EEType
LEAF_ENTRY RhpNewFinalizable, _TEXT
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to make the implementation breakpoint to get nice crash for unimplemented parts once you start running the programs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas Added breakpoints

#ifdef _DEBUG
bl C_FUNC(NYI_Assert)
#endif
LEAF_END RhpNewFinalizable, _TEXT

// Allocate non-array object.
// r0 == EEType
// r1 == alloc flags
NESTED_ENTRY RhpNewObject, _TEXT, NoHandler
#ifdef _DEBUG
bl C_FUNC(NYI_Assert)
#endif
NESTED_END RhpNewObject, _TEXT

// Allocate one dimensional, zero based array (SZARRAY).
// r0 == EEType
// r1 == element count
LEAF_ENTRY RhpNewArray, _TEXT
#ifdef _DEBUG
bl C_FUNC(NYI_Assert)
#endif
LEAF_END RhpNewArray, _TEXT

// Allocate one dimensional, zero based array (SZARRAY) using the slow path that calls a runtime helper.
// r0 == EEType
// r1 == element count
// r2 == array size + Thread::m_alloc_context::alloc_ptr
// r3 == Thread
NESTED_ENTRY RhpNewArrayRare, _TEXT, NoHandler
#ifdef _DEBUG
bl C_FUNC(NYI_Assert)
#endif
NESTED_END RhpNewArrayRare, _TEXT

// Allocate simple object (not finalizable, array or value type) on an 8 byte boundary.
// r0 == EEType
LEAF_ENTRY RhpNewFastAlign8, _TEXT
#ifdef _DEBUG
bl C_FUNC(NYI_Assert)
#endif
LEAF_END RhpNewFastAlign8, _TEXT

// Allocate a finalizable object (by definition not an array or value type) on an 8 byte boundary.
// r0 == EEType
LEAF_ENTRY RhpNewFinalizableAlign8, _TEXT
#ifdef _DEBUG
bl C_FUNC(NYI_Assert)
#endif
LEAF_END RhpNewFinalizableAlign8, _TEXT

// Allocate a value type object (i.e. box it) on an 8 byte boundary + 4 (so that the value type payload
// itself is 8 byte aligned).
// r0 == EEType
LEAF_ENTRY RhpNewFastMisalign, _TEXT
#ifdef _DEBUG
bl C_FUNC(NYI_Assert)
#endif
LEAF_END RhpNewFastMisalign, _TEXT

// Allocate an array on an 8 byte boundary.
// r0 == EEType
// r1 == element count
NESTED_ENTRY RhpNewArrayAlign8, _TEXT, NoHandler
#ifdef _DEBUG
bl C_FUNC(NYI_Assert)
#endif
NESTED_END RhpNewArrayAlign8, _TEXT
30 changes: 30 additions & 0 deletions src/Native/Runtime/portable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,36 @@ COOP_PINVOKE_HELPER(Array *, RhpNewArray, (EEType * pArrayEEType, int numElement
return pObject;
}

#ifdef _ARM_
COOP_PINVOKE_HELPER(Object *, RhpNewFinalizableAlign8, (EEType* pEEType))
{
Object * pObject = nullptr;
/* TODO */ ASSERT_UNCONDITIONALLY("NYI");
return pObject;
}

COOP_PINVOKE_HELPER(Object *, RhpNewFastMisalign, (EEType* pEEType))
{
Object * pObject = nullptr;
/* TODO */ ASSERT_UNCONDITIONALLY("NYI");
return pObject;
}

COOP_PINVOKE_HELPER(Object *, RhpNewFastAlign8, (EEType* pEEType))
{
Object * pObject = nullptr;
/* TODO */ ASSERT_UNCONDITIONALLY("NYI");
return pObject;
}

COOP_PINVOKE_HELPER(Array *, RhpNewArrayAlign8, (EEType * pArrayEEType, int numElements))
{
Array * pObject = nullptr;
/* TODO */ ASSERT_UNCONDITIONALLY("NYI");
return pObject;
}
#endif

//
// PInvoke
//
Expand Down
4 changes: 4 additions & 0 deletions src/Native/Runtime/rhassert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,8 @@ void Assert(const char * expr, const char * file, UInt32 line_num, const char *
#endif //!DACCESS_COMPILE
}

void NYI_Assert()
{
ASSERT_UNCONDITIONALLY("NYI");
}
#endif // _DEBUG
2 changes: 2 additions & 0 deletions src/Native/Runtime/rhassert.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

void Assert(const char * expr, const char * file, unsigned int line_num, const char * message);

void NYI_Assert();

#else

#define ASSERT(expr)
Expand Down
6 changes: 3 additions & 3 deletions tests/runtest.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ goto :eof
)
)

echo msbuild /m /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%CoreRT_ToolchainDir%" "/p:Configuration=%CoreRT_BuildType%" "/p:RepoLocalBuild=true" "/p:FrameworkLibPath=%~dp0\..\bin\Product\%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%\lib" "/p:FrameworkObjPath=%~dp0\..\bin\obj\Product\%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%\Framework" !extraArgs! !__SourceFile!.csproj
echo msbuild /m /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%CoreRT_ToolchainDir%" "/p:Configuration=%CoreRT_BuildType%" "/p:Platform=%CoreRT_BuildArch%" "/p:RepoLocalBuild=true" "/p:FrameworkLibPath=%~dp0\..\bin\Product\%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%\lib" "/p:FrameworkObjPath=%~dp0\..\bin\obj\Product\%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%\Framework" !extraArgs! !__SourceFile!.csproj
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Indentation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas fixed

echo.
msbuild /m /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%CoreRT_ToolchainDir%" "/p:Configuration=%CoreRT_BuildType%" "/p:RepoLocalBuild=true" "/p:FrameworkLibPath=%~dp0\..\bin\Product\%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%\lib" "/p:FrameworkObjPath=%~dp0\..\bin\obj\Product\%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%\Framework" !extraArgs! !__SourceFile!.csproj
msbuild /m /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%CoreRT_ToolchainDir%" "/p:Configuration=%CoreRT_BuildType%" "/p:Platform=%CoreRT_BuildArch%" "/p:RepoLocalBuild=true" "/p:FrameworkLibPath=%~dp0\..\bin\Product\%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%\lib" "/p:FrameworkObjPath=%~dp0\..\bin\obj\Product\%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%\Framework" !extraArgs! !__SourceFile!.csproj
endlocal

set __SavedErrorLevel=%ErrorLevel%
Expand All @@ -218,7 +218,7 @@ goto :eof
if "%__SavedErrorLevel%"=="0" (
echo.
echo Running test !__SourceFileName!
call !__SourceFile!.cmd !__SourceFolder!\bin\%CoreRT_BuildType%\native !__SourceFileName!.exe
call !__SourceFile!.cmd !__SourceFolder!\bin\%CoreRT_BuildType%\%CoreRT_BuildArch%\native !__SourceFileName!.exe
set __SavedErrorLevel=!ErrorLevel!
)

Expand Down
79 changes: 73 additions & 6 deletions tests/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,42 @@ runtest()
__SourceFolder=$1
__SourceFileName=$2
__SourceFile=${__SourceFolder}/${__SourceFileName}
${__SourceFile}.sh $1/bin/${CoreRT_BuildType}/native $2
${__SourceFile}.sh $1/bin/${CoreRT_BuildType}/${CoreRT_BuildArch}/native $2
return $?
}

run_test_dir()
{
local __test_dir=$1
local __mode=$2
local __extra_cxxflags=$3
local __extra_linkflags=$4
local __dir_path=`dirname ${__test_dir}`
local __filename=`basename ${__dir_path}`
local __extra_args=""
if [ "${__mode}" = "Cpp" ]; then
__extra_args="${__extra_args} /p:NativeCodeGen=cpp"
__extra_args="${__extra_args} /p:NativeCodeGen=cpp"
fi
if [ -n "${__extra_cxxflags}" ]; then
__extra_cxxflags="/p:AdditionalCppCompilerFlags=\"${__extra_cxxflags}\""
fi
if [ -n "${__extra_cxxflags}" ]; then
__extra_linkflags="/p:AdditionalLinkerFlags=\"${__extra_linkflags}\""
fi

rm -rf ${__dir_path}/bin ${__dir_path}/obj

local __msbuild_dir=${CoreRT_TestRoot}/../Tools
echo ${__msbuild_dir}/msbuild.sh /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} /p:RepoLocalBuild=true ${__extra_args} ${__dir_path}/${__filename}.csproj
${__msbuild_dir}/msbuild.sh /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} /p:RepoLocalBuild=true ${__extra_args} ${__dir_path}/${__filename}.csproj
echo ${__msbuild_dir}/dotnetcli/dotnet ${__msbuild_dir}/MSBuild.exe /ds /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} /p:Platform=${CoreRT_BuildArch} /p:RepoLocalBuild=true ${__extra_args} "${__extra_cxxflags}" "${__extra_linkflags}" ${__dir_path}/${__filename}.csproj
${__msbuild_dir}/dotnetcli/dotnet ${__msbuild_dir}/MSBuild.exe /ds /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} /p:Platform=${CoreRT_BuildArch} /p:RepoLocalBuild=true ${__extra_args} "${__extra_cxxflags}" "${__extra_linkflags}" ${__dir_path}/${__filename}.csproj

runtest ${__dir_path} ${__filename}
local __exitcode=$?

if [ ${CoreRT_TestRun} == true ]; then
runtest ${__dir_path} ${__filename}
__exitcode=$?
fi

if [ ${__exitcode} == 0 ]; then
local __pass_var=__${__mode}PassedTests
eval ${__pass_var}=$((${__pass_var} + 1))
Expand Down Expand Up @@ -122,6 +135,9 @@ CoreRT_BuildArch=x64
CoreRT_BuildType=Debug
CoreRT_TestRun=true
CoreRT_TestCompileMode=ryujit
CoreRT_CrossRootFS=
CoreRT_CrossCXXFlags=
CoreRT_CrossLinkerFlags=

while [ "$1" != "" ]; do
lowerI="$(echo $1 | awk '{print tolower($0)}')"
Expand All @@ -139,6 +155,9 @@ while [ "$1" != "" ]; do
arm)
CoreRT_BuildArch=arm
;;
armel)
CoreRT_BuildArch=armel
;;
arm64)
CoreRT_BuildArch=arm64
;;
Expand All @@ -160,6 +179,10 @@ while [ "$1" != "" ]; do
shift
CoreRT_CliBinDir=$1
;;
-cross)
shift
CoreRT_CrossBuild=$1
;;
-coreclr)
CoreRT_RunCoreCLRTests=true;
shift
Expand All @@ -178,6 +201,50 @@ while [ "$1" != "" ]; do
shift
done

CoreRT_ExtraCXXFlags=
CoreRT_ExtraLinkFlags=
if [ ${CoreRT_CrossBuild} != 0 ]; then
CoreRT_TestRun=false
CoreRT_CrossRootFS=${CoreRT_TestRoot}/../cross/rootfs/${CoreRT_BuildArch}
# all values are brought from the appropriate toolchain.cmake's
case $CoreRT_BuildArch in
arm)
CoreRT_CrossCXXFlags="-target armv7-linux-gnueabihf -mthumb -mfpu=vfpv3 --sysroot=${CoreRT_CrossRootFS}"
CoreRT_CrossLinkerFlags="-target arm-linux-gnueabihf -B ${CoreRT_CrossRootFS}/usr/lib/gcc/arm-linux-gnueabihf `
`-L${CorRT_CrossRootFS}/lib/arm-linux-gnueabihf --sysroot=${CoreRT_CrossRootFS}"
;;
arm64)
CoreRT_CrossCXXFlags="-target aarch64-linux-gnu --sysroot=${CoreRT_CrossRootFS}"
CoreRT_CrossLinkerFlags="-target aarch64-linux-gnu -B ${CoreRT_CrossRootFS}/usr/lib/gcc/aarch64-linux-gnu `
`-L${CoreRT_CrossRootFS}/lib/aarch64-linux-gnu --sysroot=${CoreRT_CrossRootFS}"
;;
armel)
CoreRT_CrossCXXFlags="-target armv7-linux-gnueabi -mthumb -mfpu=vfpv3 -mfloat-abi=softfp --sysroot=${CoreRT_CrossRootFS}"
CoreRT_CrossLinkerFlags="-target arm-linux-gnueabi --sysroot=${CoreRT_CrossRootFS}"
ID=
if [ -e $ROOTFS_DIR/etc/os-release ]; then
source $ROOTFS_DIR/etc/os-release
fi
if [ "$ID" = "tizen" ]; then
CoreRT_CrossCXXFlags="${CoreRT_CrossCXXFlags} -isystem ${CoreRT_CrossRootFS}/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/include/c++ `
`-isystem ${CoreRT_CrossRootFS}//usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/include/c++/armv7l-tizen-linux-gnueabi `
`-isystem ${CoreRT_CrossRootFS}/armel/usr/include"
TIZEN_TOOLCHAIN="armv7l-tizen-linux-gnueabi/4.9.2"
CoreRT_CrossLinkerFlags="${CoreRT_CrossLinkerFlags} -B${CoreRT_CrossRootFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN} `
`-L${CoreRT_CrossRootFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}"
else
TOOLCHAIN="arm-linux-gnueabi"
CoreRT_CrossCXXFlags="${CoreRT_CrossCXXFlags} -isystem ${CoreRT_CrossRootFS}/usr/include/c++/4.9 `
`-isystem ${CoreRT_CrossRootFS}/usr/include/arm-linux-gnueabi/c++/4.9 "
CoreRT_CrossLinkerFlags="${CoreRT_CrossLinkerFlags} -B${CoreRT_CrossRootFS}/usr/lib/gcc/${TOOLCHAIN}/4.9 `
`-L${CoreRT_CrossRootFS}/usr/lib/gcc/${TOOLCHAIN}/4.9"
fi
;;
esac
CoreRT_ExtraCXXFlags="$CoreRT_ExtraCXXFlags $CoreRT_CrossCXXFlags"
CoreRT_ExtraLinkFlags="$CoreRT_ExtraLinkFlags $CoreRT_CrossLinkerFlags"
fi

source "$CoreRT_TestRoot/testenv.sh"

__BuildStr=${CoreRT_BuildOS}.${CoreRT_BuildArch}.${CoreRT_BuildType}
Expand Down Expand Up @@ -213,7 +280,7 @@ do
if [ ! -e `dirname ${csproj}`/no_unix ]; then
run_test_dir ${csproj} "Jit"
if [ ! -e `dirname ${csproj}`/no_cpp ]; then
run_test_dir ${csproj} "Cpp"
run_test_dir ${csproj} "Cpp" "$CoreRT_ExtraCXXFlags" "$CoreRT_ExtraLinkFlags"
fi
fi
done
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Simple/PInvoke/PInvoke.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</ItemGroup>

<PropertyGroup>
<IntermediateOutputPath>$(MSBuildProjectDirectory)\obj\$(Configuration)\native\</IntermediateOutputPath>
<IntermediateOutputPath>$(MSBuildProjectDirectory)\obj\$(Configuration)\$(Platform)\native\</IntermediateOutputPath>
<OutputName>PInvokeNative</OutputName>
<NativeObjectExt Condition="'$(OS)' == 'Windows_NT'">.obj</NativeObjectExt>
<NativeObjectExt Condition="'$(OS)' != 'Windows_NT'">.o</NativeObjectExt>
Expand Down
11 changes: 8 additions & 3 deletions tests/src/Simple/SimpleTest.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

<PropertyGroup>
<OutputType Condition="'$(OutputType)' == ''">Exe</OutputType>
<OutputPath>$(MSBuildProjectDirectory)\bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>$(MSBuildProjectDirectory)\obj\$(Configuration)\</IntermediateOutputPath>
<OutputPath>$(MSBuildProjectDirectory)\bin\$(Configuration)\$(Platform)\</OutputPath>
<IntermediateOutputPath>$(MSBuildProjectDirectory)\obj\$(Configuration)\$(Platform)\</IntermediateOutputPath>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -35,4 +35,9 @@

<!-- Use the source primary copy for development convenience -->
<Import Project="$(MSBuildThisFileDirectory)\..\..\Test.Common.targets" />
</Project>

<ItemGroup>
<CustomLinkerArg Include="$(AdditionalLinkerFlags)" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions tests/testenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ for i in "$@"
arm)
CoreRT_BuildArch=arm
;;
armel)
CoreRT_BuildArch=armel
;;
arm64)
CoreRT_BuildArch=arm64
;;
Expand Down