Build Linux altjit for x86 and amd64 (dotnet/coreclr#10120)
authorBruce Forstall <brucefo@microsoft.com>
Mon, 13 Mar 2017 23:32:15 +0000 (16:32 -0700)
committerGitHub <noreply@github.com>
Mon, 13 Mar 2017 23:32:15 +0000 (16:32 -0700)
commitc0f397aedd9b84f8d0ab19bea2a5068111166e8a
treeac3d347e949f5f84d48894fd897f6773980e130a
parent015ba9f1a442b53acace6a5669f2c4a59b787ccd
Build Linux altjit for x86 and amd64 (dotnet/coreclr#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.

Commit migrated from https://github.com/dotnet/coreclr/commit/ad8afe4f8c9537e8652ae35b301366d737bc1e04
25 files changed:
src/coreclr/CMakeLists.txt
src/coreclr/clrdefinitions.cmake
src/coreclr/src/debug/daccess/nidump.cpp
src/coreclr/src/jit/CMakeLists.txt
src/coreclr/src/jit/codegencommon.cpp
src/coreclr/src/jit/codegenlinear.h
src/coreclr/src/jit/codegenxarch.cpp
src/coreclr/src/jit/compiler.cpp
src/coreclr/src/jit/dll/CMakeLists.txt
src/coreclr/src/jit/ee_il_dll.cpp
src/coreclr/src/jit/emitxarch.cpp
src/coreclr/src/jit/jit.h
src/coreclr/src/jit/jitstd/type_traits.h
src/coreclr/src/jit/linuxnonjit/CMakeLists.txt [new file with mode: 0644]
src/coreclr/src/jit/target.h
src/coreclr/src/jit/unwindamd64.cpp
src/coreclr/src/jit/utils.cpp
src/coreclr/src/jit/valuenum.h
src/coreclr/src/vm/callhelpers.cpp
src/coreclr/src/vm/class.h
src/coreclr/src/vm/jitinterface.cpp
src/coreclr/src/vm/methodtable.cpp
src/coreclr/src/vm/methodtable.h
src/coreclr/src/vm/methodtablebuilder.cpp
src/coreclr/src/vm/methodtablebuilder.h