Skip to content

Commit 21db9c9

Browse files
authored
[clr-interp] Enable building clr-interp on Release, via build flag (#121850)
Interpreter is enabled on targets needing it: wasm/ios. Interpreter is enabled on debug desktop build. Interpreter is disabled on release desktop build. This commit makes it possible to enable it on desktop release build. Ex: ``` ./build.sh -subset clr -c Release --clrinterpreter ```
1 parent 4d109da commit 21db9c9

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

eng/build.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Param(
2626
[string[]]$fsanitize,
2727
[switch]$bootstrap,
2828
[switch]$useBoostrap,
29+
[switch]$clrinterpreter,
2930
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
3031
)
3132

@@ -57,6 +58,7 @@ function Get-Help() {
5758
Write-Host " '-subset' can be omitted if the subset is given as the first argument."
5859
Write-Host " [Default: Builds the entire repo.]"
5960
Write-Host " -usemonoruntime Product a .NET runtime with Mono as the underlying runtime."
61+
Write-Host " -clrinterpreter Enables CoreCLR interpreter for Release builds of targets where it is a Debug only feature."
6062
Write-Host " -verbosity (-v) MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]."
6163
Write-Host " [Default: Minimal]"
6264
Write-Host " --useBootstrap Use the results of building the bootstrap subset to build published tools on the target machine."
@@ -335,6 +337,7 @@ foreach ($argument in $PSBoundParameters.Keys)
335337
"arch" {}
336338
"fsanitize" { $arguments += " /p:EnableNativeSanitizers=$($PSBoundParameters[$argument])"}
337339
"useBootstrap" { $arguments += " /p:UseBootstrap=$($PSBoundParameters[$argument])" }
340+
"clrinterpreter" { $arguments += " /p:FeatureInterpreter=true" }
338341
default { $arguments += " /p:$argument=$($PSBoundParameters[$argument])" }
339342
}
340343
}

eng/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ usage()
4646
echo " '--subset' can be omitted if the subset is given as the first argument."
4747
echo " [Default: Builds the entire repo.]"
4848
echo " --usemonoruntime Product a .NET runtime with Mono as the underlying runtime."
49+
echo " --clrinterpreter Enables CoreCLR interpreter for Release builds of targets where it is a Debug only feature."
4950
echo " --verbosity (-v) MSBuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]."
5051
echo " [Default: Minimal]"
5152
echo " --use-bootstrap Use the results of building the bootstrap subset to build published tools on the target machine."
@@ -381,6 +382,11 @@ while [[ $# -gt 0 ]]; do
381382
shift 1
382383
;;
383384

385+
-clrinterpreter)
386+
arguments+=("/p:FeatureInterpreter=true")
387+
shift 1
388+
;;
389+
384390
-librariesconfiguration|-lc)
385391
if [ -z ${2+x} ]; then
386392
echo "No libraries configuration supplied. See help (--help) for supported libraries configurations." 1>&2

src/coreclr/System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,13 @@ class AsmOffsets
135135
#if TARGET_64BIT
136136
public const int OFFSETOF__REGDISPLAY__m_pCurrentContext = 0x8;
137137
#if FEATURE_INTERPRETER
138+
#if TARGET_UNIX
138139
public const int SIZEOF__StackFrameIterator = 0x168;
139140
public const int OFFSETOF__StackFrameIterator__m_AdjustedControlPC = 0x160;
141+
#else // TARGET_UNIX
142+
public const int SIZEOF__StackFrameIterator = 0x170;
143+
public const int OFFSETOF__StackFrameIterator__m_AdjustedControlPC = 0x168;
144+
#endif // TARGET_UNIX
140145
#else
141146
public const int SIZEOF__StackFrameIterator = 0x148;
142147
public const int OFFSETOF__StackFrameIterator__m_AdjustedControlPC = 0x140;

src/coreclr/runtime.proj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<_CoreClrBuildArg Include="-cmakeargs &quot;-DCLR_DOTNET_HOST_PATH=$(DOTNET_HOST_PATH)&quot;" />
5252
<_CoreClrBuildArg Condition="'$(HasCdacBuildTool)' == 'true'" Include="-cmakeargs &quot;-DCDAC_BUILD_TOOL_BINARY_PATH=$(RuntimeBinDir)cdac-build-tool\cdac-build-tool.dll&quot;" />
5353
<_CoreClrBuildArg Condition="'$(FeatureXplatEventSource)' == 'false'" Include="-cmakeargs &quot;-DFEATURE_EVENTSOURCE_XPLAT=0&quot;" />
54+
<_CoreClrBuildArg Condition="'$(FeatureInterpreter)' == 'true'" Include="-cmakeargs &quot;-DFEATURE_INTERPRETER=1&quot;" />
5455
</ItemGroup>
5556

5657
<ItemGroup Condition="'$(CxxStandardLibrary)' != ''">

src/coreclr/vm/amd64/asmconstants.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,11 @@ ASMCONSTANTS_C_ASSERT(OFFSETOF__InterpMethod__pCallStub == offsetof(InterpMethod
575575
#define OFFSETOF__Thread__m_pInterpThreadContext 0x2a0
576576
#endif // _DEBUG
577577
#else // TARGET_UNIX
578+
#ifdef _DEBUG
578579
#define OFFSETOF__Thread__m_pInterpThreadContext 0xb60
580+
#else // _DEBUG
581+
#define OFFSETOF__Thread__m_pInterpThreadContext 0x2e8
582+
#endif // _DEBUG
579583
#endif // TARGET_UNIX
580584
ASMCONSTANTS_C_ASSERT(OFFSETOF__Thread__m_pInterpThreadContext == offsetof(Thread, m_pInterpThreadContext))
581585

0 commit comments

Comments
 (0)