Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename IsMacOS to IsApplePlatform in the JIT #96090

Merged
merged 2 commits into from
Dec 17, 2023
Merged
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
2 changes: 1 addition & 1 deletion src/coreclr/gcinfo/gcinfoencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ GcSlotId GcInfoEncoder::GetStackSlotId( INT32 spOffset, GcSlotFlags flags, GcSta

_ASSERTE( (flags & (GC_SLOT_IS_REGISTER | GC_SLOT_IS_DELETED)) == 0 );

if (!(TargetOS::IsMacOS && TargetArchitecture::IsArm64))
if (!(TargetOS::IsApplePlatform && TargetArchitecture::IsArm64))
{
// the spOffset for the stack slot is required to be pointer size aligned
_ASSERTE((spOffset % TARGET_POINTER_SIZE) == 0);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,7 @@ enum CORINFO_OS
{
CORINFO_WINNT,
CORINFO_UNIX,
CORINFO_MACOS,
CORINFO_APPLE,
};

enum CORINFO_RUNTIME_ABI
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/targetosarch.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TargetOS
#define TARGET_WINDOWS_POSSIBLY_SUPPORTED
static const bool IsWindows = true;
static const bool IsUnix = false;
static const bool IsMacOS = false;
static const bool IsApplePlatform = false;
#elif defined(TARGET_UNIX)
#define TARGET_UNIX_POSSIBLY_SUPPORTED
static const bool IsWindows = false;
Expand All @@ -20,12 +20,12 @@ class TargetOS
#define TARGET_OS_RUNTIMEDETERMINED
#define TARGET_UNIX_OS_RUNTIMEDETERMINED
static bool OSSettingConfigured;
static bool IsMacOS;
static bool IsApplePlatform;
#else
#if defined(TARGET_OSX)
static const bool IsMacOS = true;
static const bool IsApplePlatform = true;
#else
static const bool IsMacOS = false;
static const bool IsApplePlatform = false;
#endif
#endif
#else
Expand All @@ -35,7 +35,7 @@ class TargetOS
static bool OSSettingConfigured;
static bool IsWindows;
static bool IsUnix;
static bool IsMacOS;
static bool IsApplePlatform;
#endif
};

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
regNumber srcReg = genConsumeReg(source);
assert((srcReg != REG_NA) && (genIsValidFloatReg(srcReg)));

assert(compMacOsArm64Abi() || treeNode->GetStackByteSize() % TARGET_POINTER_SIZE == 0);
assert(compAppleArm64Abi() || treeNode->GetStackByteSize() % TARGET_POINTER_SIZE == 0);

#ifdef TARGET_ARM64
if (treeNode->GetStackByteSize() == 12)
Expand All @@ -825,7 +825,7 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
}

