mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 11:21:08 -10:00
* [llvm] Use explicit null checks with LLVM. When the LLVM backend is used for a method, explicit null checks will unconditionally be used at the mini IR level. We had previously used implicit null checks at the mini IR level combined with llvm-volatile loads and stores to avoid mis-optimization of the generated code. During AOT compilation, LLVM's `ImplicitNullChecks` pass is enabled. This conservatively elides these explicit null checks. This pass only modifies branches tagged with `make.implicit` metadata. Null check branches are now tagged with `make.implicit` metadata, with three exceptions: 1. For platforms with backends that do not support zero page fault handling, null check branches are not tagged with `make.implicit`. 2. This commit also adds a `MONO_DEBUG` option: `llvm-disable-implicit-null-checks`. When it is enabled, null check branches are not tagged with `make.implicit`. 3. This commit alters the behavior of the `explicit-null-checks` `MONO_DEBUG` option. Enabling `explicit-null-checks` also implies `llvm-disable-implicit-null-checks`, because this option is documented (e.g. in https://www.mono-project.com/docs/debug+profile/debug/) to completely disable signal/seh-based null checks. * Add llvm-disable-implicit-null-checks to the MONO_DEBUG help string. * Add llvm-disable-implicit-null-checks to mono.1. * Don't tag null checks in EH regions with `make.implicit`. This relocates the logic formerly used to guard individual LLVM-level loads and stores with explicit null checks inside EH regions. * Use atomic/volatile loads and stores for the terimation flag in thread-suspend-suspended. LLVM was hoisting the load of and branch against `finished` out of thread t1's loop, resulting in an infinite spin. * Use ImplicitNullChecks with LLVM JIT. * Suppress emission of the .llvm_faultmaps section. Bump external/llvm to release_60 (7a8dc89adbe7e123220e070a527e096ee91e66d5). * [ci] use LLVM built from repository