summaryrefslogtreecommitdiff
path: root/gc.h
AgeCommit message (Collapse)Author
2023-02-09Merge gc.h and internal/gc.hMatt Valentine-House
[Feature #19425] Notes: Merged: https://github.com/ruby/ruby/pull/7273
2023-01-04Fix crash in tracing object allocationsPeter Zhu
ObjectSpace.trace_object_allocations_start could crash since it adds a TracePoint for when objects are freed. However, TracePoint could crash since it modifies st tables while inside the GC that is trying to free the object. This could cause a memory allocation to happen which would crash if it triggers another GC. See a crash log: http://ci.rvm.jp/results/trunk@ruby-sp1/4373707 Notes: Merged: https://github.com/ruby/ruby/pull/7058
2022-11-10Transition shape when object's capacity changesJemma Issroff
This commit adds a `capacity` field to shapes, and adds shape transitions whenever an object's capacity changes. Objects which are allocated out of a bigger size pool will also make a transition from the root shape to the shape with the correct capacity for their size pool when they are allocated. This commit will allow us to remove numiv from objects completely, and will also mean we can guarantee that if two objects share shapes, their IVs are in the same positions (an embedded and extended object cannot share shapes). This will enable us to implement ivar sets in YJIT using object shapes. Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/6699
2022-10-19Fix and improve coroutines for Darwin (macOS) ppc/ppc64. (#5975)Sergey Fedorov
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-07-10Use `size_t` for `rb_raw_obj_info`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6092
2022-02-03Add the size pool slot size to the output of ObjectSpace.dump/dump_allMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/5520
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-04Enable inline assembly of SET_MACHINE_STACK_END on AIXRei Odaira
2021-09-11Remove printf family from the mjit headerNobuyoshi Nakada
Linking printf family functions makes mjit objects to link unnecessary code. Notes: Merged: https://github.com/ruby/ruby/pull/4820
2020-09-03Introduce Ractor mechanism for parallel executionKoichi Sasada
This commit introduces Ractor mechanism to run Ruby program in parallel. See doc/ractor.md for more details about Ractor. See ticket [Feature #17100] to see the implementation details and discussions. [Feature #17100] This commit does not complete the implementation. You can find many bugs on using Ractor. Also the specification will be changed so that this feature is experimental. You will see a warning when you make the first Ractor with `Ractor.new`. I hope this feature can help programmers from thread-safety issues. Notes: Merged: https://github.com/ruby/ruby/pull/3365
2020-08-14Enable arm64 optimizations that exist for power/x86 (#3393)AGSaidi
* Enable unaligned accesses on arm64 64-bit Arm platforms support unaligned accesses. Running the string benchmarks this change improves performance by an average of 1.04x, min .96x, max 1.21x, median 1.01x * arm64 enable gc optimizations Similar to x86 and powerpc optimizations. | |compare-ruby|built-ruby| |:------|-----------:|---------:| |hash1 | 0.225| 0.237| | | -| 1.05x| |hash2 | 0.110| 0.110| | | 1.00x| -| * vm_exec.c: improve performance for arm64 | |compare-ruby|built-ruby| |:------------------------------|-----------:|---------:| |vm_array | 26.501M| 27.959M| | | -| 1.06x| |vm_attr_ivar | 21.606M| 31.429M| | | -| 1.45x| |vm_attr_ivar_set | 21.178M| 26.113M| | | -| 1.23x| |vm_backtrace | 6.621| 6.668| | | -| 1.01x| |vm_bigarray | 26.205M| 29.958M| | | -| 1.14x| |vm_bighash | 504.155k| 479.306k| | | 1.05x| -| |vm_block | 16.692M| 21.315M| | | -| 1.28x| |block_handler_type_iseq | 5.083| 7.004| | | -| 1.38x| Notes: Merged-By: nurse <naruse@airemix.jp>
2020-01-23Rename RUBY_MARK_NO_PIN_UNLESS_NULL to RUBY_MARK_MOVABLE_UNLESS_NULL0x005c
Notes: Merged: https://github.com/ruby/ruby/pull/2823
2019-12-26decouple internal.h headers卜部昌平
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies). Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-12-16gc.h: Add SET_MACHINE_STACK_END specific for Powerpc64 (#1767)Breno Leitao
Currently we are not able to grab the correct end/top of the stack on powerpc64 due to the fact that it uses the fallback function. The fallback function does not return the correct top of the stack because it adds a new frame and the returned top of the stack contains this frame overhead that could be something around 112 bytes on Powerpc64. This patch simply gets the correct top of the stack pointer, which is always on r1 register according to both ABI v1 and ABI v2 (Little endian). Signed-off-by: Breno Leitao <leitao@debian.org>
2019-08-12Rename rb_gc_mark_no_pin -> rb_gc_mark_movableAaron Patterson
Renaming this function. "No pin" leaks some implementation details. We just want users to know that if they mark this object, the reference may move and they'll need to update the reference accordingly.
2019-08-09add rp() and bp() in internal.h.Koichi Sasada
debug utility macro rp() (rp_m()) and bp() are introduced. * rp(obj) shows obj information w/o any side-effect to STDERR. * rp_m(m, obj) is similar to rp(obj), but show m before. * bp() is alias of ruby_debug_breakpoint(), which is registered as a breakpoint in run.gdb (used by `make gdb` or make gdb-ruby`).
2019-07-12* remove trailing spaces.git
2019-07-12Add note about `STACK_GROW_DIR_DETECTION`.Samuel Williams
2019-05-16don't need to sweep rest.Koichi Sasada
`transient_heap_evacuate()` disables GC using `rb_gc_disable()` to prohibt GC invocation because of new allocation for evacuated memory. However, `rb_gc_disable()` sweep all rest of unswept pages. We don't need to cancel lazy sweep so this patch introduce `rb_gc_disable_no_rest()` which doesn't cancel lazy sweep.
2019-04-20Add `GC.compact` again.tenderlove
🙏 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17Reverting compaction for nowtenderlove
For some reason symbols (or classes) are being overridden in trunk git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17Adding `GC.compact` and compacting GC support.tenderlove
This commit adds the new method `GC.compact` and compacting GC support. Please see this issue for caveats: https://bugs.ruby-lang.org/issues/15626 [Feature #15626] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10Reverting all commits from r67479 to r67496 because of CI failureskazu
Because hard to specify commits related to r67479 only. So please commit again. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-09Adding `GC.compact` and compacting GC support.tenderlove
This commit adds the new method `GC.compact` and compacting GC support. Please see this issue for caveats: https://bugs.ruby-lang.org/issues/15626 [Feature #15626] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29remove rb_threadptr_during_gc().ko1
* gc.c (rb_threadptr_during_gc): removed because nobody use it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-23Drop to support NaCl platform.hsbt
Because NaCl and PNaCl are already sunset status. see https://bugs.chromium.org/p/chromium/issues/detail?id=239656#c160 configure.ac: Patch for this file was provided by @nobu. [Feature #14041][ruby-core:83497][fix GH-1726] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-12thread.c: during GC for threadnobu
* thread.c (ruby_thread_stack_overflow): check if the given thread is during GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-06* gc.h, gc.c: introduce new debug function rb_obj_info_dump(VALUE obj)ko1
which prints the result of rb_raw_obj_info(..., obj). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14gc.h: evaluate the macro argument only oncenobu
* gc.h (RUBY_MARK_UNLESS_NULL): evaluate the argument only once to get rid of inadvertent side effects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02* gc.c (rb_raw_obj_info): separated from rb_obj_info().ko1
Fill internal object information into passed buffer. * gc.h: declare rb_raw_obj_info(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-31* gc.c , gc.h (rb_obj_info): export obj_info(VALUE) for debugging.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-06* gc.c: rename is_dying_object() to is_garbage_object().ko1
* gc.h: rb_objspace_garbage_object_p() as an exported function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-02* gc.c, gc.h (rb_objspace_each_objects_without_setup):ko1
Add a new (hidden) C-API to iterate objspace snapshot. This API is not safe to call any C-APIs in a given callback function. Be careful to use this C-API. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-08* gc.c, gc.h (rb_objspace_marked_object_p): added.ko1
This function *ONLY* works just after marking phase, before any sweeping. This function is highly depending current GC implementation and can be removed future version. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-15* gc.h (rb_objspace_reachable_objects_from_root): added.ko1
This API provides information which objects are root objects. `category' shows what kind of root objects. * gc.c (gc_mark_roots): separate from gc_marks_body(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-10* gc.h (SET_MACHINE_STACK_END): Add !defined(_ILP32) to a definingakr
condition to avoid compilation error on x32. https://sites.google.com/site/x32abi/ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-05defines.h: RUBY_SYMBOL_EXPORT_{BEGIN,END}nobu
* include/ruby/defines.h (RUBY_SYMBOL_EXPORT_{BEGIN,END}): visibility control macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-10* gc.h (SET_MACHINE_STACK_END): use __volatile__ instead of volatile.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01* gc.h (SET_MACHINE_STACK_END): add volatile for preventingkosaki
harmful optimization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24* ext/objspace/objspace.c (ObjectSpace.reachable_objects_from):ko1
internal object support. If given object `obj' has references to internal objects (such as T_NODE objects), then this method returns instances of `ObjectSpace::InternalObjectWrapper' instead of that internal objects. This instance contains a refereance to an internal object and you can check the type of internal object using `ObjectSpace::InternalObjectWrapper#type' method. Rdoc of `InternalObjectWrapper' is not prepared yet. * gc.c (rb_objspace_reachable_objects_from), gc.h: change an interface of 'rb_objspace_reachable_objects_from()' * gc.c, gc.h: add two APIs - rb_objspace_markable_object_p(obj): check markable or not. - rb_objspace_internal_object_p(obj): check internal or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-05* ext/objspace/objspace.c: add ObjectSpace#reachable_objects_from.ko1
This method returns an array of objects referenced by given object. If given object is special objects such as true/false/nil/Fixnum etc then it returns nil. See rdoc for details. [ruby-core:39772] * test/objspace/test_objspace.rb: add a test for this method. * gc.c: add rb_objspace_reachable_objects_from(). To make this function, add several member `mark_func_data' to rb_objspace_t. If mark_func_data is not null, then gc_mark() calls mark_func_data::mark_func. * gc.h: export rb_objspace_reachable_objects_from(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10gc.h: IS_STACK_DIR_UPPERnobu
* gc.h (IS_STACK_DIR_UPPER): utility macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-17Imports Ruby's port to NativeClient (a.k.a NaCl).yugui
Patch by Google Inc. [ruby-core:45073]. * configure.in (RUBY_NACL): New M4 func to configure variables for NaCl. (RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names of Pepper interface types. (BTESTRUBY): New variable to specify which ruby should be run on "make btest". NaCl can run the built binary by sel_ldr, but it need rbconfig.rb. So this variable is distinguished from $MINIRUBY. * thread_pthread.c: Disabled some features on NaCl. * io.c: ditto. * process.c: ditto. * signal.c: ditto. * file.c: ditto. * missing/flock.c: ditto. * nacl/pepper_main.c: An example implementation of Pepper application that embeds Ruby. * nacl/example.html: An example of web page that uses the Pepper application. * nacl/nacl-config.rb: Detects variants of NaCl SDK. * nacl/GNUmakefile.in: Makefile template for NaCl specific build process. * nacl/package.rb: script for packaging a NaCl-Ruby embedding application. * nacl/reate_nmf.rb: Wrapper script of create_nmf.py * dln.c (dln_load): Added a hack to call on NaCl. * util.c (ruby_getcwd): Path to the current directort is not available on NaCl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-11* eval.c (ruby_cleanup): use rb_ary_free to free internal object.nobu
* gc.h (RUBY_FREE_UNLESS_NULL): get rid of double free. [ruby-core:35192] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-18* gc.h: parenthesize macro arguments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14* gc.h (rb_objspace_each_objects): used in objspace.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08* cont.c (stackgrowdirection): removed duplicated code, usenobu
STACK_UPPER macro instead. * gc.h (STACK_DIR_UPPER): moved from thread_pthread.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-14* gc.c (GET_STACK_BOUNDS): fixed macro argument names. a patch fromnobu
Satoshi Shiba <shiba AT rvm.jp> at [ruby-dev:40973]. * gc.h (ruby_get_stack_grow_direction): fixed prototype. * thread_pthread.c (get_stack, ruby_stack_overflowed_p): both side should be same type. [Bug #3145] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-27* gc.h (SET_MACHINE_STACK_END): use __i386.akr
Some compiler may not define __i386__. Solaris 64-bit Developer's Guide: http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e