summaryrefslogtreecommitdiff
path: root/internal
AgeCommit message (Collapse)Author
2022-01-15* expand tabs. [ci skip]git
Tabs were expanded because the file did not have any tab indentation in unedited lines. Please update your editor config, and use misc/expand_tabs.rb in the pre-commit hook.
2022-01-15Transfer the responsibility for MJIT options to mjit.cNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5448
2022-01-14Separately allocate class_serial on 32-bit systemsPeter Zhu
On 32-bit systems, VWA causes class_serial to not be aligned (it only guarantees 4 byte alignment but class_serial is 8 bytes and requires 8 byte alignment). This commit uses a hack to allocate class_serial through malloc. Once VWA allocates with 8 byte alignment in the future, we will revert this commit. Notes: Merged: https://github.com/ruby/ruby/pull/5442
2021-12-19Make RubyVM::AbstractSyntaxTree.of raise for backtrace location in evalYusuke Endoh
This check is needed to fix a bug of error_highlight when NameError occurred in eval'ed code. https://github.com/ruby/error_highlight/pull/16 The same check for proc/method has been already introduced since 64ac984129a7a4645efe5ac57c168ef880b479b2.
2021-11-23Speed up Ractors for Variable Width AllocationPeter Zhu
This commit adds a Ractor cache for every size pool. Previously, all VWA allocated objects used the slowpath and locked the VM. On a micro-benchmark that benchmarks String allocation: VWA turned off: 29.196591 0.889709 30.086300 ( 9.434059) VWA before this commit: 29.279486 41.477869 70.757355 ( 12.527379) VWA after this commit: 16.782903 0.557117 17.340020 ( 4.255603) Notes: Merged: https://github.com/ruby/ruby/pull/5151
2021-11-23Assign temporary ID to anonymous ID [Bug #18250]Nobuyoshi Nakada
Dumped iseq binary can not have unnamed symbols/IDs, and ID 0 is stored instead. As `struct rb_id_table` disallows ID 0, also for the distinction, re-assign a new temporary ID based on the local variable table index when loading from the binary, as well as the parser. Notes: Merged: https://github.com/ruby/ruby/pull/5157
2021-11-22Make RCLASS_EXT(c)->subclasses a doubly linked listMatt Valentine-House
Updating RCLASS_PARENT_SUBCLASSES and RCLASS_MODULE_SUBCLASSES while compacting can trigger the read barrier. This commit makes RCLASS_SUBCLASSES a doubly linked list with a dedicated head object so that we can add and remove entries from the list without having to touch an object in the Ruby heap Notes: Merged: https://github.com/ruby/ruby/pull/5125
2021-11-11Remove RCLASS(obj)->ptr when RVARGC is enabledMatt Valentine-House
With RVARGC we always store the rb_classext_t in the same slot as the RClass struct that refers to it. So we don't need to store the pointer or access through the pointer anymore and can switch the RCLASS_EXT macro to use an offset Notes: Merged: https://github.com/ruby/ruby/pull/5101
2021-11-10gc.h: move rb_objspace_garbage_object_p to internal/gc.hYusuke Endoh
... to allow class.c to use the function Notes: Merged: https://github.com/ruby/ruby/pull/5097
2021-10-27Embed bare `double` if `sizeof(double) == sizeof(VALUE)`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5027
2021-10-27Align `RFloat` at VALUE boundaryNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5027
2021-10-26Fix unaligned access to `double` in RFloatNobuyoshi Nakada
2021-10-25[Feature #18239] Implement VWA for stringsPeter Zhu
This commit adds support for embedded strings with variable capacity and uses Variable Width Allocation to allocate strings. Notes: Merged: https://github.com/ruby/ruby/pull/4933
2021-10-25[Feature #18239] Refactor RVARGC alloc functionsPeter Zhu
The allocation functions no longer assume that one RVALUE needs to be allocated. Notes: Merged: https://github.com/ruby/ruby/pull/4933
2021-10-26ast.c: Use kept script_lines data instead of re-opening the source file (#5019)Yusuke Endoh
ast.c: Use kept script_lines data instead of re-open the source file Notes: Merged-By: mame <mame@ruby-lang.org>
2021-10-25process.c: Add Process._fork (#5017)Yusuke Endoh
* process.c: Add Process._fork This API is supposed for application monitoring libraries to hook fork event. [Feature #17795] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged-By: mame <mame@ruby-lang.org>
2021-10-21`RubyVM.keep_script_lines`Koichi Sasada
`RubyVM.keep_script_lines` enables to keep script lines for each ISeq and AST. This feature is for debugger/REPL support. ```ruby RubyVM.keep_script_lines = true RubyVM::keep_script_lines = true eval("def foo = nil\ndef bar = nil") pp RubyVM::InstructionSequence.of(method(:foo)).script_lines ``` Notes: Merged: https://github.com/ruby/ruby/pull/4913
2021-10-20Extract yjit_force_iv_index and make it work when object is frozenAlan Wu
In an effort to simplify the logic YJIT generates for accessing instance variable, YJIT ensures that a given name-to-index mapping exists at compile time. In the case that the mapping doesn't exist, it was created by using rb_ivar_set() with Qundef on the sample object we see at compile time. This hack isn't fine if the sample object happens to be frozen, in which case YJIT would raise a FrozenError unexpectedly. To deal with this, make a new function that only reserves the mapping but doesn't touch the object. This is rb_obj_ensure_iv_index_mapping(). This new function superceeds the functionality of rb_iv_index_tbl_lookup() so it was removed. Reported by and includes a test case from John Hawthorn <john@hawthorn.email> Fixes: GH-282
2021-10-20Add comments about special runtime routines YJIT callsAlan Wu
When YJIT make calls to routines without reconstructing interpreter state through jit_prepare_routine_call(), it relies on the routine to never allocate, raise, and push/pop control frames. Comment about this on the routines that YJTI calls. This is probably something we should dynamically verify on debug builds. It's hard to statically verify this as it requires verifying all functions in the call tree. Maybe something to look at in the future.
2021-10-02Restore Hash#compare_by_identity mode [Bug #18171]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4893
2021-10-02Add rb_ident_hash_new_with_sizeNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4893
2021-10-01Skip broken strings as the locale encodingNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4915
2021-09-28Move some function declaration to internal/io.hS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4901
2021-09-24Consider modified modules initialized [Bug #18185]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4883
2021-09-22Add support for non-blocking `Kernel.system`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4595
2021-09-19Fix a typo [Bug #17048]Nobuyoshi Nakada
2021-09-17Already initialized modules cannot be replaced [Bug #17048]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4858
2021-09-10suppress GCC's -Wsuggest-attribute=format卜部昌平
I was not aware of this because I use clang these days. Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-10include/ruby/internal/core/rarray.h: add doxygen卜部昌平
Must not be a bad idea to improve documents. [ci skip] Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-10internal/*.h: skip doxygen卜部昌平
These contents are purely implementation details, not worth appearing in CAPI documents. [ci skip] Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-08-25[Feature #18045] Implement size classes for GCPeter Zhu
This commits implements size classes in the GC for the Variable Width Allocation feature. Unless `USE_RVARGC` compile flag is set, only a single size class is created, maintaining current behaviour. See the redmine ticket for more details. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4773
2021-08-25[Feature #18045] Remove T_PAYLOADPeter Zhu
This commit removes T_PAYLOAD since the new VWA implementation no longer requires T_PAYLOAD types. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4773
2021-08-24Moved rb_deprecate_constant declaration [Feature #18051]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4763
2021-08-24Moved rb_int_positive_pow declaration [Feature #18051]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4763
2021-08-24Moved exported symbols in internal/util.h to ruby/util.hNobuyoshi Nakada
[Feature #18051] Notes: Merged: https://github.com/ruby/ruby/pull/4763
2021-08-23Revert "[Feature #18045] Implement size classes for GC"Peter Zhu
This reverts commits 48ff7a9f3e47bffb3e4d067a12ba9b936261caa0 and b2e2cf2dedd104acad8610721db5e4d341f135ef because it is causing crashes in SPARC solaris and i386 debian. Notes: Merged: https://github.com/ruby/ruby/pull/4764
2021-08-23[Feature #18045] Implement size classes for GCPeter Zhu
This commits implements size classes in the GC for the Variable Width Allocation feature. Unless `USE_RVARGC` compile flag is set, only a single size class is created, maintaining current behaviour. See the redmine ticket for more details. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4680
2021-08-23[Feature #18045] Remove T_PAYLOADPeter Zhu
This commit removes T_PAYLOAD since the new VWA implementation no longer requires T_PAYLOAD types. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4680
2021-08-20ast.c: Rename "save_script_lines" to "keep_script_lines"Yusuke Endoh
... as per ko1's preference. He is preparing to extend this feature to ISeq for his new debugger. He prefers "keep" to "save" for this wording. This API is internal and not included in any released version, so I change it in advance.
2021-08-20Add RBIMPL_TODONobuyoshi Nakada
Make `RUBY_VERSION_SINCE` and `RUBY_VERSION_BEFORE` to take major and minor numbers so usable also in preprocessor directives. Old macros are renamed with "STRING".
2021-08-19Remove old warning aged nearly 8 yearsNobuyoshi Nakada
2021-08-06Use Rational for Float#round with ndigits > 14Jeremy Evans
ndigits higher than 14 can result in values that are slightly too large due to floating point limitations. Converting to rational for the calculation and then back to float fixes these issues. Fixes [Bug #14635] Fixes [Bug #17183] Co-authored by: Yusuke Endoh <mame@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4682
2021-07-28Don't export rb_gc_ractor_newobj_cache_clearPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/4690
2021-07-28Remove duplicate declarationsNobuyoshi Nakada
Also defined in include/ruby/internal/core/rarray.h which always will be included.
2021-07-16Add Integer.try_convert [Feature #15211]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4654
2021-07-15[Bug #18014] Fix memory leak in GC when using RactorsPeter Zhu
When a Ractor is removed, the freelist in the Ractor cache is not returned to the GC, leaving the freelist permanently lost. This commit recycles the freelist when the Ractor is destroyed, preventing a memory leak from occurring. Notes: Merged: https://github.com/ruby/ruby/pull/4613
2021-07-13Expose `rb_obj_is_fiber`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4646
2021-07-11Move rb_str_escape function declarationS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4607
2021-06-30Specify version to remove as bare numbersNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3972
2021-06-30Ensure that version number starts with digitsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3972