summaryrefslogtreecommitdiff
path: root/ext/objspace
AgeCommit message (Collapse)Author
2021-11-21Update dependenciesNobuyoshi Nakada
2021-10-20Tie lifetime of uJIT blocks to iseqsAlan Wu
* Tie lifetime of uJIT blocks to iseqs Blocks weren't being freed when iseqs are collected. * Add rb_dary. Use it for method dependency table * Keep track of blocks per iseq Remove global version_tbl * Block version bookkeeping fix * dary -> darray * free ujit_blocks * comment about size of ujit_blocks
2021-10-05ruby tool/update-deps --fix卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/4909
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-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] 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-20undefine alloc functions for C extensionsMike Dalessio
per guidance in doc/extension.rdoc, these classes now undefine their alloc functions: - ObjectSpace::InternalObjectWrapper - Socket::Ifaddr Notes: Merged: https://github.com/ruby/ruby/pull/4604
2021-05-14ext/objspace/lib/objspace/trace.rb: Remove the original Kernel#pYusuke Endoh
... to disable a "method redefined" warning. http://rubyci.s3.amazonaws.com/solaris11-gcc/ruby-master/log/20210514T050008Z.fail.html.gz ``` 1) Failure: TestObjSpace#test_objspace_trace [/export/home/chkbuild/chkbuild-gcc/tmp/build/20210514T050008Z/ruby/test/objspace/test_objspace.rb:621]: <["objspace/trace is enabled"]> expected but was <["/export/home/chkbuild/chkbuild-gcc/tmp/build/20210514T050008Z/ruby/.ext/common/objspace/trace.rb:29: warning: method redefined; discarding old p", "objspace/trace is enabled"]>. ```
2021-05-14ext/objspace/lib/objspace/trace.rb: AddedYusuke Endoh
This file, when require'ed, starts tracing the object allocations, and redefines `Kernel#p` to show the allocation site. This commit is experimental; the library name and APIs may change. [Feature #17762]
2021-05-06Allow newobj_of0 and newobj_slowpath to allocate into multiple heap slotsMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/4391
2021-04-26Fix compiler warnings in objspace_dump.c when assertions are turned onPeter Zhu
Example: ``` In file included from ../../../include/ruby/defines.h:72, from ../../../include/ruby/ruby.h:23, from ../../../gc.h:3, from ../../../ext/objspace/objspace_dump.c:15: ../../../ext/objspace/objspace_dump.c: In function ‘dump_append_ld’: ../../../ext/objspace/objspace_dump.c:95:26: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘int’ [-Wsign-compare] 95 | RUBY_ASSERT(required <= width); | ^~ ``` Notes: Merged: https://github.com/ruby/ruby/pull/4417
2021-04-13dependency updates卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/4371
2021-02-04objspace_dump.c: tag singleton classes and reference the superclassJean Boussier
Notes: Merged: https://github.com/ruby/ruby/pull/4104
2021-01-20objspace_dump.c: Handle allocation path and line missingJean Boussier
Notes: Merged: https://github.com/ruby/ruby/pull/4078
2021-01-05enable constant cache on ractorsKoichi Sasada
constant cache `IC` is accessed by non-atomic manner and there are thread-safety issues, so Ruby 3.0 disables to use const cache on non-main ractors. This patch enables it by introducing `imemo_constcache` and allocates it by every re-fill of const cache like `imemo_callcache`. [Bug #17510] Now `IC` only has one entry `IC::entry` and it points to `iseq_inline_constant_cache_entry`, managed by T_IMEMO object. `IC` is atomic data structure so `rb_mjit_before_vm_ic_update()` and `rb_mjit_after_vm_ic_update()` is not needed. Notes: Merged: https://github.com/ruby/ruby/pull/4022
2020-12-24Expose atomic operation macros with RUBY prefixNobuyoshi Nakada
Now we need atomic operations, which are lighter than mutex, more widely for extension libraries because of Ractor. Notes: Merged: https://github.com/ruby/ruby/pull/3983
2020-10-06Prevent objects from moving while iterating the heapAaron Patterson
This iterator uses an st_table, but if objects move the references in the st table won't be updated. This patch just changes the st table to an identity hash. Notes: Merged: https://github.com/ruby/ruby/pull/3634
2020-10-03Fix ObjectSpace.dump(obj, output: :stdout)Kazuhiro NISHIYAMA
RDoc says `ObjectSpace.dump(obj, output: :stdout) # => nil`, but it returns STDOUT since fbba6bd4e3dff7a61965208fecae908f10c4edbe. I think it is unintentional change. Notes: Merged: https://github.com/ruby/ruby/pull/3620
2020-09-29Fix up dependencies on internal/sanitizers.hNobuyoshi Nakada
2020-09-28Refactor common heap iteration codeAaron Patterson
We have code common to all heap iteration paths in this file. Refactor such that we keep ASAN checks and flags checks in one place Notes: Merged: https://github.com/ruby/ruby/pull/3592
2020-09-28Fix ASAN support when invalidating CCsAaron Patterson
Again, this code is walking the heap. Empty slots can be poisoned, so we need to unpoison before checking the type Notes: Merged: https://github.com/ruby/ruby/pull/3592
2020-09-28Make ext/objspace ASAN friendlyAaron Patterson
ext/objspace iterates over the heap, but some slots in the heap are poisoned, so we need to take care of that when running with ASAN Notes: Merged: https://github.com/ruby/ruby/pull/3592
2020-09-25Return nil when argument to ObjectSpace.internal_class_of is T_IMEMOAlan Wu
The added test case crashes the interpreter because it makes ObjectSpace.internal_class_of return the second VALUE slot of an AST imemo object. The second VALUE slot of `struct rb_ast_struct` is not a VALUE and not a pointer to a Ruby object. Notes: Merged: https://github.com/ruby/ruby/pull/3503
2020-09-15Parse ObjectSpace.dump_all / dump arguments in Ruby to avoid allocation noiseJean Boussier
[Feature #17045] ObjectSpace.dump_all should allocate as little as possible in the GC heap Up until this commit ObjectSpace.dump_all allocates two Hash because of `rb_scan_args`. It also can allocate a `File` because of `rb_io_get_write_io`. These allocations are problematic because `dump_all` dumps the Ruby heap, so it should try modify as little as possible what it is observing. Notes: Merged: https://github.com/ruby/ruby/pull/3530
2020-09-11Add missing breakKazuhiro NISHIYAMA
pointed out by Coverity Scan
2020-09-09Optimize ObjectSpace.dump_allJean Boussier
The two main optimization are: - buffer writes for improved performance - avoid formatting functions when possible ``` | |compare-ruby|built-ruby| |:------------------|-----------:|---------:| |dump_all_string | 1.038| 195.925| | | -| 188.77x| |dump_all_file | 33.453| 139.645| | | -| 4.17x| |dump_all_dev_null | 44.030| 278.552| | | -| 6.33x| ``` Notes: Merged: https://github.com/ruby/ruby/pull/3420
2020-09-09Add a :since option to dump_allJean Boussier
This is useful to see what a block of code allocated, e.g. ``` GC.start GC.disable ObjectSpace.trace_object_allocations do # run some code end gc_gen = GC.count allocations = ObjectSpace.dump_all(output: :file, since: gc_gen) GC.enable GC.start retentions = ObjectSpace.dump_all(output: :file, since: gc_gen) ``` Notes: Merged: https://github.com/ruby/ruby/pull/3368
2020-08-27sed -i '/rmodule.h/d'卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/3347
2020-08-27sed -i '/r_cast.h/d'卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/3346
2020-08-27sed -i '\,2/extern.h,d'卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/3338
2020-08-19Fix ObjectSpace.trace_object_allocations_stop to not raise if the tracepoint ↵Jean Boussier
were not initialized Notes: Merged: https://github.com/ruby/ruby/pull/3001
2020-08-19RHASH_TBL: is now ext-only卜部昌平
It seems almost no internal codes use RHASH_TBL any longer. Why not just eliminate it entirely, so that the macro can be purely ext-only. Notes: Merged: https://github.com/ruby/ruby/pull/3426
2020-08-18Update references when tracing allocationsAaron Patterson
The allocation tracing code keeps essentially a weak reference to objects that have been allocated (storing the allocation information along with the weak ref). Compacting the heap would break references in this weak map, so the wrong values could be returned. This commit just updates the values in the weak ref in order to fix the allocation tracing book keeping Notes: Merged: https://github.com/ruby/ruby/pull/3429
2020-08-17Fix method name escaping in ObjectSpace.dumpJohn Hawthorn
It's possible to define methods with any name, even if the parser doesn't support it and it can only be used with ex. send. This fixes an issue where invalid JSON was output from ObjectSpace.dump when a method name needed escaping. Notes: Merged: https://github.com/ruby/ruby/pull/3383
2020-08-17Also escape DEL codeNobuyoshi Nakada
2020-08-17Fixed the radix for control charsNobuyoshi Nakada
2020-07-28[DOC] Clarify ObjectSpace return values are in bytes [ci skip]Simon Perepelitsa
Notes: Merged: https://github.com/ruby/ruby/pull/3308
2020-07-23Avoid allocating a string when dumping an anonymous module or classJean Boussier
Notes: Merged: https://github.com/ruby/ruby/pull/3349
2020-07-10Fix missing imemo cases in objspace_dump by refactoringAlan Wu
imemo_callcache and imemo_callinfo were not handled by the `objspace` module and were showing up as "unknown" in the dump. Extract the code for naming imemos and use that in both the GC and the `objspace` module. Notes: Merged: https://github.com/ruby/ruby/pull/3304
2020-06-14Introduce find pattern [Feature #16828]Kazuki Tsujimoto
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-04Fix indentationKazuki Tsujimoto
2020-04-08Suppress -Wswitch warningsNobuyoshi Nakada
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <shyouhei@ruby-lang.org>
2020-02-29should not expose hidden object.Koichi Sasada
Hidden object (T_CLASS) can be exposed (BUG). Also rename rb_mInternalObjectWrapper to rb_cInternalObjectWrapper because it is a class.
2020-02-22Introduce disposable call-cache.Koichi Sasada
This patch contains several ideas: (1) Disposable inline method cache (IMC) for race-free inline method cache * Making call-cache (CC) as a RVALUE (GC target object) and allocate new CC on cache miss. * This technique allows race-free access from parallel processing elements like RCU. (2) Introduce per-Class method cache (pCMC) * Instead of fixed-size global method cache (GMC), pCMC allows flexible cache size. * Caching CCs reduces CC allocation and allow sharing CC's fast-path between same call-info (CI) call-sites. (3) Invalidate an inline method cache by invalidating corresponding method entries (MEs) * Instead of using class serials, we set "invalidated" flag for method entry itself to represent cache invalidation. * Compare with using class serials, the impact of method modification (add/overwrite/delete) is small. * Updating class serials invalidate all method caches of the class and sub-classes. * Proposed approach only invalidate the method cache of only one ME. See [Feature #16614] for more details. Notes: Merged: https://github.com/ruby/ruby/pull/2888
2020-02-22VALUE size packed callinfo (ci).Koichi Sasada
Now, rb_call_info contains how to call the method with tuple of (mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and mid+argc+flags only requires 64bits. So this patch packed rb_call_info to VALUE (1 word) on such cases. If we can not represent it in VALUE, then use imemo_callinfo which contains conventional callinfo (rb_callinfo, renamed from rb_call_info). iseq->body->ci_kw_size is removed because all of callinfo is VALUE size (packed ci or a pointer to imemo_callinfo). To access ci information, we need to use these functions: vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci). struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg. rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc() is temporary removed because cd->ci should be marked. Notes: Merged: https://github.com/ruby/ruby/pull/2888
2019-12-31Updated dependencies on internal/warnings.hNobuyoshi Nakada
Needed for `UNALIGNED_MEMBER_ACCESS` using `COMPILER_WARNING_`* macros. Notes: Merged: https://github.com/ruby/ruby/pull/2799
2019-12-26update dependencies卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/2711