Граф коммитов

49 Коммитов

Автор SHA1 Сообщение Дата
0x005c 461db352c2 Rename RUBY_MARK_NO_PIN_UNLESS_NULL to RUBY_MARK_MOVABLE_UNLESS_NULL 2020-01-23 00:11:03 +13:00
卜部昌平 5e22f873ed decouple 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).
2019-12-26 20:45:12 +09:00
Breno Leitao f47c38245f gc.h: Add SET_MACHINE_STACK_END specific for Powerpc64 (#1767)
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-12-16 10:05:21 +09:00
Aaron Patterson aac4d9d6c7
Rename rb_gc_mark_no_pin -> rb_gc_mark_movable
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-12 16:44:54 -04:00
Koichi Sasada 6bf8db9a07 add rp() and bp() in internal.h.
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-08-09 14:01:15 +09:00
git b9ad62ea13 * remove trailing spaces. 2019-07-12 15:02:25 +09:00
Samuel Williams a2adcd40df
Add note about `STACK_GROW_DIR_DETECTION`. 2019-07-12 11:56:51 +12:00
Koichi Sasada 88449100bc don't need to sweep rest.
`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-05-16 17:18:50 +09:00
tenderlove 91793b8967 Add `GC.compact` again.
🙏

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20 01:19:47 +00:00
tenderlove 744e5df715 Reverting compaction for now
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-17 09:41:41 +00:00
tenderlove 3c55b643ae Adding `GC.compact` and compacting GC support.
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-17 03:17:25 +00:00
kazu 25c1fd3b90 Reverting all commits from r67479 to r67496 because of CI failures
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-10 09:15:21 +00:00
tenderlove 3ef4db15e9 Adding `GC.compact` and compacting GC support.
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
2019-04-09 20:32:04 +00:00
ko1 5256f77527 remove rb_threadptr_during_gc().
* 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-29 13:51:37 +00:00
hsbt 0e2d2e6a79 Drop to support NaCl platform.
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-10-23 05:56:25 +00:00
nobu a1caed95cb thread.c: during GC for thread
* 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
2017-04-12 14:47:50 +00:00
ko1 31ee824ef4 * gc.h, gc.c: introduce new debug function rb_obj_info_dump(VALUE obj)
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-10-06 16:22:54 +00:00
nobu bb8abf62d3 gc.h: evaluate the macro argument only once
* 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-14 23:59:23 +00:00
ko1 771fceba59 * gc.c (rb_raw_obj_info): separated from rb_obj_info().
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-07-02 09:36:59 +00:00
ko1 3d410dde5c * gc.c , gc.h (rb_obj_info): export obj_info(VALUE) for debugging.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-31 19:12:42 +00:00
ko1 2006bfe2f4 * gc.c: rename is_dying_object() to is_garbage_object().
* 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-07-06 15:42:14 +00:00
ko1 37067ed905 * gc.c, gc.h (rb_objspace_each_objects_without_setup):
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-04-02 11:59:50 +00:00
ko1 c6f2c9383f * gc.c, gc.h (rb_objspace_marked_object_p): added.
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
2014-02-08 07:03:43 +00:00
ko1 f241016825 * gc.h (rb_objspace_reachable_objects_from_root): added.
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-10-15 10:22:33 +00:00
akr b1dd4c92ce * gc.h (SET_MACHINE_STACK_END): Add !defined(_ILP32) to a defining
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-05-10 15:49:56 +00:00
nobu bff997e02b defines.h: RUBY_SYMBOL_EXPORT_{BEGIN,END}
* 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-04-05 10:29:38 +00:00
kosaki 08c11c23cb * gc.h (SET_MACHINE_STACK_END): use __volatile__ instead of volatile.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-10 05:41:01 +00:00
kosaki 2ba9cdcee6 * gc.h (SET_MACHINE_STACK_END): add volatile for preventing
harmful optimization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 21:15:01 +00:00
ko1 6c6dece7f1 * ext/objspace/objspace.c (ObjectSpace.reachable_objects_from):
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-24 00:04:56 +00:00
ko1 e03d6d9eb8 * ext/objspace/objspace.c: add ObjectSpace#reachable_objects_from.
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-10-05 08:14:09 +00:00
nobu 8706c00dfd gc.h: IS_STACK_DIR_UPPER
* 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-06-10 08:54:38 +00:00
yugui 76bc2d1ed7 Imports Ruby's port to NativeClient (a.k.a NaCl).
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
2012-05-17 02:48:59 +00:00
nobu 96c078c340 * eval.c (ruby_cleanup): use rb_ary_free to free internal object.
* 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-02-11 10:45:34 +00:00
akr 196833eb80 * gc.h: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-18 14:05:20 +00:00
nobu 23b1a3d3fa * gc.h (rb_objspace_each_objects): used in objspace.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 06:11:03 +00:00
nobu 89cc2aef81 * cont.c (stackgrowdirection): removed duplicated code, use
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-05-08 16:15:20 +00:00
nobu 95c52c8e6c * gc.c (GET_STACK_BOUNDS): fixed macro argument names. a patch from
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
2010-04-14 07:29:04 +00:00
akr ed58a66fa8 * gc.h (SET_MACHINE_STACK_END): use __i386.
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
2009-10-27 06:54:03 +00:00
nobu 206a928130 * gc.h (SET_MACHINE_STACK_END): use __i386__ instead of __i386,
and explicit size qualifiers.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-27 03:30:18 +00:00
naruse be6ff25403 * gc.c (SET_MACHINE_STACK_END): add x86_64 version by nobu.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-27 01:29:22 +00:00
nobu aaa01efb95 * gc.h (rb_gc_debug_body): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-16 04:40:11 +00:00
nobu fc3c60f608 * gc.h (STACK_UPPER): moved from gc.c
* thread.c, thread_{pthread,win32}.c (ruby_init_stack,
  ruby_thread_init_stack): moved stack initialization from gc.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-14 02:59:19 +00:00
ko1 5c00dd28c5 * gc.h: extern variable should not be initialized.
* thread_pthread.c: add a parameter.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 08:13:39 +00:00
ko1 3453b2bd0e * gc.h, vm_core.h: decl of rb_gc_save_machine_context()
should be at vm_core.h.
* include/ruby/ruby.h, intern.h: remove type rb_thread_t.
* include/ruby/intern.h: change rb_unblock_function_t,
  rb_unblock_function_t.
* file.c, process.c: apply above changes.
* thread.c, thread_pthread.ci, thread_win32.ci: ditto.
* io.c: support blocking open (2). [ruby-core:13614]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 10:47:53 +00:00
akr 0886a4d8a0 * configure.in: add --enable-valgrind.
* gc.h (SET_MACHINE_STACK_END): new macro to replace
  rb_gc_set_stack_end.  it find out accurate stack boundary by
  asm using gcc on x86.

* thread.c (rb_gc_set_stack_end): don't define if asm-version
  SET_MACHINE_STACK_END is available.

* gc.c (mark_current_thread): extracted from garbage_collect.
  it use SET_MACHINE_STACK_END to not scan out of stack area.
  it notify conservative GC information to valgrind if
  --enable-valgrind.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-14 07:19:59 +00:00
ko1 4bdb5ced9a * gc.h: add RUBY_ prefix to debug macros.
* cont.c, proc.c, yarvcore.c,
* gc.c: define ruby_gc_debug_indent variable to debug mark/free.
* vm.c, insnhelper.ci: rename some functions to vm_* or rb_vm_*.
  move some functions, definitions, declarations to suitable files.
* eval.c, yarvcore.h, eval_error.ci, insnhelper.ci: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-25 02:44:20 +00:00
ko1 7980e653e5 * call_cfunc.ci: removed.
* insnhelper.ci: added. this function includes all functions that
  vm insns need.
* common.mk: ditto.
* insnhelper.h, vm.h, vm.c: move some declaration.
* gc.h: remove GC_CHECK() macro because GC.stress is more useful.
* compile.c, iseq.c, vm_dump: ditto.
* gc.h, thread.c: move a prototype decalaration.
* debug.c, debug.h: rename some functions.
* compile.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-24 17:19:22 +00:00
ko1 025cfde57d * eval_thread.c, common.mk: remove eval_thread.c.
* yarvcore.c: rename cYarvThread to rb_cThread.
* gc.c: remove YARV_* prefix.
* gc.h: add an include guard and prototype of rb_gc_set_stack_end().
* inits.c: fix to ANSI prototype style and reorder Init_*().
* io.c (pipe_finalize): TODO: comment out last_status.
* process.c, yarvcore.h: fix to use yarv_vm_t#last_status instead of
  rb_last_status and make last_status_get() to access $?.
* yarvcore.c (vm_mark): mark yarv_vm_t#last_status.
* ruby.h: add declarations of rb_cISeq and rb_cVM.
* thread.c: move eval_thread.c codes to thread.c and remove yarv_*
  function prefix.
* thread.c (thread_start_func_2): use yarv_thread_t#first_func if
  it is not null.
* vm.c: fix copyright year.
* yarvcore.c (Init_vm): rename to Init_VM().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-05 12:21:01 +00:00
ko1 a3e1b1ce7e * Merge YARV
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-31 15:02:22 +00:00