summaryrefslogtreecommitdiff
path: root/common.mk
AgeCommit message (Collapse)Author
2023-06-01Hide the usage of `rb_io_t` where possible. (#7880)Samuel Williams
This retries the compatible parts of the previously reverted PR so we can continue to update related code without breaking backwards compatibility. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-06-01Revert "Hide most of the implementation of `struct rb_io`. (#6511)"NARUSE, Yui
This reverts commit 18e55fc1e1ec20e8f3166e3059e76c885fc9f8f2. fix [Bug #19704] https://bugs.ruby-lang.org/issues/19704 This breaks compatibility for extension libraries. Such changes need a discussion.
2023-05-30Hide most of the implementation of `struct rb_io`. (#6511)Samuel Williams
* Add rb_io_path and rb_io_open_descriptor. * Use rb_io_open_descriptor to create PTY objects * Rename FMODE_PREP -> FMODE_EXTERNAL and expose it FMODE_PREP I believe refers to the concept of a "pre-prepared" file, but FMODE_EXTERNAL is clearer about what the file descriptor represents and aligns with language in the IO::Buffer module. * Ensure that rb_io_open_descriptor closes the FD if it fails If FMODE_EXTERNAL is not set, then it's guaranteed that Ruby will be responsible for closing your file, eventually, if you pass it to rb_io_open_descriptor, even if it raises an exception. * Rename IS_EXTERNAL_FD -> RUBY_IO_EXTERNAL_P * Expose `rb_io_closed_p`. * Add `rb_io_mode` to get IO mode. --------- Co-authored-by: KJ Tsanaktsidis <ktsanaktsidis@zendesk.com> Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-26Fix busy-loop when waiting for file descriptors to closeKJ Tsanaktsidis
When one thread is closing a file descriptor whilst another thread is concurrently reading it, we need to wait for the reading thread to be done with it to prevent a potential EBADF (or, worse, file descriptor reuse). At the moment, that is done by keeping a list of threads still using the file descriptor in io_close_fptr. It then continually calls rb_thread_schedule() in fptr_finalize_flush until said list is empty. That busy-looping seems to behave rather poorly on some OS's, particulary FreeBSD. It can cause the TestIO#test_race_gets_and_close test to fail (even with its very long 200 second timeout) because the closing thread starves out the using thread. To fix that, I introduce the concept of struct rb_io_close_wait_list; a list of threads still using a file descriptor that we want to close. We call `rb_notify_fd_close` to let the thread scheduler know we're closing a FD, which fills the list with threads. Then, we call rb_notify_fd_close_wait which will block the thread until all of the still-using threads are done. This is implemented with a condition variable sleep, so no busy-looping is required. Notes: Merged: https://github.com/ruby/ruby/pull/7865
2023-05-23Move `ruby_node_name` to node.c and rename prefix of the functionyui-knk
Notes: Merged: https://github.com/ruby/ruby/pull/7844
2023-05-21Put `rb_fork` back into process.cNobuyoshi Nakada
Now, calling `rb_fork` directly breaks the PID cache and the timer thread, so must use `rb_fork_ruby` or similar instead. Notes: Merged: https://github.com/ruby/ruby/pull/7834
2023-05-18Add Fiber#kill, similar to Thread#kill. (#7823)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-17Implement Hash AR tables on VWAPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/7742
2023-05-15Process parse.y without temporary filesNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7817
2023-05-15Use the rb_sys_fail_str macro in signal.cKunshan Wang
Let signal.c include "internal/error.h" explicitly to ensure that the identifier rb_sys_fail_str in signal.c refers to the macro defined in "internal/error.h" instead of the actual function. That macro reads errno before evaluating its argument. Without this change, the rb_signo2signm(sig) expression in the "trap" function in signal.c will overwrite the errno before the actual rb_sys_fail_str function reads the errno. Notes: Merged: https://github.com/ruby/ruby/pull/7812
2023-05-14Add user argument to some macros used by bisonNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7807
2023-05-12Use Lrama LALR parser generator instead of Bisonv3_3_0_preview1Yuichiro Kaneko
https://bugs.ruby-lang.org/issues/19637 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/7798 Merged-By: yui-knk <spiketeika@gmail.com>
2023-04-25Removed commented-out codeHiroshi SHIBATA
2023-04-21Use shorter path as `SPEC_TEMP_DIR`Nobuyoshi Nakada
The temporary directory under the build directory may be too long as a UNIX socket path. On macOS, the default `TMPDIR` per user is also very long. Notes: Merged: https://github.com/ruby/ruby/pull/7749
2023-04-15fake.rb should depend on revision.h [ci skip]Nobuyoshi Nakada
2023-04-13[DOC] common.mk deals with various `make` varietiesAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/7690 Merged-By: XrXr
2023-04-13Emit a performance warning when a class reached max variationsJean Boussier
[Feature #19538] This new `peformance` warning category is disabled by default. It needs to be specifically enabled via `-W:performance` or `Warning[:performance] = true` Notes: Merged: https://github.com/ruby/ruby/pull/7708
2023-04-07Expose rb_sym_to_proc via RJITAaron Patterson
This is needed for getblockparamproxy Notes: Merged: https://github.com/ruby/ruby/pull/7673
2023-04-06Update VPATH for socket, & dependenciesMatt Valentine-House
The socket extensions rubysocket.h pulls in the "private" include/gc.h, which now depends on vm_core.h. vm_core.h pulls in id.h when tool/update-deps generates the dependencies for the makefiles, it generates the line for id.h to be based on VPATH, which is configured in the extconf.rb for each of the extensions. By default VPATH does not include the actual source directory of the current Ruby so the dependency fails to resolve and linking fails. We need to append the topdir and top_srcdir to VPATH to have the dependancy picked up correctly (and I believe we need both of these to cope with in-tree and out-of-tree builds). I copied this from the approach taken in https://github.com/ruby/ruby/blob/master/ext/objspace/extconf.rb#L3 Notes: Merged: https://github.com/ruby/ruby/pull/7393
2023-04-05YJIT: Add codegen for Integer methods (#7665)Takashi Kokubun
* YJIT: Add codegen for Integer methods * YJIT: Update dependencies * YJIT: Fix Integer#[] for argc=2 Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-04-04Revert "Fix transient heap mode"Aaron Patterson
This reverts commit 87253d047ce35e7836b6f97edbb4f819879a3b25. Revert "Implement `Process.warmup`" This reverts commit ba6ccd871442f55080bffd53e33678c0726787d2.
2023-04-04Implement `Process.warmup`Jean Boussier
[Feature #18885] For now, the optimizations performed are: - Run a major GC - Compact the heap - Promote all surviving objects to oldgen Other optimizations may follow. Notes: Merged: https://github.com/ruby/ruby/pull/7346
2023-03-17Update Makefile dependenciesMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/7153
2023-03-15Move RB_VM_SAVE_MACHINE_CONTEXT to internal/thread.hMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/7465
2023-03-12Add btest-bruby targetTakashi Kokubun
btest can't be used for testing RJIT because RJIT doesn't work on miniruby. However, btest-ruby is not necessarily useful for testing RJIT because both the runner could crash as well as the target. TBH I'm not sure why we want to use RUNRUBY instead of BOOTSTRAPRUBY on btest-ruby. However, to achieve what I want to do while keeping the current behavior, I'm just introducing a new target.
2023-03-12RJIT: Update dependenciesTakashi Kokubun
2023-03-10Move WeakMap and WeakKeyMap code to weakmap.cPeter Zhu
These classes don't belong in gc.c as they're not actually part of the GC. This commit refactors the code by moving all the code into a weakmap.c file. Notes: Merged: https://github.com/ruby/ruby/pull/7451
2023-03-07Allow enabling YJIT and RJIT independently (#7474)Takashi Kokubun
We used to require MJIT is supported when YJIT is supported. However, now that RJIT dropped some platforms that YJIT supports, it no longer makes sense. We should be able to enable only YJIT, and vice versa. Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-03-06s/mjit/rjit/Takashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7462
2023-03-06s/MJIT/RJIT/Takashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7462
2023-03-06Remove obsoleted mjit_sp_inc.inc.erbTakashi Kokubun
2023-03-06Remove obsoleted mjit_config.hTakashi Kokubun
2023-03-06Drop obsoleted MJIT header (#7458)Takashi Kokubun
RJIT doesn't need this. Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-03-05Update dependenciesTakashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7448
2023-03-02Rewrite Ractor synchronization mechanismKoichi Sasada
This patch rewrites Ractor synchronization mechanism, send/receive and take/yield. * API * Ractor::Selector is introduced for lightweight waiting for many ractors. * Data structure * remove `struct rb_ractor_waiting_list` and use `struct rb_ractor_queue takers_queue` to manage takers. * remove `rb_ractor_t::yield_atexit` and use `rb_ractor_t::sync::will_basket::type` to check the will. * add `rb_ractor_basket::p.take` to represent a taking ractor. * Synchronization protocol * For the Ractor local GC, `take` can not make a copy object directly so ask to generate the copy from the yielding ractor. * The following steps shows what `r1.take` does on `r0`. * step1: (r0) register `r0` into `r1`'s takers. * step2: (r0) check `r1`'s status and wakeup r0 if `r1` is waiting for yielding a value. * step3: (r0) sleep until `r1` wakes up `r0`. * The following steps shows what `Ractor.yield(v)` on `r1`. * step1: (r1) check first takers of `r1` and if there is (`r0`), make a copy object of `v` and pass it to `r0` and wakes up `r0`. * step2: (r1) if there is no taker ractors, sleep until another ractor try to take. Notes: Merged: https://github.com/ruby/ruby/pull/7371
2023-02-28Update the depend filesMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/7310
2023-02-27Remove intern/gc.h from Make depsMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/7330
2023-02-24Fix incorrect line numbers in GC hookPeter Zhu
If the previous instruction is not a leaf instruction, then the PC was incremented before the instruction was ran (meaning the currently executing instruction is actually the previous instruction), so we should not increment the PC otherwise we will calculate the source line for the next instruction. This bug can be reproduced in the following script: ``` require "objspace" ObjectSpace.trace_object_allocations_start a = 1.0 / 0.0 p [ObjectSpace.allocation_sourceline(a), ObjectSpace.allocation_sourcefile(a)] ``` Which outputs: [4, "test.rb"] This is incorrect because the object was allocated on line 10 and not line 4. The behaviour is correct when we use a leaf instruction (e.g. if we replaced `1.0 / 0.0` with `"hello"`), then the output is: [10, "test.rb"]. [Bug #19456] Notes: Merged: https://github.com/ruby/ruby/pull/7357
2023-02-24Add information about runirb in make helpKaĆ­que Kandy Koga
Notes: Merged: https://github.com/ruby/ruby/pull/5971
2023-02-22Clone bundled gem sources only if GIT is availableNobuyoshi Nakada
2023-02-22Clone and create dummy gemspec in sequential buildNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7347
2023-02-15Encapsulate RCLASS_ATTACHED_OBJECTJean Boussier
Right now the attached object is stored as an instance variable and all the call sites that either get or set it have to know how it's stored. It's preferable to hide this implementation detail behind accessors so that it is easier to change how it's stored. Notes: Merged: https://github.com/ruby/ruby/pull/7308
2023-02-10[DOC] Fix the help messages for cleanNobuyoshi Nakada
2023-02-09Merge gc.h and internal/gc.hMatt Valentine-House
[Feature #19425] Notes: Merged: https://github.com/ruby/ruby/pull/7273
2023-02-08Extract include/ruby/internal/attr/packed_struct.hNobuyoshi Nakada
Split `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` macros into the macros bellow: * `RBIMPL_ATTR_PACKED_STRUCT_BEGIN` * `RBIMPL_ATTR_PACKED_STRUCT_END` * `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN` * `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END` Notes: Merged: https://github.com/ruby/ruby/pull/7268
2023-01-31Document BUNDLED_GEMS in make testTakashi Kokubun
2023-01-27YJIT: Fix shared/static library symbol leaksAlan Wu
Rust 1.58.0 unfortunately doesn't provide facilities to control symbol visibility/presence, but we care about controlling the list of symbols exported from libruby-static.a and libruby.so. This commit uses `ld -r` to make a single object out of rustc's staticlib output, libyjit.a. This moves libyjit.a out of MAINLIBS and adds libyjit.o into COMMONOBJS, which obviates the code for merging libyjit.a into libruby-static.a. The odd appearance of libyjit.a in SOLIBS is also gone. To filter out symbols we do not want to export on ELF platforms, we use objcopy after the partial link. On darwin, we supply a symbol list to the linker which takes care of hiding unprefixed symbols. [Bug #19255] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/7115
2023-01-26Enable code-coverage result for test-syntax-suggestHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/7185
2023-01-26[Bug #19340] Fix bundle gems with test revisionNobuyoshi Nakada
Build temporary gem package from cloned repository if test revision is set. Notes: Merged: https://github.com/ruby/ruby/pull/7146
2023-01-25Support simplecov-0.22.0.Hiroshi SHIBATA
simplecov-0.22.0 no longer support pre-0.18 result format. result data needs `lines` key for coverage data.