Skip to content

Commit a357a46

Browse files
Interpreter Fixes (#2698)
--------- Co-authored-by: Aaron Robinson <arobins@microsoft.com>
1 parent 586a374 commit a357a46

File tree

5 files changed

+39
-35
lines changed

5 files changed

+39
-35
lines changed

eng/pipelines/runtimelab-official.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extends:
4646
templatePath: 'templates-official'
4747
isOfficialBuild: true
4848
timeoutInMinutes: 180
49-
buildArgs: -s clr+libs+hosts+packs -c $(_BuildConfig)
49+
buildArgs: -s clr+libs+clr.hosts+packs -c $(_BuildConfig)
5050
postBuildSteps:
5151
# Upload the results.
5252
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml

eng/pipelines/runtimelab.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,9 @@ extends:
6262
- windows_x64
6363
jobParameters:
6464
timeoutInMinutes: 200
65-
buildArgs: -s clr+libs+hosts+packs -c debug -rc $(_BuildConfig)
66-
postBuildSteps:
67-
- template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
68-
parameters:
69-
creator: dotnet-bot
70-
testRunNamePrefixSuffix: CoreCLR_$(_BuildConfig)
65+
buildArgs: -s clr+libs+clr.hosts+packs -c debug -rc $(_BuildConfig)
66+
extraVariablesTemplates:
67+
- template: /eng/pipelines/common/templates/runtimes/test-variables.yml
7168

7269
#
7370
# Build the whole product with Release CoreCLR and run libraries tests
@@ -82,12 +79,14 @@ extends:
8279
- windows_x64
8380
jobParameters:
8481
timeoutInMinutes: 180
85-
buildArgs: -s clr+libs+libs.tests+hosts+packs -c $(_BuildConfig) /p:ArchiveTests=true
82+
buildArgs: -s clr+libs+libs.tests+clr.hosts+packs -c $(_BuildConfig) /p:ArchiveTests=true
8683
postBuildSteps:
8784
- template: /eng/pipelines/libraries/helix.yml
8885
parameters:
8986
creator: dotnet-bot
9087
testRunNamePrefixSuffix: Libraries_$(_BuildConfig)
88+
extraVariablesTemplates:
89+
- template: /eng/pipelines/common/templates/runtimes/test-variables.yml
9190

9291
#
9392
# Build and test libraries AllConfigurations
@@ -102,3 +101,5 @@ extends:
102101
buildArgs: -test -s tools+libs+libs.tests -allConfigurations -c $(_BuildConfig) /p:TestAssemblies=false /p:TestPackages=true
103102
nameSuffix: Libraries_AllConfigurations
104103
timeoutInMinutes: 150
104+
extraVariablesTemplates:
105+
- template: /eng/pipelines/common/templates/runtimes/test-variables.yml

src/coreclr/vm/interpreter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9302,7 +9302,7 @@ void Interpreter::DoCallWork(bool virtualCall, void* thisArg, CORINFO_RESOLVED_T
93029302
// Hardware intrinsics are recognized by name.
93039303
const char* namespaceName = NULL;
93049304
const char* className = NULL;
9305-
const char* methodName = getMethodName(&m_interpCeeInfo, (CORINFO_METHOD_HANDLE)methToCall, &className, &namespaceName, NULL);
9305+
const char* methodName = getMethodName(&m_interpCeeInfo, (CORINFO_METHOD_HANDLE)methToCall, &className, &namespaceName);
93069306
if (
93079307
(strcmp(namespaceName, "System.Runtime.Intrinsics") == 0 ||
93089308
#if defined(TARGET_X86) || defined(TARGET_AMD64)
@@ -11943,7 +11943,7 @@ Interpreter::InterpreterNamedIntrinsics Interpreter::getNamedIntrinsicID(CEEInfo
1194311943

1194411944
const char* namespaceName = NULL;
1194511945
const char* className = NULL;
11946-
const char* methodName = getMethodName(info, (CORINFO_METHOD_HANDLE)methodHnd, &className, &namespaceName, NULL);
11946+
const char* methodName = getMethodName(info, (CORINFO_METHOD_HANDLE)methodHnd, &className, &namespaceName);
1194711947

1194811948
if (strncmp(namespaceName, "System", 6) == 0)
1194911949
{
@@ -12010,7 +12010,7 @@ Interpreter::InterpreterNamedIntrinsics Interpreter::getNamedIntrinsicID(CEEInfo
1201012010

1201112011
// Simple version of getMethodName which supports IL Stubs such as IL_STUB_PInvoke additionally.
1201212012
// Also see getMethodNameFromMetadata and printMethodName in corinfo.h
12013-
const char* Interpreter::getMethodName(CEEInfo* info, CORINFO_METHOD_HANDLE hnd, const char** className, const char** namespaceName, const char **enclosingClassName)
12013+
const char* Interpreter::getMethodName(CEEInfo* info, CORINFO_METHOD_HANDLE hnd, const char** className, const char** namespaceName)
1201412014
{
1201512015
MethodDesc *pMD = GetMethod(hnd);
1201612016
if (pMD->IsILStub())
@@ -12022,7 +12022,7 @@ const char* Interpreter::getMethodName(CEEInfo* info, CORINFO_METHOD_HANDLE hnd,
1202212022
return pMD->GetName();
1202312023
}
1202412024

12025-
return info->getMethodNameFromMetadata(hnd, className, namespaceName, enclosingClassName);
12025+
return info->getMethodNameFromMetadata(hnd, className, namespaceName, nullptr, 0);
1202612026
}
1202712027

1202812028
const char* eeGetMethodFullName(CEEInfo* info, CORINFO_METHOD_HANDLE hnd, const char** clsName)

src/coreclr/vm/interpreter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ class Interpreter
926926
NI_System_Threading_Interlocked_ExchangeAdd,
927927
};
928928
static InterpreterNamedIntrinsics getNamedIntrinsicID(CEEInfo* info, CORINFO_METHOD_HANDLE methodHnd);
929-
static const char* getMethodName(CEEInfo* info, CORINFO_METHOD_HANDLE hnd, const char** className, const char** namespaceName = NULL, const char **enclosingClassName = NULL);
929+
static const char* getMethodName(CEEInfo* info, CORINFO_METHOD_HANDLE hnd, const char** className, const char** namespaceName = NULL);
930930

931931
private:
932932
// Architecture-dependent helpers.

src/coreclr/vm/stublink.cpp

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,14 +1308,17 @@ bool StubLinker::EmitUnwindInfo(Stub* pStubRX, Stub* pStubRW, int globalsize, Lo
13081308
// make that INT32_MAX.
13091309
//
13101310

1311-
StubUnwindInfoHeader *pHeader = pStubRW->GetUnwindInfoHeader();
1312-
_ASSERTE(IS_ALIGNED(pHeader, sizeof(void*)));
1311+
StubUnwindInfoHeader *pHeaderRW = pStubRW->GetUnwindInfoHeader();
1312+
StubUnwindInfoHeader *pHeaderRX = pStubRX->GetUnwindInfoHeader();
1313+
_ASSERTE(IS_ALIGNED(pHeaderRW, sizeof(void*)));
13131314

1314-
BYTE *pbBaseAddress = pbRegionBaseAddress;
1315+
BYTE *pbBaseAddressRX = pbRegionBaseAddress;
1316+
BYTE *pbBaseAddressRW = (BYTE*)((uint64_t)pbRegionBaseAddress + (uint64_t)pHeaderRW - (uint64_t)pHeaderRX);
13151317

1316-
while ((size_t)((BYTE*)pHeader - pbBaseAddress) > MaxSegmentSize)
1318+
while ((size_t)((BYTE*)pHeaderRX - pbBaseAddressRX) > MaxSegmentSize)
13171319
{
1318-
pbBaseAddress += MaxSegmentSize;
1320+
pbBaseAddressRX += MaxSegmentSize;
1321+
pbBaseAddressRW += MaxSegmentSize;
13191322
}
13201323

13211324
//
@@ -1327,7 +1330,7 @@ bool StubLinker::EmitUnwindInfo(Stub* pStubRX, Stub* pStubRW, int globalsize, Lo
13271330
// allocations are freed.
13281331
//
13291332

1330-
if ((size_t)(pCode + globalsize - pbBaseAddress) > MaxSegmentSize)
1333+
if ((size_t)(pCode + globalsize - pbBaseAddressRX) > MaxSegmentSize)
13311334
{
13321335
return false;
13331336
}
@@ -1442,17 +1445,17 @@ bool StubLinker::EmitUnwindInfo(Stub* pStubRX, Stub* pStubRW, int globalsize, Lo
14421445
PT_RUNTIME_FUNCTION pCurFunction = &pUnwindInfoHeader->FunctionEntry;
14431446
_ASSERTE(IS_ALIGNED(pCurFunction, sizeof(ULONG)));
14441447

1445-
S_UINT32 sBeginAddress = S_BYTEPTR(pCode) - S_BYTEPTR(pbBaseAddress);
1448+
S_UINT32 sBeginAddress = S_BYTEPTR(pCode) - S_BYTEPTR(pbBaseAddressRX);
14461449
if (sBeginAddress.IsOverflow())
14471450
COMPlusThrowArithmetic();
14481451
pCurFunction->BeginAddress = sBeginAddress.Value();
14491452

1450-
S_UINT32 sEndAddress = S_BYTEPTR(pCode) + S_BYTEPTR(globalsize) - S_BYTEPTR(pbBaseAddress);
1453+
S_UINT32 sEndAddress = S_BYTEPTR(pCode) + S_BYTEPTR(globalsize) - S_BYTEPTR(pbBaseAddressRX);
14511454
if (sEndAddress.IsOverflow())
14521455
COMPlusThrowArithmetic();
14531456
pCurFunction->EndAddress = sEndAddress.Value();
14541457

1455-
S_UINT32 sTemp = S_BYTEPTR(pUnwindInfo) - S_BYTEPTR(pbBaseAddress);
1458+
S_UINT32 sTemp = S_BYTEPTR(pUnwindInfo) - S_BYTEPTR(pbBaseAddressRW);
14561459
if (sTemp.IsOverflow())
14571460
COMPlusThrowArithmetic();
14581461
RUNTIME_FUNCTION__SetUnwindInfoAddress(pCurFunction, sTemp.Value());
@@ -1465,12 +1468,12 @@ bool StubLinker::EmitUnwindInfo(Stub* pStubRX, Stub* pStubRW, int globalsize, Lo
14651468
PT_RUNTIME_FUNCTION pCurFunction = &pUnwindInfoHeader->FunctionEntry;
14661469
_ASSERTE(IS_ALIGNED(pCurFunction, sizeof(ULONG)));
14671470

1468-
S_UINT32 sBeginAddress = S_BYTEPTR(pCode) - S_BYTEPTR(pbBaseAddress);
1471+
S_UINT32 sBeginAddress = S_BYTEPTR(pCode) - S_BYTEPTR(pbBaseAddressRX);
14691472
if (sBeginAddress.IsOverflow())
14701473
COMPlusThrowArithmetic();
14711474
RUNTIME_FUNCTION__SetBeginAddress(pCurFunction, sBeginAddress.Value());
14721475

1473-
S_UINT32 sTemp = S_BYTEPTR(pUnwindInfo) - S_BYTEPTR(pbBaseAddress);
1476+
S_UINT32 sTemp = S_BYTEPTR(pUnwindInfo) - S_BYTEPTR(pbBaseAddressRW);
14741477
if (sTemp.IsOverflow())
14751478
COMPlusThrowArithmetic();
14761479
RUNTIME_FUNCTION__SetUnwindInfoAddress(pCurFunction, sTemp.Value());
@@ -1620,11 +1623,11 @@ bool StubLinker::EmitUnwindInfo(Stub* pStubRX, Stub* pStubRW, int globalsize, Lo
16201623

16211624
_ASSERTE(IS_ALIGNED(pCurFunction, sizeof(void*)));
16221625

1623-
S_UINT32 sBeginAddress = S_BYTEPTR(pCode) - S_BYTEPTR(pbBaseAddress);
1626+
S_UINT32 sBeginAddress = S_BYTEPTR(pCode) - S_BYTEPTR(pbBaseAddressRX);
16241627
if (sBeginAddress.IsOverflow())
16251628
COMPlusThrowArithmetic();
16261629

1627-
S_UINT32 sTemp = S_BYTEPTR(pUnwindInfo) - S_BYTEPTR(pbBaseAddress);
1630+
S_UINT32 sTemp = S_BYTEPTR(pUnwindInfo) - S_BYTEPTR(pbBaseAddressRW);
16281631
if (sTemp.IsOverflow())
16291632
COMPlusThrowArithmetic();
16301633

@@ -1749,14 +1752,14 @@ bool StubLinker::EmitUnwindInfo(Stub* pStubRX, Stub* pStubRW, int globalsize, Lo
17491752
(pStubHeapSegment = *ppPrevStubHeapSegment);
17501753
(ppPrevStubHeapSegment = &pStubHeapSegment->pNext))
17511754
{
1752-
if (pbBaseAddress < pStubHeapSegment->pbBaseAddress)
1755+
if (pbBaseAddressRX < pStubHeapSegment->pbBaseAddress)
17531756
{
17541757
// The list is ordered, so address is between segments
17551758
pStubHeapSegment = NULL;
17561759
break;
17571760
}
17581761

1759-
if (pbBaseAddress == pStubHeapSegment->pbBaseAddress)
1762+
if (pbBaseAddressRX == pStubHeapSegment->pbBaseAddress)
17601763
{
17611764
// Found an existing segment
17621765
break;
@@ -1768,7 +1771,7 @@ bool StubLinker::EmitUnwindInfo(Stub* pStubRX, Stub* pStubRW, int globalsize, Lo
17681771
//
17691772
// RtlInstallFunctionTableCallback will only accept a ULONG for the
17701773
// region size. We've already checked above that the RUNTIME_FUNCTION
1771-
// offsets will work relative to pbBaseAddress.
1774+
// offsets will work relative to pbBaseAddressRX.
17721775
//
17731776

17741777
SIZE_T cbSegment = findBlockArgs.cbBlockSize;
@@ -1779,7 +1782,7 @@ bool StubLinker::EmitUnwindInfo(Stub* pStubRX, Stub* pStubRW, int globalsize, Lo
17791782
NewHolder<StubUnwindInfoHeapSegment> pNewStubHeapSegment = new StubUnwindInfoHeapSegment();
17801783

17811784

1782-
pNewStubHeapSegment->pbBaseAddress = pbBaseAddress;
1785+
pNewStubHeapSegment->pbBaseAddress = pbBaseAddressRX;
17831786
pNewStubHeapSegment->cbSegment = cbSegment;
17841787
pNewStubHeapSegment->pUnwindHeaderList = NULL;
17851788
#ifdef TARGET_AMD64
@@ -1796,7 +1799,7 @@ bool StubLinker::EmitUnwindInfo(Stub* pStubRX, Stub* pStubRW, int globalsize, Lo
17961799

17971800
InstallEEFunctionTable(
17981801
pNewStubHeapSegment,
1799-
pbBaseAddress,
1802+
pbBaseAddressRX,
18001803
(ULONG)cbSegment,
18011804
&FindStubFunctionEntry,
18021805
pNewStubHeapSegment,
@@ -1807,8 +1810,8 @@ bool StubLinker::EmitUnwindInfo(Stub* pStubRX, Stub* pStubRW, int globalsize, Lo
18071810
// Link the new stub into the segment.
18081811
//
18091812

1810-
pHeader->pNext = pStubHeapSegment->pUnwindHeaderList;
1811-
pStubHeapSegment->pUnwindHeaderList = pHeader;
1813+
pHeaderRW->pNext = pStubHeapSegment->pUnwindHeaderList;
1814+
pStubHeapSegment->pUnwindHeaderList = pHeaderRW;
18121815

18131816
#ifdef TARGET_AMD64
18141817
// Publish Unwind info to ETW stack crawler
@@ -1819,8 +1822,8 @@ bool StubLinker::EmitUnwindInfo(Stub* pStubRX, Stub* pStubRW, int globalsize, Lo
18191822
#endif
18201823

18211824
#ifdef _DEBUG
1822-
_ASSERTE(pHeader->IsRegistered());
1823-
_ASSERTE( &pHeader->FunctionEntry
1825+
_ASSERTE(pHeaderRW->IsRegistered());
1826+
_ASSERTE( &pHeaderRW->FunctionEntry
18241827
== FindStubFunctionEntry((ULONG64)pCode, EncodeDynamicFunctionTableContext(pStubHeapSegment, DYNFNTABLE_STUB)));
18251828
#endif
18261829

0 commit comments

Comments
 (0)