mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
YJIT: Try cfg!(target_feature = "lse")
This commit is contained in:
parent
3a524f619b
commit
4e2a9ca9a9
5 changed files with 5 additions and 37 deletions
19
configure.ac
19
configure.ac
|
@ -3764,24 +3764,7 @@ AS_CASE(["${YJIT_SUPPORT}"],
|
||||||
AC_CHECK_TOOL(CARGO, [cargo], [no])
|
AC_CHECK_TOOL(CARGO, [cargo], [no])
|
||||||
AS_IF([test x"$CARGO" = "xno"],
|
AS_IF([test x"$CARGO" = "xno"],
|
||||||
AC_MSG_ERROR([cargo is required. Installation instructions available at https://www.rust-lang.org/tools/install])
|
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]
|
|
||||||
)
|
|
||||||
])
|
|
||||||
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_LIBS="yjit/target/${rb_rust_target_subdir}/libyjit.a"
|
||||||
YJIT_OBJ='yjit.$(OBJEXT)'
|
YJIT_OBJ='yjit.$(OBJEXT)'
|
||||||
|
|
10
yjit.c
10
yjit.c
|
@ -998,16 +998,6 @@ rb_yjit_invalidate_all_method_lookup_assumptions(void)
|
||||||
// method caches, so we do nothing here for now.
|
// method caches, so we do nothing here for now.
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
rb_yjit_stats_supported(void)
|
|
||||||
{
|
|
||||||
#if defined(BROKEN_YJIT_STATS)
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Primitives used by yjit.rb
|
// Primitives used by yjit.rb
|
||||||
VALUE rb_yjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self);
|
VALUE rb_yjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self);
|
||||||
VALUE rb_yjit_trace_exit_locations_enabled_p(rb_execution_context_t *ec, VALUE self);
|
VALUE rb_yjit_trace_exit_locations_enabled_p(rb_execution_context_t *ec, VALUE self);
|
||||||
|
|
|
@ -275,7 +275,6 @@ fn main() {
|
||||||
.allowlist_function("rb_ENCODING_GET")
|
.allowlist_function("rb_ENCODING_GET")
|
||||||
.allowlist_function("rb_yjit_exit_locations_dict")
|
.allowlist_function("rb_yjit_exit_locations_dict")
|
||||||
.allowlist_function("rb_yjit_icache_invalidate")
|
.allowlist_function("rb_yjit_icache_invalidate")
|
||||||
.allowlist_function("rb_yjit_stats_supported")
|
|
||||||
|
|
||||||
// from vm_sync.h
|
// from vm_sync.h
|
||||||
.allowlist_function("rb_vm_barrier")
|
.allowlist_function("rb_vm_barrier")
|
||||||
|
|
|
@ -1296,6 +1296,3 @@ extern "C" {
|
||||||
line: ::std::os::raw::c_int,
|
line: ::std::os::raw::c_int,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
extern "C" {
|
|
||||||
pub fn rb_yjit_stats_supported() -> bool;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use crate::cruby::rb_yjit_stats_supported;
|
|
||||||
|
|
||||||
// Command-line options
|
// Command-line options
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
|
@ -154,7 +153,7 @@ pub fn parse_option(str_ptr: *const std::os::raw::c_char) -> Option<()> {
|
||||||
("no-type-prop", "") => unsafe { OPTIONS.no_type_prop = true },
|
("no-type-prop", "") => unsafe { OPTIONS.no_type_prop = true },
|
||||||
|
|
||||||
("stats", "") => {
|
("stats", "") => {
|
||||||
if unsafe { !rb_yjit_stats_supported() } {
|
if cfg!(target_arch = "aarch64") && !cfg!(target_feature = "lse") {
|
||||||
eprintln!("Your processor does not support --yjit-stats. Aborting.");
|
eprintln!("Your processor does not support --yjit-stats. Aborting.");
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue