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

YJIT: Use autoconf to detect support

This commit is contained in:
Takashi Kokubun 2022-09-21 11:58:45 +09:00
parent 119618b472
commit 6b8daf603f
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD
2 changed files with 18 additions and 7 deletions

View file

@ -3761,10 +3761,23 @@ AS_CASE(["${YJIT_SUPPORT}"],
])
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_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
@%:@ifdef __aarch64__
asm volatile(".arch armv8-a+lse\nldaddal x0,x0,@<:@sp@:>@");
@%:@endif
]])], [rb_cv_broken_yjit_stats=no], [rb_cv_broken_yjit_stats=yes])
])
AS_IF([test "$rb_cv_broken_yjit_stats" = yes], [
AC_DEFINE(BROKEN_YJIT_STATS, 1)
])
)
YJIT_LIBS="yjit/target/${rb_rust_target_subdir}/libyjit.a"
YJIT_OBJ='yjit.$(OBJEXT)'

4
yjit.c
View file

@ -1001,9 +1001,7 @@ rb_yjit_invalidate_all_method_lookup_assumptions(void)
bool
rb_yjit_stats_supported(void)
{
// Insn::IncrCounter uses ldaddal, which works only on ARMv8.1+.
// __ARM_FEATURE_ATOMICS: https://developer.arm.com/documentation/101028/0010/Feature-test-macros
#if defined(__aarch64__) && !defined(__ARM_FEATURE_ATOMICS)
#if defined(BROKEN_YJIT_STATS)
return false;
#else
return true;