Skip to content

Commit

Permalink
Backport assorted changes from runtimelab (dotnet#101655)
Browse files Browse the repository at this point in the history
* Backport assorted changes from runtimelab
- Official build template
- FEATURE_HIJACK define
- Misc other cleanup

* Delete unused DATA_ALIGNMENT definition
  • Loading branch information
jkotas authored and michaelgsharp committed May 8, 2024
1 parent 43c3a48 commit 9be9a80
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 179 deletions.
1 change: 0 additions & 1 deletion eng/native/configureplatform.cmake
Expand Up @@ -429,7 +429,6 @@ endif(CLR_CMAKE_TARGET_OS STREQUAL haiku)

if(CLR_CMAKE_TARGET_OS STREQUAL emscripten)
set(CLR_CMAKE_TARGET_UNIX 1)
set(CLR_CMAKE_TARGET_LINUX 1)
set(CLR_CMAKE_TARGET_BROWSER 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL emscripten)

Expand Down
1 change: 0 additions & 1 deletion eng/pipelines/common/xplat-setup.yml
Expand Up @@ -188,7 +188,6 @@ jobs:
name: $(DncEngPublicBuildPool)
demands: ImageOverride -equals windows.vs2022.amd64.open


${{ if eq(parameters.helixQueuesTemplate, '') }}:
# macOS hosted pool machines are slower so we need to give a greater timeout than the 60 mins default.
${{ if and(eq(parameters.jobParameters.timeoutInMinutes, ''), in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'tvos')) }}:
Expand Down
78 changes: 78 additions & 0 deletions eng/pipelines/runtimelab-official.yml
@@ -0,0 +1,78 @@
trigger:
batch: true
branches:
include:
- feature/*
paths:
include:
- '*'
exclude:
- '**.md'
- eng/Version.Details.xml
- .devcontainer/*
- .github/*
- docs/*
- LICENSE.TXT
- PATENTS.TXT
- THIRD-PARTY-NOTICES.TXT

variables:
- template: /eng/pipelines/common/variables.yml
parameters:
templatePath: 'templates-official'

- ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- name: TeamName
value: dotnet-core
extends:
template: /eng/pipelines/common/templates/pipeline-with-resources.yml@self
parameters:
isOfficialBuild: true
stages:
- stage: Build
jobs:
#
# Build the whole product with Release CoreCLR
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: release
platforms:
- linux_x64
- windows_x64
jobParameters:
templatePath: 'templates-official'
isOfficialBuild: true
timeoutInMinutes: 180
buildArgs: -s clr+libs+hosts+packs -c $(_BuildConfig)
postBuildSteps:
# Upload the results.
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
parameters:
name: $(osGroup)$(osSubgroup)_$(archType)

#
# Build libraries AllConfigurations for packages
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: Release
platforms:
- windows_x64
jobParameters:
templatePath: 'templates-official'
buildArgs: -s tools+libs -allConfigurations -c $(_BuildConfig) /p:TestAssemblies=false /p:TestPackages=true
nameSuffix: Libraries_AllConfigurations
isOfficialBuild: true
postBuildSteps:
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
parameters:
name: Libraries_AllConfigurations
timeoutInMinutes: 95

- template: /eng/pipelines/official/stages/publish.yml
parameters:
isOfficialBuild: true
149 changes: 51 additions & 98 deletions eng/pipelines/runtimelab.yml
Expand Up @@ -49,103 +49,56 @@ extends:
stages:
- stage: Build
jobs:
- ${{ if ne(variables.isOfficialBuild, true) }}:
#
# Build the whole product with Checked CoreCLR and run runtime tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
buildConfig: checked
platforms:
- linux_x64
- windows_x64
jobParameters:
timeoutInMinutes: 200
buildArgs: -s clr+libs+hosts+packs -c debug -rc $(_BuildConfig)
postBuildSteps:
- template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
parameters:
creator: dotnet-bot
testRunNamePrefixSuffix: CoreCLR_$(_BuildConfig)
#
# Build the whole product with Checked CoreCLR and run runtime tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
buildConfig: checked
platforms:
- linux_x64
- windows_x64
jobParameters:
timeoutInMinutes: 200
buildArgs: -s clr+libs+hosts+packs -c debug -rc $(_BuildConfig)
postBuildSteps:
- template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
parameters:
creator: dotnet-bot
testRunNamePrefixSuffix: CoreCLR_$(_BuildConfig)

#
# Build the whole product with Release CoreCLR and run libraries tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: release
platforms:
- linux_x64
- windows_x64
jobParameters:
timeoutInMinutes: 180
buildArgs: -s clr+libs+libs.tests+hosts+packs -c $(_BuildConfig) /p:ArchiveTests=true
postBuildSteps:
- template: /eng/pipelines/libraries/helix.yml
parameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Libraries_$(_BuildConfig)
#
# Build the whole product with Release CoreCLR and run libraries tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: release
platforms:
- linux_x64
- windows_x64
jobParameters:
timeoutInMinutes: 180
buildArgs: -s clr+libs+libs.tests+hosts+packs -c $(_BuildConfig) /p:ArchiveTests=true
postBuildSteps:
- template: /eng/pipelines/libraries/helix.yml
parameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Libraries_$(_BuildConfig)

#
# Build and test libraries AllConfigurations
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
platforms:
- windows_x64
jobParameters:
buildArgs: -test -s tools+libs+libs.tests -allConfigurations -c $(_BuildConfig) /p:TestAssemblies=false /p:TestPackages=true
nameSuffix: Libraries_AllConfigurations
timeoutInMinutes: 150

- ${{ else }}:
#
# Build the whole product with Release CoreCLR
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: release
platforms:
- linux_x64
- windows_x64
jobParameters:
isOfficialBuild: true
timeoutInMinutes: 180
buildArgs: -s clr+libs+hosts+packs -c $(_BuildConfig)
postBuildSteps:
# Upload the results.
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
parameters:
name: $(osGroup)$(osSubgroup)_$(archType)

#
# Build libraries AllConfigurations for packages
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: Release
platforms:
- windows_x64
jobParameters:
buildArgs: -s tools+libs -allConfigurations -c $(_BuildConfig) /p:TestAssemblies=false /p:TestPackages=true
nameSuffix: Libraries_AllConfigurations
isOfficialBuild: true
postBuildSteps:
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
parameters:
name: Libraries_AllConfigurations
timeoutInMinutes: 95

- ${{ if eq(variables.isOfficialBuild, true) }}:
- template: /eng/pipelines/official/stages/publish.yml
parameters:
isOfficialBuild: true
#
# Build and test libraries AllConfigurations
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
buildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
platforms:
- windows_x64
jobParameters:
buildArgs: -test -s tools+libs+libs.tests -allConfigurations -c $(_BuildConfig) /p:TestAssemblies=false /p:TestPackages=true
nameSuffix: Libraries_AllConfigurations
timeoutInMinutes: 150
14 changes: 9 additions & 5 deletions src/coreclr/nativeaot/Runtime/CMakeLists.txt
Expand Up @@ -231,15 +231,19 @@ if(FEATURE_EVENT_TRACE)
add_definitions(-DFEATURE_EVENT_TRACE)
endif()

if (NOT CLR_CMAKE_TARGET_ARCH_WASM)
add_definitions(-DFEATURE_HIJACK)
endif()

add_definitions(-DFEATURE_BASICFREEZE)
add_definitions(-DFEATURE_CONSERVATIVE_GC)
if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP)
add_definitions(-DFEATURE_MANUALLY_MANAGED_CARD_BUNDLES)
endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
if(CLR_CMAKE_TARGET_ARCH_ARM)
endif()
if(CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_WASM)
add_definitions(-DFEATURE_64BIT_ALIGNMENT)
endif(CLR_CMAKE_TARGET_ARCH_ARM)
endif()

add_definitions(-DFEATURE_CUSTOM_IMPORTS)
add_definitions(-DFEATURE_DYNAMIC_CODE)
Expand All @@ -250,7 +254,7 @@ add_definitions(-DNATIVEAOT)
add_definitions(-DFEATURE_CACHED_INTERFACE_DISPATCH)
if(CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM)
add_definitions(-DINTERFACE_DISPATCH_CACHE_HAS_CELL_BACKPOINTER)
endif(CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM)
endif()
add_definitions(-D_LIB)

# there is a problem with undefined symbols when this is set
Expand All @@ -267,7 +271,7 @@ if(CLR_CMAKE_TARGET_WIN32)
add_compile_options($<$<COMPILE_LANGUAGE:ASM_MASM>:/safeseh>)
endif()
else()
if(NOT CLR_CMAKE_TARGET_APPLE)
if(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_TARGET_ARCH_WASM)
add_definitions(-DFEATURE_READONLY_GS_COOKIE)
endif()
include(unix/configure.cmake)
Expand Down
27 changes: 0 additions & 27 deletions src/coreclr/nativeaot/Runtime/CommonMacros.h
Expand Up @@ -125,35 +125,8 @@ inline bool IS_ALIGNED(T* val, uintptr_t alignment);

#ifndef __GCENV_BASE_INCLUDED__

#if defined(HOST_WASM)
#define OS_PAGE_SIZE 0x4
#else
#define OS_PAGE_SIZE PalOsPageSize()
#endif

#if defined(HOST_AMD64)

#define DATA_ALIGNMENT 8

#elif defined(HOST_X86)

#define DATA_ALIGNMENT 4

#elif defined(HOST_ARM)

#define DATA_ALIGNMENT 4

#elif defined(HOST_ARM64)

#define DATA_ALIGNMENT 8

#elif defined(HOST_WASM)

#define DATA_ALIGNMENT 4

#else
#error Unsupported target architecture
#endif
#endif // __GCENV_BASE_INCLUDED__

#if defined(TARGET_ARM)
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/nativeaot/Runtime/GCMemoryHelpers.inl
Expand Up @@ -172,6 +172,8 @@ static const uint32_t INVALIDGCVALUE = 0xcccccccd;

FORCEINLINE void InlineWriteBarrier(void * dst, void * ref)
{
ASSERT(((uint8_t*)dst >= g_lowest_address) && ((uint8_t*)dst < g_highest_address))

if (((uint8_t*)ref >= g_ephemeral_low) && ((uint8_t*)ref < g_ephemeral_high))
{
// volatile is used here to prevent fetch of g_card_table from being reordered
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/nativeaot/Runtime/PalRedhawk.h
Expand Up @@ -688,9 +688,11 @@ REDHAWK_PALIMPORT bool REDHAWK_PALAPI PalStartBackgroundGCThread(_In_ Background
REDHAWK_PALIMPORT bool REDHAWK_PALAPI PalStartFinalizerThread(_In_ BackgroundCallback callback, _In_opt_ void* pCallbackContext);
REDHAWK_PALIMPORT bool REDHAWK_PALAPI PalStartEventPipeHelperThread(_In_ BackgroundCallback callback, _In_opt_ void* pCallbackContext);

#ifdef FEATURE_HIJACK
typedef void (*PalHijackCallback)(_In_ NATIVE_CONTEXT* pThreadContext, _In_opt_ void* pThreadToHijack);
REDHAWK_PALIMPORT void REDHAWK_PALAPI PalHijack(HANDLE hThread, _In_opt_ void* pThreadToHijack);
REDHAWK_PALIMPORT UInt32_BOOL REDHAWK_PALAPI PalRegisterHijackCallback(_In_ PalHijackCallback callback);
#endif

REDHAWK_PALIMPORT UInt32_BOOL REDHAWK_PALAPI PalAllocateThunksFromTemplate(_In_ HANDLE hTemplateModule, uint32_t templateRva, size_t templateSize, _Outptr_result_bytebuffer_(templateSize) void** newThunksOut);
REDHAWK_PALIMPORT UInt32_BOOL REDHAWK_PALAPI PalFreeThunksFromTemplate(_In_ void *pBaseAddress, size_t templateSize);
Expand Down
22 changes: 0 additions & 22 deletions src/coreclr/nativeaot/Runtime/portable.cpp
Expand Up @@ -332,28 +332,6 @@ void * ReturnFromUniversalTransition;
EXTERN_C void * ReturnFromUniversalTransition_DebugStepTailCall;
void * ReturnFromUniversalTransition_DebugStepTailCall;

#endif // USE_PORTABLE_HELPERS

#if defined(USE_PORTABLE_HELPERS)
//
// Return address hijacking
//
FCIMPL0(void, RhpGcStressHijack)
{
ASSERT_UNCONDITIONALLY("NYI");
}
FCIMPLEND

FCIMPL0(void, RhpGcProbeHijack)
{
ASSERT_UNCONDITIONALLY("NYI");
}
FCIMPLEND

#endif // defined(USE_PORTABLE_HELPERS) || defined(TARGET_UNIX)

#if defined(USE_PORTABLE_HELPERS)

#if !defined (HOST_ARM64)
FCIMPL2(void, RhpAssignRef, Object ** dst, Object * ref)
{
Expand Down

0 comments on commit 9be9a80

Please sign in to comment.