1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

YJIT: Support Rust 1.58.1 for --yjit-stats on Arm (#6410)

* YJIT: Test Rust 1.58.1 as well on Cirrus

* YJIT: Avoid using a Rust 1.60.0 feature

* YJIT: Use autoconf to detect support

* YJIT: We actually need to run it

for checking it properly

* YJIT: Try cfg!(target_feature = "lse")

* Revert "YJIT: Try cfg!(target_feature = "lse")"

This reverts commit 4e2a9ca9a9.

* YJIT: Add --features stats only when it works

* Update configure.ac

Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
This commit is contained in:
Takashi Kokubun 2022-09-24 05:17:54 +09:00 committed by GitHub
parent 7588f21851
commit 912ea8257a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2022-09-24 05:18:20 +09:00
Merged-By: maximecb <maximecb@ruby-lang.org>
3 changed files with 31 additions and 21 deletions

View file

@ -90,6 +90,7 @@ yjit_task:
matrix:
- CC: clang-12
configure: --enable-yjit=dev
rustup_init: --default-toolchain=1.58.1
- CC: gcc-11
configure: --enable-yjit
id_script: id
@ -107,7 +108,7 @@ yjit_task:
install_rust_script:
- sudo apt-get update -y
- sudo apt-get install -y curl
- "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"
- "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y $rustup_init"
autogen_script: ./autogen.sh
configure_script: >-
source $HOME/.cargo/env && ./configure -C

View file

@ -3748,23 +3748,44 @@ AS_CASE(["${YJIT_SUPPORT}"],
],
[dev], [
rb_rust_target_subdir=debug
CARGO_BUILD_ARGS='--features stats,disasm,asm_comments'
CARGO_BUILD_ARGS='--features disasm,asm_comments'
AC_DEFINE(RUBY_DEBUG, 1)
],
[dev_nodebug], [
rb_rust_target_subdir=dev_nodebug
CARGO_BUILD_ARGS='--profile dev_nodebug --features stats,disasm,asm_comments'
CARGO_BUILD_ARGS='--profile dev_nodebug --features disasm,asm_comments'
],
[stats], [
rb_rust_target_subdir=stats
CARGO_BUILD_ARGS='--profile stats --features stats'
CARGO_BUILD_ARGS='--profile stats'
])
AS_IF([test -n "${CARGO_BUILD_ARGS}"], [
AC_CHECK_TOOL(CARGO, [cargo], [no])
AS_IF([test x"$CARGO" = "xno"],
AC_MSG_ERROR([cargo is required. Installation instructions available at https://www.rust-lang.org/tools/install])
]))
AC_CHECK_TOOL(CARGO, [cargo], [no])
AS_IF([test x"$CARGO" = "xno"],
AC_MSG_ERROR([cargo is required. Installation instructions available at https://www.rust-lang.org/tools/install])
])
# Insn::IncrCounter uses ldaddal, which works only on ARMv8.1+.
AC_CACHE_CHECK(yjit stats are broken, rb_cv_broken_yjit_stats, [
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[]], [[
@%:@ifdef __aarch64__
asm volatile(".arch armv8-a+lse\n"
"ldaddal xzr, xzr, @<:@sp@:>@");
@%:@endif
]])],
[rb_cv_broken_yjit_stats=no],
[rb_cv_broken_yjit_stats=yes],
[rb_cv_broken_yjit_stats=yes]
)
])
# This won't enable stats in release builds because we don't use cargo
# for release builds, use rustc directly
AS_IF([test "$rb_cv_broken_yjit_stats" = no], [
CARGO_BUILD_ARGS="${CARGO_BUILD_ARGS} --features stats"
])
)
YJIT_LIBS="yjit/target/${rb_rust_target_subdir}/libyjit.a"
AS_CASE(["$target_os"],[openbsd*],[

View file

@ -151,19 +151,7 @@ pub fn parse_option(str_ptr: *const std::os::raw::c_char) -> Option<()> {
("greedy-versioning", "") => unsafe { OPTIONS.greedy_versioning = true },
("no-type-prop", "") => unsafe { OPTIONS.no_type_prop = true },
("stats", "") => {
// Insn::IncrCounter uses ldaddal, which works only on ARMv8.1+.
#[cfg(feature = "stats")]
#[cfg(target_arch = "aarch64")]
if !std::arch::is_aarch64_feature_detected!("lse") {
eprintln!("Your processor does not support --yjit-stats. Aborting.");
std::process::exit(1);
}
unsafe { OPTIONS.gen_stats = true }
},
("stats", "") => unsafe { OPTIONS.gen_stats = true },
("trace-exits", "") => unsafe { OPTIONS.gen_trace_exits = true; OPTIONS.gen_stats = true },
("dump-insns", "") => unsafe { OPTIONS.dump_insns = true },
("verify-ctx", "") => unsafe { OPTIONS.verify_ctx = true },