Skip to content
Open
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
5 changes: 5 additions & 0 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
<SubsetName Include="Clr.PalTestList" OnDemand="true" Description="Generate the list of the CoreCLR PAL tests. When using the command line, use Clr.PalTests instead." />
<SubsetName Include="Clr.Hosts" Description="The CoreCLR corerun test host." />
<SubsetName Include="Clr.Jit" Description="The JIT for the CoreCLR .NET runtime." />
<SubsetName Include="Clr.WasmJit" Description="The cross-targeting WebAssembly JIT compiler for the CoreCLR .NET runtime." />
<SubsetName Include="Clr.AllJits" Description="All of the cross-targeting JIT compilers for the CoreCLR .NET runtime." />
<SubsetName Include="Clr.AllJitsCommunity" Description="All of the cross-targeting JIT compilers for the CoreCLR .NET runtime, including community targets." />
<SubsetName Include="Clr.Spmi" Description="SuperPMI, a tool for CoreCLR JIT testing." />
Expand Down Expand Up @@ -322,6 +323,10 @@
<ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrJitSubset=true</ClrRuntimeBuildSubsets>
</PropertyGroup>

<PropertyGroup Condition="$(_subset.Contains('+clr.wasmjit+'))">
<ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrWasmJitSubset=true</ClrRuntimeBuildSubsets>
</PropertyGroup>

<PropertyGroup Condition="$(_subset.Contains('+clr.paltests+'))">
<ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrPalTestsSubset=true</ClrRuntimeBuildSubsets>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ extends:
- windows_x64
jobParameters:
nameSuffix: Libraries_CheckedCoreCLR
buildArgs: -s clr+libs -c $(_BuildConfig) -rc Checked
buildArgs: -s clr+clr.wasmjit+libs -c $(_BuildConfig) -rc Checked
timeoutInMinutes: 120
postBuildSteps:
- template: /eng/pipelines/coreclr/templates/build-native-test-assets-step.yml
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/build-runtime.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ for /f "delims=" %%a in ("-%__RequestedBuildComponents%-") do (
if not "!string:-jit-=!"=="!string!" (
set __CMakeTarget=!__CMakeTarget! jit
)
if not "!string:-wasmjit-=!"=="!string!" (
set __CMakeTarget=!__CMakeTarget! wasmjit
)
if not "!string:-alljits-=!"=="!string!" (
set __CMakeTarget=!__CMakeTarget! alljits
)
Expand Down
5 changes: 3 additions & 2 deletions src/coreclr/clrdefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,13 @@ function(set_target_definitions_to_custom_os_and_arch)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_LOONGARCH64)
elseif((TARGETDETAILS_ARCH STREQUAL "arm") OR (TARGETDETAILS_ARCH STREQUAL "armel"))
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM)
elseif(TARGETDETAILS_ARCH STREQUAL "wasm")
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_WASM)
elseif((TARGETDETAILS_ARCH STREQUAL "riscv64"))
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_RISCV64)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN)
elseif(TARGETDETAILS_ARCH STREQUAL "wasm")
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_WASM)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_WASM32)
endif()

if (TARGETDETAILS_ARCH STREQUAL "armel")
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/components.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Define all the individually buildable components of the CoreCLR build and their respective targets
add_component(jit)
add_component(wasmjit)
add_component(alljits)
add_component(hosts)
add_component(runtime)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/cordebuginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class ICorDebugInfo
REGNUM_T5,
REGNUM_T6,
REGNUM_PC,
#elif TARGET_WASM
#elif defined(TARGET_WASM)
REGNUM_PC, // wasm doesn't have registers
#else
PORTABILITY_WARNING("Register numbers not defined on this platform")
Expand Down
66 changes: 51 additions & 15 deletions src/coreclr/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function(create_standalone_jit)

if(TARGETDETAILS_OS STREQUAL "unix_osx" OR TARGETDETAILS_OS STREQUAL "unix_anyos")
set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_${TARGETDETAILS_ARCH})
else()
elseif(NOT ${TARGETDETAILS_ARCH} MATCHES "wasm")
set(JIT_ARCH_LINK_LIBRARIES gcinfo_${TARGETDETAILS_OS}_${TARGETDETAILS_ARCH})
endif()