var_types slotType = genActualType(source);
if (compMacOsArm64Abi())
if (compAppleArm64Abi())
{
// Small typed args do not get their own full stack slots, so make
// sure we do not overwrite adjacent arguments.
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1786,9 +1786,9 @@ void CodeGen::genGenerateMachineCode()
{
printf(" - Windows");
}
else if (TargetOS::IsMacOS)
else if (TargetOS::IsApplePlatform)
{
printf(" - MacOS");
printf(" - Apple");
}
else if (TargetOS::IsUnix)
{
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6063,17 +6063,17 @@ int Compiler::compCompile(CORINFO_MODULE_HANDLE classPtr,
noway_assert(TargetOS::OSSettingConfigured);
#endif

if (TargetOS::IsMacOS)
if (TargetOS::IsApplePlatform)
{
info.compMatchedVM = info.compMatchedVM && (eeInfo->osType == CORINFO_MACOS);
info.compMatchedVM = info.compMatchedVM && (eeInfo->osType == CORINFO_APPLE);
}
else if (TargetOS::IsUnix)
{
if (TargetArchitecture::IsX64)
{
// MacOS x64 uses the Unix jit variant in crossgen2, not a special jit
// Apple x64 uses the Unix jit variant in crossgen2, not a special jit
info.compMatchedVM =
info.compMatchedVM && ((eeInfo->osType == CORINFO_UNIX) || (eeInfo->osType == CORINFO_MACOS));
info.compMatchedVM && ((eeInfo->osType == CORINFO_UNIX) || (eeInfo->osType == CORINFO_APPLE));
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4149,7 +4149,7 @@ class Compiler
assert(varDsc->lvType == TYP_SIMD12);

#if defined(TARGET_64BIT)
assert(compMacOsArm64Abi() || varDsc->lvSize() == 16);
assert(compAppleArm64Abi() || varDsc->lvSize() == 16);
#endif // defined(TARGET_64BIT)

// We make local variable SIMD12 types 16 bytes instead of just 12.
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/jit/ee_il_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ bool TargetOS::OSSettingConfigured = false;
bool TargetOS::IsWindows = false;
bool TargetOS::IsUnix = false;
#endif
bool TargetOS::IsMacOS = false;
bool TargetOS::IsApplePlatform = false;
#endif

/*****************************************************************************
Expand All @@ -330,10 +330,10 @@ bool TargetOS::IsMacOS = false;
void CILJit::setTargetOS(CORINFO_OS os)
{
#ifdef TARGET_OS_RUNTIMEDETERMINED
TargetOS::IsMacOS = os == CORINFO_MACOS;
TargetOS::IsApplePlatform = os == CORINFO_APPLE;
#ifndef TARGET_UNIX_OS_RUNTIMEDETERMINED // This define is only set if ONLY the different unix variants are
// runtimedetermined
TargetOS::IsUnix = (os == CORINFO_UNIX) || (os == CORINFO_MACOS);
TargetOS::IsUnix = (os == CORINFO_UNIX) || (os == CORINFO_APPLE);
TargetOS::IsWindows = os == CORINFO_WINNT;
#endif
TargetOS::OSSettingConfigured = true;
Expand Down Expand Up @@ -468,7 +468,7 @@ unsigned Compiler::eeGetArgSize(CORINFO_ARG_LIST_HANDLE list, CORINFO_SIG_INFO*
//
// Notes:
// Usually values passed on the stack are aligned to stack slot (i.e. pointer size), except for
// on macOS ARM ABI that allows packing multiple args into a single stack slot.
// on Apple ARM ABI that allows packing multiple args into a single stack slot.
//
// The arg size alignment can be different from the normal alignment. One
// example is on arm32 where a struct containing a double and float can
Expand All @@ -479,7 +479,7 @@ unsigned Compiler::eeGetArgSize(CORINFO_ARG_LIST_HANDLE list, CORINFO_SIG_INFO*
// static
unsigned Compiler::eeGetArgSizeAlignment(var_types type, bool isFloatHfa)
{
if (compMacOsArm64Abi())
if (compAppleArm64Abi())
{
if (isFloatHfa)
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1275,14 +1275,14 @@ void CallArgABIInformation::SetHfaType(var_types type, unsigned hfaSlots)
//
// Remarks:
// This function will determine how the argument size needs to be rounded. On
// most ABIs all arguments are rounded to stack pointer size, but macOS arm64
// most ABIs all arguments are rounded to stack pointer size, but Apple arm64
// ABI is an exception as it allows packing some small arguments into the
// same stack slot.
//
void CallArgABIInformation::SetByteSize(unsigned byteSize, unsigned byteAlignment, bool isStruct, bool isFloatHfa)
{
unsigned roundedByteSize;
if (compMacOsArm64Abi())
if (compAppleArm64Abi())
{
// Only struct types need extension or rounding to pointer size, but HFA<float> does not.
if (isStruct && !isFloatHfa)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -4551,7 +4551,7 @@ struct CallArgABIInformation
void SetMultiRegNums();

// Return number of stack slots that this argument is taking.
// This value is not meaningful on macOS arm64 where multiple arguments can
// This value is not meaningful on Apple arm64 where multiple arguments can
// be passed in the same stack slot.
unsigned GetStackSlotsNumber() const
{
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/jit/helperexpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,19 +599,19 @@ bool Compiler::fgExpandThreadLocalAccessForCall(BasicBlock** pBlock, Statement*
// Base of coreclr's thread local storage
tlsValue = gtNewIndir(TYP_I_IMPL, tlsValue, GTF_IND_NONFAULTING | GTF_IND_INVARIANT);
}
else if (TargetOS::IsMacOS)
else if (TargetOS::IsApplePlatform)
{
// For OSX x64/arm64, we need to get the address of relevant __thread_vars section of
// For Apple x64/arm64, we need to get the address of relevant __thread_vars section of
// the thread local variable `t_ThreadStatics`. Address of `tlv_get_address` is stored
// in this entry, which we dereference and invoke it, passing the __thread_vars address
// present in `threadVarsSection`.
//
// Code sequence to access thread local variable on osx/x64:
// Code sequence to access thread local variable on Apple/x64:
//
// mov rdi, threadVarsSection
// call [rdi]
//
// Code sequence to access thread local variable on osx/arm64:
// Code sequence to access thread local variable on Apple/arm64:
//
// mov x0, threadVarsSection
// mov x1, [x0]
Expand Down
14 changes: 7 additions & 7 deletions src/coreclr/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,10 +1230,10 @@ void Compiler::lvaInitUserArgs(InitVarDscInfo* varDscInfo, unsigned skipArgs, un
#else
unsigned argAlignment = eeGetArgSizeAlignment(origArgType, (hfaType == TYP_FLOAT));
// We expect the following rounding operation to be a noop on all
// ABIs except ARM (where we have 8-byte aligned args) and macOS
// ABIs except ARM (where we have 8-byte aligned args) and Apple
// ARM64 (that allows to pack multiple smaller parameters in a
// single stack slot).
assert(compMacOsArm64Abi() || ((varDscInfo->stackArgSize % argAlignment) == 0));
assert(compAppleArm64Abi() || ((varDscInfo->stackArgSize % argAlignment) == 0));
#endif
varDscInfo->stackArgSize = roundUp(varDscInfo->stackArgSize, argAlignment);

Expand Down Expand Up @@ -3909,14 +3909,14 @@ var_types LclVarDsc::GetRegisterType() const
// when moving locals between register and stack. Because of this the
// returned type is usually at least one 4-byte stack slot. However, there
// are certain exceptions for promoted fields in OSR methods (that may refer
// back to the original frame) and due to macOS arm64 where subsequent small
// back to the original frame) and due to Apple arm64 where subsequent small
// parameters can be packed into the same stack slot.
//
var_types LclVarDsc::GetStackSlotHomeType() const
{
if (varTypeIsSmall(TypeGet()))
{
if (compMacOsArm64Abi() && lvIsParam && !lvIsRegArg)
if (compAppleArm64Abi() && lvIsParam && !lvIsRegArg)
{
// Allocated by caller and potentially only takes up a small slot
return GetRegisterType();
Expand Down Expand Up @@ -5443,7 +5443,7 @@ void Compiler::lvaAssignVirtualFrameOffsetsToArgs()
/* Update the argOffs to reflect arguments that are passed in registers */

noway_assert(codeGen->intRegState.rsCalleeRegArgCount <= MAX_REG_ARG);
noway_assert(compMacOsArm64Abi() || compArgSize >= codeGen->intRegState.rsCalleeRegArgCount * REGSIZE_BYTES);
noway_assert(compAppleArm64Abi() || compArgSize >= codeGen->intRegState.rsCalleeRegArgCount * REGSIZE_BYTES);

if (info.compArgOrder == Target::ARG_ORDER_L2R)
{
Expand Down Expand Up @@ -5597,7 +5597,7 @@ void Compiler::lvaAssignVirtualFrameOffsetsToArgs()
{
unsigned argumentSize = eeGetArgSize(argLst, &info.compMethodInfo->args);

assert(compMacOsArm64Abi() || argumentSize % TARGET_POINTER_SIZE == 0);
assert(compAppleArm64Abi() || argumentSize % TARGET_POINTER_SIZE == 0);

argOffs =
lvaAssignVirtualFrameOffsetToArg(lclNum++, argumentSize, argOffs UNIX_AMD64_ABI_ONLY_ARG(&callerArgOffset));
Expand Down Expand Up @@ -5986,7 +5986,7 @@ int Compiler::lvaAssignVirtualFrameOffsetToArg(unsigned lclNum,
#endif // TARGET_ARM
const bool isFloatHfa = (varDsc->lvIsHfa() && (varDsc->GetHfaType() == TYP_FLOAT));
const unsigned argAlignment = eeGetArgSizeAlignment(varDsc->lvType, isFloatHfa);
if (compMacOsArm64Abi())
if (compAppleArm64Abi())
{
argOffs = roundUp(argOffs, argAlignment);
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ GenTree* Lowering::NewPutArg(GenTreeCall* call, GenTree* arg, CallArg* callArg,
#if !defined(TARGET_64BIT)
assert(callArg->AbiInfo.ByteSize == 12);
#else // TARGET_64BIT
if (compMacOsArm64Abi())
if (compAppleArm64Abi())
{
assert(callArg->AbiInfo.ByteSize == 12);
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/lsraarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ int LinearScan::BuildPutArgStk(GenTreePutArgStk* argNode)
assert(!src->isContained());
srcCount = BuildOperandUses(src);
#if defined(FEATURE_SIMD)
if (compMacOsArm64Abi() && argNode->GetStackByteSize() == 12)
if (compAppleArm64Abi() && argNode->GetStackByteSize() == 12)
{
// Vector3 is read/written as two reads/writes: 8 byte and 4 byte.
// To assemble the vector properly we would need an additional int register.
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2510,7 +2510,7 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call
assert(size != 0);
assert(byteSize != 0);

if (compMacOsArm64Abi())
if (compAppleArm64Abi())
{
// Arm64 Apple has a special ABI for passing small size arguments on stack,
// bytes are aligned to 1-byte, shorts to 2-byte, int/float to 4-byte, etc.
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ inline bool compFeatureVarArg()
{
return TargetOS::IsWindows && !TargetArchitecture::IsArm32;
}
inline bool compMacOsArm64Abi()
inline bool compAppleArm64Abi()
{
return TargetArchitecture::IsArm64 && TargetOS::IsMacOS;
return TargetArchitecture::IsArm64 && TargetOS::IsApplePlatform;
}
inline bool compFeatureArgSplit()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ mdType.Name is "WeakReference" or "WeakReference`1" &&
flagsEx |= (ushort)EETypeFlagsEx.HasCriticalFinalizerFlag;
}

if (type.Context.Target.IsOSXLike && IsTrackedReferenceWithFinalizer(type))
if (type.Context.Target.IsApplePlatform && IsTrackedReferenceWithFinalizer(type))
{
flagsEx |= (ushort)EETypeFlagsEx.IsTrackedReferenceWithFinalizerFlag;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3233,7 +3233,7 @@ private bool runWithSPMIErrorTrap(void* function, void* parameter)
public static CORINFO_OS TargetToOs(TargetDetails target)
{
return target.IsWindows ? CORINFO_OS.CORINFO_WINNT :
target.IsOSXLike ? CORINFO_OS.CORINFO_MACOS : CORINFO_OS.CORINFO_UNIX;
target.IsApplePlatform ? CORINFO_OS.CORINFO_APPLE : CORINFO_OS.CORINFO_UNIX;
}

private void getEEInfo(ref CORINFO_EE_INFO pEEInfoOut)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ public enum CORINFO_OS
{
CORINFO_WINNT,
CORINFO_UNIX,
CORINFO_MACOS,
CORINFO_APPLE,
}

public enum CORINFO_RUNTIME_ABI
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/tools/Common/TypeSystem/Common/TargetDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ public bool IsWindows
}

/// <summary>
/// Returns True if compiling for OSX family of operating systems.
/// Returns True if compiling for Apple family of operating systems.
/// Currently including OSX, MacCatalyst, iOS, iOSSimulator, tvOS and tvOSSimulator
/// </summary>
public bool IsOSXLike
public bool IsApplePlatform
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ internal static MarshallerKind GetDisabledMarshallerKind(

internal static bool ShouldCheckForPendingException(TargetDetails target, PInvokeMetadata metadata)
{
if (!target.IsOSXLike)
if (!target.IsApplePlatform)
return false;

const string ObjectiveCMsgSend = "objc_msgSend";
Expand All @@ -951,7 +951,7 @@ internal static bool ShouldCheckForPendingException(TargetDetails target, PInvok

internal static int? GetObjectiveCMessageSendFunction(TargetDetails target, string pinvokeModule, string pinvokeFunction)
{
if (!target.IsOSXLike || pinvokeModule != ObjectiveCLibrary)
if (!target.IsApplePlatform || pinvokeModule != ObjectiveCLibrary)
return null;

#pragma warning disable CA1416
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ public void BuildCFIMap(NodeFactory factory, ObjectNode node)
byte[] blobSymbolName = _sb.ToUtf8String().UnderlyingArray;
EmitSymbolDef(blobSymbolName);

if (_targetPlatform.IsOSXLike &&
if (_targetPlatform.IsApplePlatform &&
TryGetCompactUnwindEncoding(blob, out uint compactEncoding))
{
_offsetToCfiCompactEncoding[start] = compactEncoding;
Expand Down Expand Up @@ -771,7 +771,7 @@ public void EmitCFICodes(int offset)
Debug.Assert(false);
}

if (_targetPlatform.IsOSXLike)
if (_targetPlatform.IsApplePlatform)
{
// Emit a symbol for beginning of the frame. This is workaround for ld64
// linker bug which would produce DWARF with incorrect pcStart offsets for
Expand Down Expand Up @@ -850,7 +850,7 @@ public void BuildSymbolDefinitionMap(ObjectNode node, ISymbolDefinitionNode[] de

private void AppendExternCPrefix(Utf8StringBuilder sb)
{
if (_targetPlatform.IsOSXLike)
if (_targetPlatform.IsApplePlatform)
{
// On OSX-like systems, we need to prefix an extra underscore to account for correct linkage of
// extern "C" functions.
Expand Down Expand Up @@ -966,7 +966,7 @@ private bool ShouldShareSymbol(ObjectNode node)
if (_isSingleFileCompilation)
return false;

if (_targetPlatform.IsOSXLike)
if (_targetPlatform.IsApplePlatform)
return false;

if (!(node is ISymbolNode))
Expand Down
Loading