8000 RJIT: Just skip generating code for aarch64/arm64 (#9221) · ruby/ruby@0f1c7e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0f1c7e3

Browse files
authored
RJIT: Just skip generating code for aarch64/arm64 (#9221)
1 parent c83a648 commit 0f1c7e3

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

configure.ac

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3916,26 +3916,26 @@ AC_SUBST(CARGO_BUILD_ARGS)dnl for selecting Rust build profiles
39163916
AC_SUBST(YJIT_LIBS)dnl for optionally building the Rust parts of YJIT
39173917
AC_SUBST(YJIT_OBJ)dnl for optionally building the C parts of YJIT
39183918
3919-
dnl Currently, RJIT only supports Unix x86_64 platforms.
3919+
dnl RJIT supports only x86_64 platforms, but allows arm64/aarch64 for custom JITs.
39203920
RJIT_TARGET_OK=no
39213921
AS_IF([test "$cross_compiling" = no],
39223922
AS_CASE(["$target_cpu-$target_os"],
39233923
[*android*], [
39243924
RJIT_TARGET_OK=no
39253925
],
3926-
[x86_64-darwin*], [
3926+
[arm64-darwin*|aarch64-darwin*|x86_64-darwin*], [
39273927
RJIT_TARGET_OK=yes
39283928
],
3929-
[x86_64-*linux*], [
3929+
[arm64-*linux*|aarch64-*linux*|x86_64-*linux*], [
39303930
RJIT_TARGET_OK=yes
39313931
],
3932-
[x86_64-*bsd*], [
3932+
[arm64-*bsd*|aarch64-*bsd*|x86_64-*bsd*], [
39333933
RJIT_TARGET_OK=yes
39343934
]
39353935
)
39363936
)
39373937
3938-
dnl Build RJIT on Unix x86_64 platforms or if --enable-rjit is specified.
3938+
dnl Build RJIT on supported platforms or if --enable-rjit is specified.
39393939
AC_ARG_ENABLE(rjit,
39403940
AS_HELP_STRING([--enable-rjit],
39413941
[enable pure-Ruby JIT compiler. enabled by default on Unix x86_64 platforms]),

lib/ruby_vm/rjit/compiler.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def initialize
5959
# @param iseq `RubyVM::RJIT::CPointer::Struct_rb_iseq_t`
6060
# @param cfp `RubyVM::RJIT::CPointer::Struct_rb_control_frame_t`
6161
def compile(iseq, cfp)
62+
return unless supported_platform?
6263
pc = cfp.pc.to_i
6364
jit = JITState.new(iseq:, cfp:)
6465
asm = Assembler.new
@@ -505,5 +506,12 @@ def assert(cond)
505506
raise "'#{cond.inspect}' was not true"
506507
end
507508
end
509+
510+
def supported_platform?
511+
return @supported_platform if defined?(@supported_platform)
512+
@supported_platform = RUBY_PLATFORM.match?(/x86_64/).tap do |supported|
513+
warn "warning: RJIT does not support #{RUBY_PLATFORM} yet" unless supported
514+
end
515+
end
508516
end
509517
end

0 commit comments

Comments
 (0)
0