ruby-changes:72750
From: John <ko1@a...>
Date: Sat, 30 Jul 2022 08:32:30 +0900 (JST)
Subject: [ruby-changes:72750] fbd24793cb (master): Add --enable-yjit=stats configure option
https://git.ruby-lang.org/ruby.git/commit/?id=fbd24793cb From fbd24793cb7be2429edafcf11d7dd4a7d11f5c95 Mon Sep 17 00:00:00 2001 From: John Hawthorn <john@h...> Date: Wed, 6 Jul 2022 22:14:25 -0700 Subject: Add --enable-yjit=stats configure option --- configure.ac | 27 +++++++++++++++++++-------- yjit/Cargo.toml | 3 +++ yjit/yjit.mk | 7 +++++-- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 4fe1623966..46ea038865 100644 --- a/configure.ac +++ b/configure.ac @@ -3736,7 +3736,7 @@ CARGO= https://github.com/ruby/ruby/blob/trunk/configure.ac#L3736 CARGO_BUILD_ARGS= YJIT_LIBS= AS_CASE(["${YJIT_SUPPORT}"], -[yes|dev], [ +[yes|dev|stats], [ AS_IF([test x"$enable_jit_support" = "xno"], AC_MSG_ERROR([--disable-jit-support but --enable-yjit. YJIT requires JIT support]) ) @@ -3744,16 +3744,27 @@ AS_CASE(["${YJIT_SUPPORT}"], https://github.com/ruby/ruby/blob/trunk/configure.ac#L3744 AS_IF([test x"$RUSTC" = "xno"], AC_MSG_ERROR([rustc is required. Installation instructions available at https://www.rust-lang.org/tools/install]) ) - AS_IF([test x"$YJIT_SUPPORT" = "xyes"], - [rb_rust_target_subdir=release - CARGO_BUILD_ARGS='--release'], - [rb_rust_target_subdir=debug - CARGO_BUILD_ARGS='--features stats,disasm,asm_comments' + + AS_CASE(["${YJIT_SUPPORT}"], + [yes], [ + rb_rust_target_subdir=release + ], + [dev], [ + rb_rust_target_subdir=debug + CARGO_BUILD_ARGS='--features stats,disasm,asm_comments' + AC_DEFINE(RUBY_DEBUG, 1) + ], + [stats], [ + rb_rust_target_subdir=stats + CARGO_BUILD_ARGS='--profile stats --features stats,disasm,asm_comments' + ]) + + 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_DEFINE(RUBY_DEBUG, 1)]) + ])) + YJIT_LIBS="yjit/target/${rb_rust_target_subdir}/libyjit.a" YJIT_OBJ='yjit.$(OBJEXT)' AC_DEFINE(USE_YJIT, 1) diff --git a/yjit/Cargo.toml b/yjit/Cargo.toml index a5208049cb..c7ff31ec2c 100644 --- a/yjit/Cargo.toml +++ b/yjit/Cargo.toml @@ -30,6 +30,9 @@ debug = true https://github.com/ruby/ruby/blob/trunk/yjit/Cargo.toml#L30 debug-assertions = true overflow-checks = true +[profile.stats] +inherits = "release" + [profile.release] # NOTE: --enable-yjit builds use `rustc` without going through Cargo. You # might want to update the `rustc` invocation if you change this profile. diff --git a/yjit/yjit.mk b/yjit/yjit.mk index eb1f5d1fe1..efd4ff0c40 100644 --- a/yjit/yjit.mk +++ b/yjit/yjit.mk @@ -25,13 +25,16 @@ yjit-static-lib-no: https://github.com/ruby/ruby/blob/trunk/yjit/yjit.mk#L25 $(ECHO) 'Error: Tried to build YJIT without configuring it first. Check `make showconfig`?' @false -yjit-static-lib-dev: - $(ECHO) 'building Rust YJIT (dev mode)' +yjit-static-lib-cargo: + $(ECHO) 'building Rust YJIT ($(YJIT_SUPPORT) mode)' $(Q)$(CHDIR) $(top_srcdir)/yjit && \ CARGO_TARGET_DIR='$(CARGO_TARGET_DIR)' \ CARGO_TERM_PROGRESS_WHEN='never' \ $(CARGO) $(CARGO_VERBOSE) build $(CARGO_BUILD_ARGS) +yjit-static-lib-dev: yjit-static-lib-cargo +yjit-static-lib-stats: yjit-static-lib-cargo + # This PHONY prerequisite makes it so that we always run cargo. When there are # no Rust changes on rebuild, Cargo does not touch the mtime of the static # library and GNU make avoids relinking. $(empty) seems to be important to -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/