Expand Down Expand Up @@ -53,6 +53,9 @@ function(create_standalone_jit)
elseif(TARGETDETAILS_ARCH STREQUAL "riscv64")
set(JIT_ARCH_SOURCES ${JIT_RISCV64_SOURCES})
set(JIT_ARCH_HEADERS ${JIT_RISCV64_HEADERS})
elseif(TARGETDETAILS_ARCH STREQUAL "wasm")
set(JIT_ARCH_SOURCES ${JIT_WASM_SOURCES})
set(JIT_ARCH_HEADERS ${JIT_WASM_HEADERS})
else()
clr_unknown_arch()
endif()
Expand Down Expand Up @@ -94,7 +97,6 @@ set( JIT_SOURCES
block.cpp
buildstring.cpp
codegencommon.cpp
codegenlinear.cpp
compiler.cpp
copyprop.cpp
debuginfo.cpp
Expand All @@ -115,8 +117,6 @@ set( JIT_SOURCES
fgstmt.cpp
flowgraph.cpp
forwardsub.cpp
gcdecode.cpp
gcencode.cpp
gcinfo.cpp
gentree.cpp
gschecks.cpp
Expand Down Expand Up @@ -145,8 +145,6 @@ set( JIT_SOURCES
liveness.cpp
loopcloning.cpp
lower.cpp
lsra.cpp
lsrabuild.cpp
morph.cpp
morphblock.cpp
objectalloc.cpp
Expand All @@ -163,8 +161,6 @@ set( JIT_SOURCES
rangecheckcloning.cpp
rationalize.cpp
redundantbranchopts.cpp
regalloc.cpp
regMaskTPOps.cpp
regset.cpp
scev.cpp
scopeinfo.cpp
Expand All @@ -178,11 +174,21 @@ set( JIT_SOURCES
stacklevelsetter.cpp
switchrecognition.cpp
treelifeupdater.cpp
unwind.cpp
utils.cpp
valuenum.cpp
)

set ( JIT_NATIVE_TARGET_SOURCES
lsra.cpp
lsrabuild.cpp
regalloc.cpp
regMaskTPOps.cpp
codegenlinear.cpp
gcdecode.cpp
gcencode.cpp
unwind.cpp
)

if (CLR_CMAKE_TARGET_WIN32)
# Append clrjit.natvis file
list (APPEND JIT_SOURCES
Expand All @@ -192,6 +198,7 @@ endif(CLR_CMAKE_TARGET_WIN32)
# Define all the architecture-specific source files

set( JIT_AMD64_SOURCES
${JIT_NATIVE_TARGET_SOURCES}
codegenxarch.cpp
emitxarch.cpp
lowerxarch.cpp
Expand All @@ -205,6 +212,7 @@ set( JIT_AMD64_SOURCES
)

set( JIT_ARM_SOURCES
${JIT_NATIVE_TARGET_SOURCES}
codegenarmarch.cpp
codegenarm.cpp
decomposelongs.cpp
Expand All @@ -217,6 +225,7 @@ set( JIT_ARM_SOURCES
)

set( JIT_I386_SOURCES
${JIT_NATIVE_TARGET_SOURCES}
codegenxarch.cpp
decomposelongs.cpp
emitxarch.cpp
Expand All @@ -231,6 +240,7 @@ set( JIT_I386_SOURCES
)

set( JIT_ARM64_SOURCES
${JIT_NATIVE_TARGET_SOURCES}
codegenarmarch.cpp
codegenarm64.cpp
codegenarm64test.cpp
Expand Down Expand Up @@ -260,6 +270,7 @@ set( JIT_POWERPC64_SOURCES
)

set( JIT_LOONGARCH64_SOURCES
${JIT_NATIVE_TARGET_SOURCES}
codegenloongarch64.cpp
emitloongarch64.cpp
lowerloongarch64.cpp
Expand All @@ -269,6 +280,7 @@ set( JIT_LOONGARCH64_SOURCES
)

set( JIT_RISCV64_SOURCES
${JIT_NATIVE_TARGET_SOURCES}
codegenriscv64.cpp
emitriscv64.cpp
lowerriscv64.cpp
Expand All @@ -277,6 +289,14 @@ set( JIT_RISCV64_SOURCES
unwindriscv64.cpp
)

set( JIT_WASM_SOURCES
codegenwasm.cpp
emitwasm.cpp
lowerwasm.cpp
regallocwasm.cpp
targetwasm.cpp
)

# We include the headers here for better experience in IDEs.
set( JIT_HEADERS
../inc/corinfo.h
Expand Down Expand Up @@ -448,6 +468,15 @@ set( JIT_RISCV64_HEADERS
registerriscv64.h
)

set( JIT_WASM_HEADERS
regallocwasm.h
targetwasm.h
emitwasm.h
emitfmtswasm.h
instrswasm.h
registerwasm.h
)

convert_to_absolute_path(JIT_SOURCES ${JIT_SOURCES})
convert_to_absolute_path(JIT_HEADERS ${JIT_HEADERS})
convert_to_absolute_path(JIT_RESOURCES ${JIT_RESOURCES})
Expand All @@ -470,6 +499,8 @@ convert_to_absolute_path(JIT_LOONGARCH64_SOURCES ${JIT_LOONGARCH64_SOURCES})
convert_to_absolute_path(JIT_LOONGARCH64_HEADERS ${JIT_LOONGARCH64_HEADERS})
convert_to_absolute_path(JIT_RISCV64_SOURCES ${JIT_RISCV64_SOURCES})
convert_to_absolute_path(JIT_RISCV64_HEADERS ${JIT_RISCV64_HEADERS})
convert_to_absolute_path(JIT_WASM_SOURCES ${JIT_WASM_SOURCES})
convert_to_absolute_path(JIT_WASM_HEADERS ${JIT_WASM_HEADERS})

if(CLR_CMAKE_TARGET_ARCH_AMD64)
set(JIT_ARCH_SOURCES ${JIT_AMD64_SOURCES})
Expand Down Expand Up @@ -499,13 +530,12 @@ elseif(CLR_CMAKE_TARGET_ARCH_RISCV64)
set(JIT_ARCH_SOURCES ${JIT_RISCV64_SOURCES})
set(JIT_ARCH_HEADERS ${JIT_RISCV64_HEADERS})
elseif(CLR_CMAKE_TARGET_ARCH_WASM)
set(JIT_ARCH_SOURCES ${JIT_WASM32_SOURCES})
set(JIT_ARCH_HEADERS ${JIT_WASM32_HEADERS})
set(JIT_ARCH_SOURCES ${JIT_WASM_SOURCES})
set(JIT_ARCH_HEADERS ${JIT_WASM_HEADERS})
else()
clr_unknown_arch()
endif()


set(JIT_DLL_MAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/dllmain.cpp)

if(CLR_CMAKE_HOST_WIN32)
Expand Down Expand Up @@ -623,7 +653,12 @@ function(add_jit jitName)
target_compile_definitions(${jitName} PRIVATE JIT_STANDALONE_BUILD)

# add the install targets
install_clr(TARGETS ${jitName} DESTINATIONS . COMPONENT alljits)
if (${jitName} MATCHES "clrjit_universal_wasm")
# TODO-WASM: add the WASM Jit to alljits once that becomes necessary.
install_clr(TARGETS ${jitName} DESTINATIONS . COMPONENT wasmjit)
else()
install_clr(TARGETS ${jitName} DESTINATIONS . COMPONENT alljits)
endif()
endfunction()

set(JIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down Expand Up @@ -653,6 +688,7 @@ add_pgo(clrjit)

if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64)
create_standalone_jit(TARGET clrjit_universal_arm64_${ARCH_HOST_NAME} OS universal ARCH arm64)
create_standalone_jit(TARGET clrjit_universal_wasm_${ARCH_HOST_NAME} OS universal ARCH wasm)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went back and forth a bit on whether to use the "more proper" wasm32 name for the target architecture. In the JIT source (and I expect in the broader /runtime source as well) TARGET_WASM will always mean TARGET_WASM32 || TARGET_WASM64 - a mismatch with _wasm being a TARGET_WASM32-only Jit. On the other hand, wasm32 would be a mismatch with Architecture.Wasm. Matching the Architecture enum seems more important.

create_standalone_jit(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} OS unix_anyos ARCH x64)
create_standalone_jit(TARGET clrjit_win_x64_${ARCH_HOST_NAME} OS win ARCH x64)
if (CLR_CMAKE_BUILD_COMMUNITY_ALTJITS EQUAL 1)
Expand All @@ -678,13 +714,13 @@ if (CLR_CMAKE_TARGET_ARCH_I386 AND CLR_CMAKE_TARGET_UNIX)
endif (CLR_CMAKE_TARGET_ARCH_I386 AND CLR_CMAKE_TARGET_UNIX)

if (CLR_CMAKE_TARGET_UNIX)
if (NOT ARCH_TARGET_NAME STREQUAL s390x AND NOT ARCH_TARGET_NAME STREQUAL armv6 AND NOT ARCH_TARGET_NAME STREQUAL ppc64le AND NOT ARCH_TARGET_NAME STREQUAL riscv64)
if (NOT ARCH_TARGET_NAME STREQUAL s390x AND NOT ARCH_TARGET_NAME STREQUAL armv6 AND NOT ARCH_TARGET_NAME STREQUAL ppc64le AND NOT ARCH_TARGET_NAME STREQUAL riscv64 AND NOT ARCH_TARGET_NAME STREQUAL wasm)
if(CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)
install_clr(TARGETS clrjit_universal_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} DESTINATIONS . COMPONENT jit)
else()
install_clr(TARGETS clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} DESTINATIONS . COMPONENT jit)
endif()
endif(NOT ARCH_TARGET_NAME STREQUAL s390x AND NOT ARCH_TARGET_NAME STREQUAL armv6 AND NOT ARCH_TARGET_NAME STREQUAL ppc64le AND NOT ARCH_TARGET_NAME STREQUAL riscv64)
endif()
endif()

if (CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_PGO_INSTRUMENT)
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/jit/abi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ regNumber ABIPassingSegment::GetRegister() const
return static_cast<regNumber>(m_register);
}

#if HAS_FIXED_REGISTER_SET
//-----------------------------------------------------------------------------
// GetRegisterMask:
// Get the mask of registers that this segment is passed in.
Expand All @@ -62,6 +63,7 @@ regMaskTP ABIPassingSegment::GetRegisterMask() const

return mask;
}
#endif // HAS_FIXED_REGISTER_SET

//-----------------------------------------------------------------------------
// GetStackOffset:
Expand Down
18 changes: 18 additions & 0 deletions src/coreclr/jit/abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,22 @@ class LoongArch64Classifier
WellKnownArg wellKnownParam);
};

class WasmClassifier
{
public:
WasmClassifier(const ClassifierInfo& info);

unsigned StackSize()
{
return 0;
}

ABIPassingInformation Classify(Compiler* comp,
var_types type,
ClassLayout* structLayout,
WellKnownArg wellKnownParam);
};

#if defined(TARGET_X86)
typedef X86Classifier PlatformClassifier;
#elif defined(WINDOWS_AMD64_ABI)
Expand All @@ -345,6 +361,8 @@ typedef Arm32Classifier PlatformClassifier;
typedef RiscV64Classifier PlatformClassifier;
#elif defined(TARGET_LOONGARCH64)
typedef LoongArch64Classifier PlatformClassifier;
#elif defined(TARGET_WASM)
typedef WasmClassifier PlatformClassifier;
#endif

#ifdef SWIFT_SUPPORT
Expand Down
Loading
Loading