summaryrefslogtreecommitdiff
path: root/load.c
AgeCommit message (Collapse)Author
30 hoursRename `vast` to `ast_value`yui-knk
There is an English word "vast". This commit changes the name to be more clear name to avoid confusion.
8 days[Universal parser] Decouple IMEMO from rb_ast_tHASUMI Hitoshi
This patch removes the `VALUE flags` member from the `rb_ast_t` structure making `rb_ast_t` no longer an IMEMO object. ## Background We are trying to make the Ruby parser generated from parse.y a universal parser that can be used by other implementations such as mruby. To achieve this, it is necessary to exclude VALUE and IMEMO from parse.y, AST, and NODE. ## Summary (file by file) - `rubyparser.h` - Remove the `VALUE flags` member from `rb_ast_t` - `ruby_parser.c` and `internal/ruby_parser.h` - Use TypedData_Make_Struct VALUE which wraps `rb_ast_t` `in ast_alloc()` so that GC can manage it - You can retrieve `rb_ast_t` from the VALUE by `rb_ruby_ast_data_get()` - Change the return type of `rb_parser_compile_XXXX()` functions from `rb_ast_t *` to `VALUE` - rb_ruby_ast_new() which internally `calls ast_alloc()` is to create VALUE vast outside ruby_parser.c - `iseq.c` and `vm_core.h` - Amend the first parameter of `rb_iseq_new_XXXX()` functions from `rb_ast_body_t *` to `VALUE` - This keeps the VALUE of AST on the machine stack to prevent being removed by GC - `ast.c` - Almost all change is replacement `rb_ast_t *ast` with `VALUE vast` (sorry for the big diff) - Fix `node_memsize()` - Now it includes `rb_ast_local_table_link`, `tokens` and script_lines - `compile.c`, `load.c`, `node.c`, `parse.y`, `proc.c`, `ruby.c`, `template/prelude.c.tmpl`, `vm.c` and `vm_eval.c` - Follow-up due to the above changes - `imemo.{c|h}` - If an object with `imemo_ast` appears, considers it a bug Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-04-15Specify Kernel#autoload? uses current namespaceGannon McGibbon
Because Kernel#autoload? uses the current namespace, it can lead to potentially confusing results. We should make it clearer that modules count as separate namespaces to lookup in. Co-authored-by: Jeremy Evans <code@jeremyevans.net> Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-03-06Refactor VM root modulesJean Boussier
This `st_table` is used to both mark and pin classes defined from the C API. But `vm->mark_object_ary` already does both much more efficiently. Currently a Ruby process starts with 252 rooted classes, which uses `7224B` in an `st_table` or `2016B` in an `RArray`. So a baseline of 5kB saved, but since `mark_object_ary` is preallocated with `1024` slots but only use `405` of them, it's a net `7kB` save. `vm->mark_object_ary` is also being refactored. Prior to this changes, `mark_object_ary` was a regular `RArray`, but since this allows for references to be moved, it was marked a second time from `rb_vm_mark()` to pin these objects. This has the detrimental effect of marking these references on every minors even though it's a mostly append only list. But using a custom TypedData we can save from having to mark all the references on minor GC runs. Addtionally, immediate values are now ignored and not appended to `vm->mark_object_ary` as it's just wasted space.
2024-02-28[PRISM] Do not load -r until we check if main script can be readKevin Newton
2024-02-14[PRISM] Correctly hook up line numbers for evalKevin Newton
2024-02-12Replace assert with RUBY_ASSERT in load.cPeter Zhu
assert does not print the bug report, only the file and line number of the assertion that failed. RUBY_ASSERT prints the full bug report, which makes it much easier to debug.
2024-01-31[PRISM] Mirror iseq APIsKevin Newton
Before this commit, we were mixing a lot of concerns with the prism compile between RubyVM::InstructionSequence and the general entry points to the prism parser/compiler. This commit makes all of the various prism-related APIs mirror their corresponding APIs in the existing parser/compiler. This means we now have the correct frame naming, and it's much easier to follow where the logic actually flows. Furthermore this consolidates a lot of the prism initialization, making it easier to see where we could potentially be raising errors.
2024-01-22[Prism] path and script name are not the sameMatt Valentine-House
When loading Ruby from a file, or parsing using RubyVM::InstructionSequence.
2024-01-22Make prism respect dump_without_optKevin Newton
2024-01-11Update Kernel#load documentation to remove phrase related to protectionJeremy Evans
Code loaded via Kernel#load can modify the global namespace even if the wrap parameter is provided. Fixes [Bug #19990]
2023-12-17Adjust styles [ci skip]Nobuyoshi Nakada
2023-12-15Introduce --parser runtime flagHParker
Introduce runtime flag for specifying the parser, ``` ruby --parser=prism ``` also update the description: ``` $ ruby --parser=prism --version ruby 3.3.0dev (2023-12-08T04:47:14Z add-parser-runtime.. 0616384c9f) +PRISM [x86_64-darwin23] ``` [Bug #20044]
2023-12-14rb_ext_resolve_symbol: C API to resolve and return externed symbols [Feature ↵Satoshi Tagomori
#20005] This is a C API for extensions to resolve and get function symbols of other extensions. Extensions can check the expected symbol is correctly loaded and accessible, and use it if it is available. Otherwise, extensions can raise their own error to guide users to setup their environments correctly and what's missing.
2023-12-12[DOC] Update description about shared library suffixNobuyoshi Nakada
Loading an extension library with ".dll" suffix on Windows was very old behavior, and the suffix must be ".so" since 2004. See commits removing DLEXT2 181a3a2af5df88d145b73a060d51fe437c8c4ad4 and b76ad15ed0da636161de0243c547ee1e6fc95681. Instead, use macOS as an example, which uses ".bundle".
2023-12-12[DOC] Fix RDoc to match actual Kenrel.require behavior (#9180)hogelog
2023-12-07Free everything at shutdownAdam Hess
when the RUBY_FREE_ON_SHUTDOWN environment variable is set, manually free memory at shutdown. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2023-12-06Revert "allow enabling Prism via flag or env var"HParker
This reverts commit 9b76c7fc89460ed8e9be40e4037c1d68395c0f6d.
2023-12-06Adjust styles [ci skip]Nobuyoshi Nakada
2023-12-05allow enabling Prism via flag or env varHParker
Enable Prism using either --prism ruby --prism test.rb or via env var RUBY_PRISM=1 ruby test.rb
2023-11-28[Bug #20023] Resurrect fake string feature name before raisingNobuyoshi Nakada
2023-11-06[Bug #19985] Raise LoadError with the converted feature nameNobuyoshi Nakada
`Kernel#require` converts feature name objects that have the `to_path` method such as `Pathname`, but had used the original object on error and had resulted in an unexpected `TypeError`.
2023-08-22Add notes and name a magic numberNobuyoshi Nakada
2023-07-28Preserve `ec` argument across `longjmp`Nobuyoshi Nakada
Fix segfault on icc 2023.2. An optimizer may allocate this argument to a register, and it may be clobbered by `longjmp`, e.g. exceptions. Notes: Merged: https://github.com/ruby/ruby/pull/8135
2023-07-10Add a realpath cache to reduce number of syscalls.krk
Number of lstat and stat syscalls for each 'require'd file is doubled, because rb_realpath_internal is called from two places with the same arguments in require_internal; once for checking the realpaths cache, and once in load_iseq_eval when iseq is not found. Introduce rb_realpath_internal_cached function to reuse the realpath_map cache which memoizes rb_realpath_internal function, leading to less syscalls and increased startup performance depending on the cost of the syscalls in a particular environment. Notes: Merged: https://github.com/ruby/ruby/pull/8017
2023-06-12[Feature #19719] Universal Parseryui-knk
Introduce Universal Parser mode for the parser. This commit includes these changes: * Introduce `UNIVERSAL_PARSER` macro. All of CRuby related functions are passed via `struct rb_parser_config_struct` when this macro is enabled. * Add CI task with 'cppflags=-DUNIVERSAL_PARSER' for ubuntu. Notes: Merged: https://github.com/ruby/ruby/pull/7927
2023-04-26[Bug #19592] Fix ext/Setup supportAlan Wu
After [1], using ext/Setup to link some, but not all extensions failed during linking. I did not know about this option, and had assumed that only `--with-static-linked-ext` builds can include statically linked extensions. Include the support code for statically linked extensions in all configurations like before [1]. Initialize the table lazily to minimize footprint on builds that have no statically linked extensions. [1]: 790cf4b6d0475614afb127b416e87cfa39044d67 "Fix autoload status of statically linked extensions" Notes: Merged: https://github.com/ruby/ruby/pull/7729
2023-04-13Speed up rebuilding the loaded feature indexJeremy Evans
Rebuilding the loaded feature index slowed down with the bug fix for #17885 in 79a4484a072e9769b603e7b4fbdb15b1d7eccb15. The slowdown was extreme if realpath emulation was used, but even when not emulated, it could be about 10x slower. This adds loaded_features_realpath_map to rb_vm_struct. This is a hidden hash mapping loaded feature paths to realpaths. When rebuilding the loaded feature index, look at this hash to get cached realpath values, and skip calling rb_check_realpath if a cached value is found. Fixes [Bug #19246] Notes: Merged: https://github.com/ruby/ruby/pull/7699
2023-02-27Revert "reuse open(2) from rb_file_load_ok on POSIX-like system"Takashi Kokubun
This reverts commit 35136e1e9c232ad7a03407b992b2e86b6df43f63. test-spec has been failing since this revision. .github/workflows/compilers.yml:82 https://github.com/ruby/ruby/actions/runs/4276884159/jobs/7445299562 ``` env: # Minimal flags to pass the check. default_cc: 'gcc-11 -fcf-protection -Wa,--generate-missing-build-notes=yes' optflags: '-O2' LDFLAGS: '-Wl,-z,now' # FIXME: Drop skipping options # https://bugs.ruby-lang.org/issues/18061 # https://sourceware.org/annobin/annobin.html/Test-pie.html TEST_ANNOCHECK_OPTS: "--skip-pie --skip-gaps" ``` Failure: ``` 1) An exception occurred during: Kernel#require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:317 Kernel#require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 2) An exception occurred during: Kernel#require ($LOADED_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:330 Kernel#require ($LOADED_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 3) An exception occurred during: Kernel#require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:535 Kernel#require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 4) An exception occurred during: Kernel#require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:551 Kernel#require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded ERROR LeakError: Leaked file descriptor: 9 : #<File:../code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 5) An exception occurred during: Kernel#require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:563 Kernel#require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required ERROR LeakError: Closed file descriptor: 8 Closed file descriptor: 9 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 6) An exception occurred during: Kernel.require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:317 Kernel.require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 7) An exception occurred during: Kernel.require ($LOADED_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:330 Kernel.require ($LOADED_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 8) An exception occurred during: Kernel.require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:535 Kernel.require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 9) An exception occurred during: Kernel.require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:551 Kernel.require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded ERROR LeakError: Leaked file descriptor: 9 : #<File:../code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 10) An exception occurred during: Kernel.require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:563 Kernel.require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required ERROR LeakError: Closed file descriptor: 8 Closed file descriptor: 9 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 11) An exception occurred during: Kernel#require_relative with a relative path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:197 Kernel#require_relative with a relative path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:4:in `<top (required)>' 12) An exception occurred during: Kernel#require_relative with a relative path ($LOADED_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:205 Kernel#require_relative with a relative path ($LOADED_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:4:in `<top (required)>' 13) An exception occurred during: Kernel#require_relative with an absolute path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:399 Kernel#require_relative with an absolute path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:277:in `<top (required)>' 14) An exception occurred during: Kernel#require_relative with an absolute path ($LOAD_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:407 Kernel#require_relative with an absolute path ($LOAD_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:277:in `<top (required)>' ```
2023-02-26reuse open(2) from rb_file_load_ok on POSIX-like systemEric Wong
When loading Ruby source files, we can save the result of successful opens as open(2)/openat(2) are a fairly expensive syscalls. This also avoids a time-of-check-to-time-of-use (TOCTTOU) problem. This reduces open(2) syscalls during `require'; but should be most apparent when users have a small $LOAD_PATH. Users with large $LOAD_PATH will benefit less since there'll be more open(2) failures due to ENOENT. With `strace -c -e openat ruby -e exit' under Linux, this results in a ~14% reduction of openat(2) syscalls (glibc uses openat(2) to implement open(2)). % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 0.00 0.000000 0 296 110 openat 0.00 0.000000 0 254 110 openat Additionally, the introduction of `struct ruby_file_load_state' may make future optimizations more apparent. This change cannot benefit binary (.so) loading since the dlopen(3) API requires a filename and I'm not aware of an alternative that takes a pre-existing FD. In typical situations, Ruby source files outnumber the mount of .so files.
2023-02-08Only emit circular dependency warning for owned thread shieldsJean byroot Boussier
[Bug #19415] If multiple threads attemps to load the same file concurrently it's not a circular dependency issue. So we check that the existing ThreadShield is owner by the current fiber before warning about circular dependencies. Notes: Merged: https://github.com/ruby/ruby/pull/7257
2023-02-06Revert "Only emit circular dependency warning for owned thread shields"Jean byroot Boussier
This reverts commit fa49651e05a06512e18ccb2f54a7198c9ff579de. Notes: Merged: https://github.com/ruby/ruby/pull/7256
2023-02-06Only emit circular dependency warning for owned thread shieldsJean Boussier
[Bug #19415] If multiple threads attemps to load the same file concurrently it's not a circular dependency issue. So we check that the existing ThreadShield is owner by the current fiber before warning about circular dependencies. Notes: Merged: https://github.com/ruby/ruby/pull/7252
2022-12-27load.c: remove unneeded rb_str_freeze callsEric Wong
rb_fstring already resizes and freezes the string, so there's no need to use rb_str_freeze.
2022-11-25Fix autoload status of statically linked extensionsAlan Wu
Previously, for statically-linked extensions, we used `vm->loading_table` to delay calling the init function until the extensions are required. This caused the extensions to look like they are in the middle of being loaded even before they're required. (`rb_feature_p()` returned true with a loading path output.) Combined with autoload, queries like `defined?(CONST)` and `Module#autoload?` were confused by this and returned nil incorrectly. RubyGems uses `defined?` to detect if OpenSSL is available and failed when OpenSSL was available in builds using `--with-static-linked-ext`. Use a dedicated table for the init functions instead of adding them to the loading table. This lets us remove some logic from non-EXTSTATIC builds. [Bug #19115] Notes: Merged: https://github.com/ruby/ruby/pull/6756
2022-11-18Rename misleading labelAlan Wu
We use this code path when we require the same extension twice, so it's not necessarily about the feature being statically linked. Removing this code when there is no statically linked extensions leads to breakage.
2022-10-20push dummy frame for loading processKoichi Sasada
This patch pushes dummy frames when loading code for the profiling purpose. The following methods push a dummy frame: * `Kernel#require` * `Kernel#load` * `RubyVM::InstructionSequence.compile_file` * `RubyVM::InstructionSequence.load_from_binary` https://bugs.ruby-lang.org/issues/18559 Notes: Merged: https://github.com/ruby/ruby/pull/6572
2022-07-26Rename rb_ary_tmp_new to rb_ary_hidden_newPeter Zhu
rb_ary_tmp_new suggests that the array is temporary in some way, but that's not true, it just creates an array that's hidden and not on the transient heap. This commit renames it to rb_ary_hidden_new. Notes: Merged: https://github.com/ruby/ruby/pull/6180
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-06-21Clarify documentation of Kernel#require_relativeBenoit Daloze
2022-06-03[DOC] Mention the case to autoload already defined constantNobuyoshi Nakada
2022-06-03[DOC] Subjects of `autoload` are not restricted to modulesNobuyoshi Nakada
2022-05-03Remove _with_gc functions in darrayPeter Zhu
darray was used in YJIT which required the functions to not trigger GC. YJIT has now moved to Rust and does not use darray anymore, so we can remove the functions that don't trigger GC and only keep the ones that trigger GC. Notes: Merged: https://github.com/ruby/ruby/pull/5874
2022-04-27Rust YJITAlan Wu
In December 2021, we opened an [issue] to solicit feedback regarding the porting of the YJIT codebase from C99 to Rust. There were some reservations, but this project was given the go ahead by Ruby core developers and Matz. Since then, we have successfully completed the port of YJIT to Rust. The new Rust version of YJIT has reached parity with the C version, in that it passes all the CRuby tests, is able to run all of the YJIT benchmarks, and performs similarly to the C version (because it works the same way and largely generates the same machine code). We've even incorporated some design improvements, such as a more fine-grained constant invalidation mechanism which we expect will make a big difference in Ruby on Rails applications. Because we want to be careful, YJIT is guarded behind a configure option: ```shell ./configure --enable-yjit # Build YJIT in release mode ./configure --enable-yjit=dev # Build YJIT in dev/debug mode ``` By default, YJIT does not get compiled and cargo/rustc is not required. If YJIT is built in dev mode, then `cargo` is used to fetch development dependencies, but when building in release, `cargo` is not required, only `rustc`. At the moment YJIT requires Rust 1.60.0 or newer. The YJIT command-line options remain mostly unchanged, and more details about the build process are documented in `doc/yjit/yjit.md`. The CI tests have been updated and do not take any more resources than before. The development history of the Rust port is available at the following commit for interested parties: https://github.com/Shopify/ruby/commit/1fd9573d8b4b65219f1c2407f30a0a60e537f8be Our hope is that Rust YJIT will be compiled and included as a part of system packages and compiled binaries of the Ruby 3.2 release. We do not anticipate any major problems as Rust is well supported on every platform which YJIT supports, but to make sure that this process works smoothly, we would like to reach out to those who take care of building systems packages before the 3.2 release is shipped and resolve any issues that may come up. [issue]: https://bugs.ruby-lang.org/issues/18481 Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Co-authored-by: Noah Gibbs <the.codefolio.guy@gmail.com> Co-authored-by: Kevin Newton <kddnewton@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/5826
2022-02-23rb_provide_feature: Prevent $LOADED_FEATURES from being copiedJean Boussier
[Bug #18599] `vm->loaded_features` and `vm->loaded_features_snapshot` both share the same root. When a feature is pushed into `loaded_features`, the sharing is broken and `loaded_features` is copied. So an application requiring 1000 files, will allocate 1000 arrays of increasing size, which is very wasteful. To avoid this, we first clear the snapshot, so that `loaded_features` can directly be pushed into. Co-Authored-By: Peter Zhu <peter.zhu@shopify.com> Notes: Merged: https://github.com/ruby/ruby/pull/5593
2022-02-16Change feature_index from fake Array to darrayPeter Zhu
Using a fake (malloc) RArray is not friendly for the garbage collector. Fake RArray does not have a heap page, so it causes Variable Width Allocation to crash when we try to implement it on Arrays. This commit changes feature_index from a RArray to a darray. Notes: Merged: https://github.com/ruby/ruby/pull/5546
2022-02-05Fix TAG_THROW through require [Bug #18562]John Hawthorn
Previously this was being incorrectly swapped with TAG_RAISE in the next line. This would end up checking the T_IMEMO throw_data to the exception handling (which calls Module#===). This happened to not break existing tests because Module#=== returned false when klass is NULL. This commit handles throw from require correctly by jumping to the tag retaining the TAG_THROW state. Notes: Merged: https://github.com/ruby/ruby/pull/5513
2021-11-17Allow Kernel#load to load code into a specified moduleJeremy Evans
Instead of always using a new anonymous module for Kernel#load if the wrap argument is not false/nil, use the given module if a module is provided. Implements [Feature #6210] Notes: Merged: https://github.com/ruby/ruby/pull/4986
2021-10-10Pass the VM pointer as an argumentNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4948
2021-10-08Make `volatile` the variable will be taken out from `EC_EXEC_TAG`Nobuyoshi Nakada