Commit graph

638 commits

Author SHA1 Message Date
Takashi Kokubun
b22eb0e468
ZJIT: Add --zjit-stats (#14034) 2025-07-29 10:00:15 -07:00
Hiroshi SHIBATA
be7b1164e6 Split autogenerated dependency to depend file from common.mk 2025-07-25 19:50:06 +09:00
John Hawthorn
7f25b8f5fb Disable TSAN for rb_gc_mark_machine_context
Previously this was listed as a suppression, but we actually want this
permanently unsanitized. This should be faster and more reliable since
TASN won't have to match against symbolicated backtraces.
2025-07-24 16:35:42 -07:00
Nobuyoshi Nakada
5239dc8a0b Revert "Suppress occasional autoconf warnings"
This reverts commit 32bfb61d34, that
requires autoconf 2.70's improved whitespace handling.  It is too
early for some platforms yet.

Fix GH-13910
2025-07-17 09:53:24 +09:00
Alan Wu
5ee3937a9c ZJIT: Have make zjit-test use the same Cargo features as miniruby
This is so that e.g. building with `--enable-zjit=dev` will test with the
disassembly feature. It makes more sense, saves on build time and
reveals that
`backend::arm64::tests::sp_movements_are_single_instruction` was in
fact failing with the `disasm` feature.
2025-07-16 14:10:22 -04:00
Nobuyoshi Nakada
32bfb61d34 Suppress occasional autoconf warnings
```
configure.ac:2803: warning: AC_CHECK_FUNCS(\
): you should use literals
../autoconf-2.72/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
../autoconf-2.72/lib/m4sugar/m4sh.m4:697: AS_IF is expanded from...
```
2025-07-16 18:48:35 +09:00
Nobuyoshi Nakada
c5f7d274d7
Check for 64bit atomic operations
May not be supported on some 32bit architectures.

```
/usr/lib/gcc-cross/m68k-linux-gnu/14/../../../../m68k-linux-gnu/bin/ld: ../../libruby-static.a(vm.o): in function `rbimpl_atomic_u64_set_relaxed':
/home/ubuntu/build/ruby/master/m68k-linux/../src/ruby_atomic.h:60:(.text+0x2468): undefined reference to `__atomic_store_8'
/usr/lib/gcc-cross/m68k-linux-gnu/14/../../../../m68k-linux-gnu/bin/ld: ../../libruby-static.a(vm.o): in function `rbimpl_atomic_u64_load_relaxed':
/home/ubuntu/build/ruby/master/m68k-linux/../src/ruby_atomic.h:43:(.text+0x2950):
undefined reference to `__atomic_load_8'
```
2025-06-04 15:31:28 +09:00
Takashi Kokubun
cce89a6f69
ZJIT: Add --enable-zjit=dev_nodebug (#13456) 2025-05-28 17:20:10 -04:00
Nobuyoshi Nakada
8dbff6e402
Silence error messages of cd to non-existent opt directories 2025-05-20 20:43:58 +09:00
Takashi Kokubun
a7ef9a44a6
ZJIT: Propagate disasm feature to ZJIT and YJIT (#13372)
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2025-05-19 10:34:29 -07:00
Alan Wu
92b218fbc3 YJIT: ZJIT: Allow both JITs in the same build
This commit allows building YJIT and ZJIT simultaneously, a "combo
build". Previously, `./configure --enable-yjit --enable-zjit` failed. At
runtime, though, only one of the two can be enabled at a time.

Add a root Cargo workspace that contains both the yjit and zjit crate.
The common Rust build integration mechanisms are factored out into
defs/jit.mk.

Combo YJIT+ZJIT dev builds are supported; if either JIT uses
`--enable-*=dev`, both of them are built in dev mode.

The combo build requires Cargo, but building one JIT at a time with only
rustc in release build remains supported.
2025-05-15 00:39:03 +09:00
Nobuyoshi Nakada
46e4c86737 Detect clock_gettime and clock_getres for winpthreads 2025-05-12 17:45:39 +09:00
Alan Wu
33909a1c69 YJIT: ZJIT: Share identical glue functions
Working towards having YJIT and ZJIT in the same build, we need to
deduplicate some glue code that would otherwise cause name collision.
Add jit.c for this and build it for YJIT and ZJIT builds. Update bindgen
to look at jit.c; some shuffling of functions in the output, but the set
of functions shouldn't have changed.
2025-05-02 23:47:57 +09:00
Takashi Kokubun
338b9c2064 Enable YJIT by default 2025-04-18 21:53:01 +09:00
Takashi Kokubun
bc443eef7a Let ZJIT and YJIT disable each other 2025-04-18 21:52:58 +09:00
Takashi Kokubun
92d48f47a3 Use separate cargo build flags 2025-04-18 21:52:57 +09:00
Alan Wu
5208720746 Pass CARGO_BUILD_ARGS through properly 2025-04-18 21:52:56 +09:00
Takashi Kokubun
8ad08f1126 Fix template/Makefile.in 2025-04-18 21:52:55 +09:00
Takashi Kokubun
344ee211d6 Link zjit into the interpreter 2025-04-18 21:52:55 +09:00
Nobuyoshi Nakada
7032e2d6bc
Check programs for CC in the same path
When the path of `CC` contains the target program name, e.g., clang,
the replaced program names were unexpected.  Replace basename part
only.
2025-02-17 13:19:08 +09:00
Nobuyoshi Nakada
4a67ef09cc
[Feature #21116] Extract RJIT as a third-party gem 2025-02-13 18:01:03 +09:00
Jeremy Evans
5fab31b15e Enable riscv64 coroutine on OpenBSD/riscv64 2025-01-09 07:41:04 -08:00
Nobuyoshi Nakada
051af9529b
[Bug #21017] Fix --with-parser configure option 2025-01-08 17:26:08 +09:00
Nobuyoshi Nakada
a5562c13b1
Fix the end of "dlext & soext" section [ci skip] 2024-12-18 17:02:22 +09:00
Peter Zhu
ce1ad1b816 Standardize on the name "modular GC"
We have name fragmentation for this feature, including "shared GC",
"modular GC", and "external GC". This commit standardizes the feature
name to "modular GC" and the implementation to "GC library".
2024-12-05 10:33:26 -05:00
Raed Rizqie
ffbfec394a [MinGW] - Fix NET_LUID check 2024-11-26 19:36:04 +09:00
Nobuyoshi Nakada
9588319e72
[Bug #20800] Use config target for bin directory as-is
The "target" in `RbConfig::CONFIG` is being changed from config.sub to
align to the system `uname`. Use the value modified by config.sub, and
make the directory same as GNU utilities, such as binutils.
2024-11-09 20:37:40 +09:00
Nobuyoshi Nakada
303a52c201
[Bug #20800] Locate executable binary file under "libexec" directly
"libexec" means the directory for executable or binary files already.
2024-11-09 19:16:58 +09:00
Nobuyoshi Nakada
edb1c8215d Add integer overflow check macros for add/sub as well as mul 2024-11-09 00:08:03 +09:00
Nobuyoshi Nakada
47f6ba349f Check if -pipe option works
With `-pipe` option, gcc of Homebrew on macOS results in a mysterious
error.

```
$ command -v gcc-14
/opt/homebrew/bin/gcc-14

$ gcc-14 --version
gcc-14 (Homebrew GCC 14.2.0) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc-14 -c -pipe conftest.c
clang: error: no input files
```
2024-10-23 23:02:15 +09:00
Peter Zhu
d641b7d172 Improve RUBY_GC_LIBRARY
Instead of passing the full GC SO file name to RUBY_GC_LIBRARY, we now
only need to pass the GC name.

For example, before we needed to pass `RUBY_GC_LIBRARY=librubygc.default.so`
but now we only need to pass `RUBY_GC_LIBRARY=default`.
2024-10-11 08:56:36 -04:00
Nobuyoshi Nakada
6dac070aa2 Add --with-parser configure option 2024-10-10 01:36:32 +09:00
Nobuyoshi Nakada
e939f28cc9
Use quadrigraphs for a hash
So that the closing bracket does not look like commented out.
2024-10-05 11:36:21 +09:00
Nobuyoshi Nakada
79a8750ade
[Bug #20783] Insert a space between RPATHFLAG and LIBPATHFLAG 2024-10-04 18:49:47 +09:00
Nobuyoshi Nakada
1f6d2e77d9
Remove leading spaces from LIBPATHFLAG and RPATHFLAG
Join with a space in `MakeMakefile#libpathflag` instead.
2024-09-29 23:07:16 +09:00
Piotr Kubaj
24b587e7ba Use ppc64le coroutines for powerpc64-freebsd*
There is nothing endianness-related in ppc64le and all the tests pass on both ucontext and ppc64le coroutines on powerpc64-freebsd14.0
2024-09-19 14:59:24 +09:00
Piotr Kubaj
c362206a48 Use ppc64le coroutines on powerpc64le-freebsd*
Only one ractor-related test fails, but it also fails with ucontext.
2024-09-19 14:59:24 +09:00
KJ Tsanaktsidis
731805ddde Add an explicit check for broken libunwind builds
Libunwind as packaged in MacOS cannot actually unwind code which has
pointer authentication on, because _LIBUNWIND_IS_NATIVE_ONLY is not
defined. Add a check for this, and prefer building with working
unwinding over pointer authentication if we must make a choice.
2024-09-06 16:51:19 -04:00
Peter Zhu
2865148a5a Revert "Check for both aarch64 and arm64 arch's for pac-ret"
This reverts commit 6a746e1bc9.

This patch breaks the C level backtrace on macOS ARM machines.
2024-09-06 16:51:19 -04:00
KJ Tsanaktsidis
6a746e1bc9 Check for both aarch64 and arm64 arch's for pac-ret
Linux calls it aarch64, but MacOS calls it arm64; pac-ret works on both.
2024-08-22 17:35:43 +10:00
Nobuyoshi Nakada
6ab591f80a
[Bug #20687] Check if base ruby provides necessary libraries 2024-08-21 16:56:44 +09:00
Raed Rizqie
703305bd03 Revert soname changes
- only i386-ucrt soname is changed to fix building on x86 clang
- fix detection of x86intrin.h on x86 system
- mingw does not have LIBRUBY_SONAME
2024-08-16 17:42:59 +09:00
Lars Kanis
eedf6c35b3
Revert change of "mingw-ucrt" platform string
... of commit 00176cd40f.

The reverted change was made only for constistency, as discussed in
  https://github.com/ruby/ruby/pull/11358#issuecomment-2282222369

But the platform string "mingw-ucrt" should not be changed.
It is used as RUBY_PLATFORM and as the rubygems platform, so that there should
be a good reason to change the name of an established platform.
"mingw-ucrt" was introduced intentionally in commit
576b2e64cd.

Related to GH-11358
2024-08-12 21:48:29 -04:00
Raed Rizqie
00176cd40f fix ucrt arch 2024-08-11 00:10:28 +09:00
Takashi Kokubun
2de8b5b805
YJIT: Allow dev_nodebug to disasm release-mode code (#11198)
* YJIT: Allow dev_nodebug to disasm release-mode code

* Revert "YJIT: Squash canary before falling back"

This reverts commit f05ad373d8.
The stray canary issue should have been solved by
def7023ee4, alleviating this codegen
accommodation.

* s/runtime_assertions/runtime_checks/

---------

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2024-07-18 13:01:47 -07:00
Nobuyoshi Nakada
e722f4c57f Stop using sigsetjmp to hijack SIGCHLD handler
It already has been dead code.
Follow up of 65d3eacc80.
2024-07-16 18:41:42 +09:00
Kazuhiro NISHIYAMA
b01cf8ccde
Fix a typo
[Misc #20636]
2024-07-16 11:40:50 +09:00
KJ Tsanaktsidis
b940de83de Revert autoconf macros defining RUBY_AARCH64_{BTI|PAC}_ENABLED
This partially reverts https://github.com/ruby/ruby/pull/10944; now that
we decided to pass CFLAGS to $(CC) when assembling .S files, we don't
need these autoconf macros that capture the state of
__ARM_FEATURE{PAC|BTI}_DEFAULT.

[Bug #20601]
2024-07-07 20:14:44 +10:00
KJ Tsanaktsidis
b18701a7ae Remove $(ASFLAGS) from build system and assemble with $(CFLAGS) instead
We already assemble our assembly files using the $(CC) compiler driver,
rather than the actual $(AS) assembler. This means that

* The C preprocessor gets run on the assembly file
* It's valid to pass gcc-style flags to it, like e.g.
  -mbranch-protection or -fcf-protection
* If you do so, the relevant preprocessor macros like __CET__ get set
* If you really wanted to pass assembler flags, you would need to do
  that using -Wa,... anyway

So I think it makes sense to pass "$(XCFLAGS) $(CFLAGS) $(CPPFLAGS)" to
gcc/clang/etc when assembling, rather than passing $(ASFLAGS) (since
the flags are not actually passed to `as`, but `cc`!).

The side effect of this is that if there are mitigation flags like
-fcf-protection in $CFLAGS, then the relevant macros like __CET__ will
be defined when assembling the files.

[Bug #20601]
2024-07-07 20:14:44 +10:00
Peter Zhu
e2ceded2c6 Change external GC to use directory at configure
This commit changes the external GC API to use `--with-shared-gc=DIR` at
configure time with a directory of the external GC and uses
`RUBY_GC_LIBRARY` environment variable to load the external GC at
runtime.
2024-07-05 14:05:58 -04:00