Skip to content

Commit 713b20a

Browse files
committed
Merge branch 'fix_aot_cross_target' into stark
2 parents d30faff + 62a3da1 commit 713b20a

File tree

6 files changed

+22
-7
lines changed

6 files changed

+22
-7
lines changed

src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3988,7 +3988,12 @@ void MethodContext::repGetEEInfo(CORINFO_EE_INFO* pEEInfoOut)
39883988
pEEInfoOut->osPageSize = (size_t)0x1000;
39893989
pEEInfoOut->maxUncheckedOffsetForNullObject = (size_t)((32 * 1024) - 1);
39903990
pEEInfoOut->targetAbi = CORINFO_DESKTOP_ABI;
3991-
pEEInfoOut->osType = (CORINFO_OS)0;
3991+
#ifdef FEATURE_PAL
3992+
pEEInfoOut->osType = CORINFO_UNIX;
3993+
#else
3994+
pEEInfoOut->osType = CORINFO_WINNT;
3995+
#endif
3996+
39923997
pEEInfoOut->osMajor = (unsigned)0;
39933998
pEEInfoOut->osMinor = (unsigned)0;
39943999
pEEInfoOut->osBuild = (unsigned)0;

src/coreclr/src/inc/corinfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ struct CORINFO_EH_CLAUSE
17811781
enum CORINFO_OS
17821782
{
17831783
CORINFO_WINNT,
1784-
CORINFO_PAL,
1784+
CORINFO_UNIX,
17851785
};
17861786

17871787
struct CORINFO_CPU

src/coreclr/src/jit/compiler.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4894,14 +4894,19 @@ int Compiler::compCompile(CORINFO_METHOD_HANDLE methodHnd,
48944894

48954895
virtualStubParamInfo = new (this, CMK_Unknown) VirtualStubParamInfo(IsTargetAbi(CORINFO_CORERT_ABI));
48964896

4897+
// compMatchedVM is set to true if both CPU/ABI and OS are matching the execution engine requirements
4898+
//
48974899
// Do we have a matched VM? Or are we "abusing" the VM to help us do JIT work (such as using an x86 native VM
48984900
// with an ARM-targeting "altjit").
4901+
// Match CPU/ABI for compMatchedVM
48994902
info.compMatchedVM = IMAGE_FILE_MACHINE_TARGET == info.compCompHnd->getExpectedTargetArchitecture();
49004903

4901-
#if (defined(_TARGET_UNIX_) && !defined(_HOST_UNIX_)) || (!defined(_TARGET_UNIX_) && defined(_HOST_UNIX_))
4902-
// The host and target platforms don't match. This info isn't handled by the existing
4903-
// getExpectedTargetArchitecture() JIT-EE interface method.
4904-
info.compMatchedVM = false;
4904+
// Match OS for compMatchedVM
4905+
CORINFO_EE_INFO* eeInfo = eeGetEEInfo();
4906+
#ifdef _TARGET_UNIX_
4907+
info.compMatchedVM = info.compMatchedVM && (eeInfo->osType == CORINFO_UNIX);
4908+
#else
4909+
info.compMatchedVM = info.compMatchedVM && (eeInfo->osType == CORINFO_WINNT);
49054910
#endif
49064911

49074912
// If we are not compiling for a matched VM, then we are getting JIT flags that don't match our target

src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,6 +2423,7 @@ private void getEEInfo(ref CORINFO_EE_INFO pEEInfoOut)
24232423
new UIntPtr(32 * 1024 - 1) : new UIntPtr((uint)pEEInfoOut.osPageSize / 2 - 1);
24242424

24252425
pEEInfoOut.targetAbi = TargetABI;
2426+
pEEInfoOut.osType = _compilation.NodeFactory.Target.IsWindows ? CORINFO_OS.CORINFO_WINNT : CORINFO_OS.CORINFO_UNIX;
24262427
}
24272428

24282429
private string getJitTimeLogFilename()

src/coreclr/src/tools/Common/JitInterface/CorInfoTypes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ public struct CORINFO_HELPER_DESC
853853
public enum CORINFO_OS
854854
{
855855
CORINFO_WINNT,
856-
CORINFO_PAL,
856+
CORINFO_UNIX,
857857
}
858858

859859
public enum CORINFO_RUNTIME_ABI

src/coreclr/src/vm/jitinterface.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10324,7 +10324,11 @@ void CEEInfo::getEEInfo(CORINFO_EE_INFO *pEEInfoOut)
1032410324
pEEInfoOut->maxUncheckedOffsetForNullObject = MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT;
1032510325
pEEInfoOut->targetAbi = CORINFO_CORECLR_ABI;
1032610326

10327+
#ifdef FEATURE_PAL
10328+
pEEInfoOut->osType = CORINFO_UNIX;
10329+
#else
1032710330
pEEInfoOut->osType = CORINFO_WINNT;
10331+
#endif
1032810332

1032910333
// hardcode OS version to 0.0.0. These fields can be removed from JITEE interface
1033010334
pEEInfoOut->osMajor = 0;

0 commit comments

Comments
 (0)