Skip to content

Stop building JIT as altjit or not altjit #41643

@BruceForstall

Description

@BruceForstall

Currently, a JIT is built with the ALT_JIT define if it is intended to be used as an "altjit". Only when this is defined can a JIT define opts.altJit to true. This alters what functions are compiled by the JIT, and what COMPlus variables apply to the JIT versus the non-altjit.

This is problematic because we would like to be able to use any JIT in "altjit position" without this special build.

Proposal: the determination about whether a JIT is an altjit should be made via the JIT/EE interface. When the VM invokes the JIT, such as invokeCompileMethodHelper, it knows it is invoking an altjit:

 ret = jitMgr->m_alternateJit->compileMethod( comp,
                                              info,
                                              CORJIT_FLAGS::CORJIT_FLAG_CALL_GETJITFLAGS,
                                              nativeEntry,
                                              nativeSizeOfCode);

It should either tell the JIT (probably by a new method in the ICorJitCompiler interface; we typically can't change the compileMethod signature), or the JIT should use a callback on the JIT/EE interface to ask if it is an altjit.

This should help scenarios such as crossgen2, where all the cross-compilers could be built as "normal" JITs, and used both for crossgen2 cross-compilation as well as in altjit position for SuperPMI, for example. See #41126.

category:implementation
theme:altjit
skill-level:beginner
cost:small

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions