diff options
Diffstat (limited to 'src/Common/src/TypeSystem/Common/TargetDetails.cs')
-rw-r--r-- | src/Common/src/TypeSystem/Common/TargetDetails.cs | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/src/Common/src/TypeSystem/Common/TargetDetails.cs b/src/Common/src/TypeSystem/Common/TargetDetails.cs index 31323e59b..01ede185f 100644 --- a/src/Common/src/TypeSystem/Common/TargetDetails.cs +++ b/src/Common/src/TypeSystem/Common/TargetDetails.cs @@ -18,7 +18,7 @@ namespace Internal.TypeSystem ARM64, X64, X86, - Wasm32 + Wasm32, } /// <summary> @@ -49,7 +49,11 @@ namespace Internal.TypeSystem /// <summary> /// Jit runtime ABI /// </summary> - Jit + Jit, + /// <summary> + /// Cross-platform portable C++ codegen + /// </summary> + CppCodegen, } /// <summary> @@ -102,6 +106,14 @@ namespace Internal.TypeSystem } } + public bool SupportsRelativePointers + { + get + { + return Abi != TargetAbi.CppCodegen; + } + } + /// <summary> /// Gets the maximum alignment to which something can be aligned /// </summary> @@ -128,17 +140,36 @@ namespace Internal.TypeSystem } /// <summary> - /// Gets the minimum required method alignment. + /// Gets the minimum required alignment for methods whose address is visible + /// to managed code. /// </summary> public int MinimumFunctionAlignment { get { // We use a minimum alignment of 4 irrespective of the platform. + // This is to prevent confusing the method address with a fat function pointer. return 4; } } + public int MinimumCodeAlignment + { + get + { + switch (Architecture) + { + case TargetArchitecture.ARM: + case TargetArchitecture.ARMEL: + return 2; + case TargetArchitecture.ARM64: + return 4; + default: + return 1; + } + } + } + public TargetDetails(TargetArchitecture architecture, TargetOS targetOS, TargetAbi abi) { Architecture = architecture; @@ -204,7 +235,6 @@ namespace Internal.TypeSystem { case TargetArchitecture.ARM: case TargetArchitecture.ARMEL: - case TargetArchitecture.Wasm32: // ARM supports two alignments for objects on the GC heap (4 byte and 8 byte) if (fieldAlignment.IsIndeterminate) return LayoutInt.Indeterminate; @@ -217,6 +247,7 @@ namespace Internal.TypeSystem case TargetArchitecture.ARM64: return new LayoutInt(8); case TargetArchitecture.X86: + case TargetArchitecture.Wasm32: return new LayoutInt(4); default: throw new NotSupportedException(); |