From ad8afe4f8c9537e8652ae35b301366d737bc1e04 Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Mon, 13 Mar 2017 16:32:15 -0700 Subject: Build Linux altjit for x86 and amd64 (#10120) Enable Windows hosted, Linux target amd64 altjit With this change, we build a JIT that runs on Windows amd64 and targets Linux amd64, as an altjit named linuxnonjit.dll. This is useful for debugging, or generating asm code or diffs. You can even easily create Windows/non-Windows asm diffs (either to compare the asm, or compare the generated code size). For this to work, the JIT-EE interface method getSystemVAmd64PassStructInRegisterDescriptor() was changed to always be built in, by defining `FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF` in all AMD64 builds. The `_ITF` suffix indicates that this is functionality specific to implementing the JIT-EE interface contract. There were many places in the VM that used this interchangeably with `FEATURE_UNIX_AMD64_STRUCT_PASSING`. Now, `FEATURE_UNIX_AMD64_STRUCT_PASSING` means code in the VM needed to implement this feature, but not required to implement the JIT-EE interface contract. In particular, MethodTables compute and cache the "eightbyte" info of structs when loading a type. This is not done when only `FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF` is set, to avoid altering MethodTable behavior on non-Unix AMD64 builds. Instead, if `getSystemVAmd64PassStructInRegisterDescriptor()` is called on a non-Unix build (by the altjit), the `ClassifyEightBytes()` function is called, and nothing is cached. Hopefully (though it was hard for me to guarantee by observation), calling `ClassifyEightBytes()` does not have any side effects on MethodTables. It doesn't really matter, since if called for altjit, we don't care too much about running. The previously used `PLATFORM_UNIX` define is now insufficient. I introduced the `#define` macros `_HOST_UNIX_` to indicate the JIT being built will run on Unix, and `_TARGET_UNIX_` to indicate the JIT is generating code targeting Unix. Some things were converted to use the `UNIX_AMD64_ABI` define, which makes more sense. --- src/vm/methodtable.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/vm/methodtable.h') diff --git a/src/vm/methodtable.h b/src/vm/methodtable.h index 6e04b8a783..d5cb5ba866 100644 --- a/src/vm/methodtable.h +++ b/src/vm/methodtable.h @@ -1070,7 +1070,7 @@ public: private: #if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF) - void AssignClassifiedEightByteTypes(SystemVStructRegisterPassingHelperPtr helperPtr, unsigned int nestingLevel); + void AssignClassifiedEightByteTypes(SystemVStructRegisterPassingHelperPtr helperPtr, unsigned int nestingLevel) const; // Builds the internal data structures and classifies struct eightbytes for Amd System V calling convention. bool ClassifyEightBytesWithManagedLayout(SystemVStructRegisterPassingHelperPtr helperPtr, unsigned int nestingLevel, unsigned int startOffsetOfStruct, bool isNativeStruct); bool ClassifyEightBytesWithNativeLayout(SystemVStructRegisterPassingHelperPtr helperPtr, unsigned int nestingLevel, unsigned int startOffsetOfStruct, bool isNativeStruct); @@ -2012,7 +2012,7 @@ public: } #endif // FEATURE_HFA -#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF) +#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING) inline bool IsRegPassedStruct() { LIMITED_METHOD_CONTRACT; @@ -2024,7 +2024,7 @@ public: LIMITED_METHOD_CONTRACT; SetFlag(enum_flag_IsRegStructPassed); } -#endif // defined(FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF) +#endif // defined(FEATURE_UNIX_AMD64_STRUCT_PASSING) #ifdef FEATURE_HFA @@ -3801,18 +3801,18 @@ private: enum_flag_HasPreciseInitCctors = 0x00000400, // Do we need to run class constructors at allocation time? (Not perf important, could be moved to EEClass #if defined(FEATURE_HFA) -#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF) -#error Can't define both FEATURE_HFA and FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF +#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING) +#error Can't define both FEATURE_HFA and FEATURE_UNIX_AMD64_STRUCT_PASSING #endif enum_flag_IsHFA = 0x00000800, // This type is an HFA (Homogenous Floating-point Aggregate) #endif // FEATURE_HFA -#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF) +#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING) #if defined(FEATURE_HFA) -#error Can't define both FEATURE_HFA and FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF +#error Can't define both FEATURE_HFA and FEATURE_UNIX_AMD64_STRUCT_PASSING #endif enum_flag_IsRegStructPassed = 0x00000800, // This type is a System V register passed struct. -#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING_ITF +#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING enum_flag_IsByRefLike = 0x00001000, -- cgit v1.2.3