enum.c: nil if no iteration

* enum.c (enum_inject): return nil if no iteration, instead of
  Qundef.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/envutil.rb (assert_pattern_list) Renamed from
  assert_regexp_list.
  Show multiline string in multi lines.

* test/-ext-/bug_reporter/test_bug_reporter.rb: Use
  assert_pattern_list.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/etc/etc.c (etc_nprocessors_affinity): use sched_getaffinity
  for getting precious number of available cpus.

* ext/etc/etc.c (etc_nprocessors): use etc_nprocessors_affinity if
  possible.

  [Feature #10267] etc-nprocessors-kosaki2.patch



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Unused variable removed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Simplify a regexp.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Simplify multiline condition.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/etc/etc.c (etc_nprocessors_affin): Test CPU_ALLOC availability.
  CentOS 5 don't have CPU_ALLOC().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
fix typos [ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm_backtrace.c: unknown name method

* vm_backtrace.c (location_format): adjust unknown name method
  results to other functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm_backtrace.c: fix unknown ID name

* vm_backtrace.c (id2str): adapt rb_id2str which returns 0 on
  unknown ID to return Qnil, since oldbt_arg functions expect Qnil
  on unknown method names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
cont.c: Remove unused prev_fiber/next_fiber fields

They were added in r19890 (8a0d53a), with the explanation that it's a
double linked list of fibers in the same thread, but without any code
using them.

* cont.c (rb_fiber_t): remove prev_fiber/next_fiber
  (fiber_link_join, fiber_link_remove): remove functions
  (fiber_free, fiber_init, root_fiber_alloc):
   remove references to removed fields and functions
  [ruby-core:65518] [Feature #10341]

Author: Knut Franke <Knut.Franke@gmx.de>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 2014-10-16

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
cont.c: Code cleanup in fiber_switch/fiber_store

Defragment code blocks depending on FIBER_USE_NATIVE in order to make
the control flow (which is already non-trivial due to nonlocal jumps) in
each case more comprehensible.

Remove some unreachable code from fiber_switch (we've already excluded
the case (th->fiber == fibval) at the start of the function).

Remove call to rb_fiber_current which happened a few lines after
accessing GET_THREAD()->fiber directly (so if that's ever 0 we're
already screwed).

Author: Knut Franke <Knut.Franke@gmx.de>

* cont.c (fiber_store, fiber_switch): simplify
  [ruby-core:65518] [Feature #10341]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
cont.c: Small code cleanup

Remove variable that is used only once, several lines after
initialization.

* cont.c (cont_capture): remove unnecessary variable
  [ruby-core:65518] [Feature #10341]

Author: Knut Franke <Knut.Franke@gmx.de>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
cont.c (cont_save_thread): Sparse copying of thread data

Instead of copying the complete rb_thread_t struct (almost a kB),
selectively copy only those fields that will be needed later on.

* cont.c (rb_context_t): comment on saved_thread
  (cont_save_thread): sparse copy
  (cont_init): copy extra fields
  (fiber_init): use current thread VM stack size
  [ruby-core:65518] [Feature #10341]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
cont.c: Optimize fiber_switch callees

Remove some unnecessary VALUE/struct conversions and aggressively inline
functions used during fiber_switch. Either of these changes alone does
not yield significant performance increase, but in combination they
improve performance by ~6%.

Arguably, removal of separate VALUE/rb_fiber_t* variables also makes the
code more readable in a few places.

* vm_core.h: declare rb_fiber_t typedef
  (rb_thread_t): fiber and root_fiber become rb_fiber_t * (from VALUE)
* vm.c (rb_thread_mark): use rb_fiber_mark_self
* cont.c (rb_fiber_t): prev becomes rb_fiber_t * (from VALUE)
  (cont_mark, cont_free): simplify conditions
  (rb_fiber_mark_self): new function
  (fiber_mark): use rb_fiber_mark_self
  (cont_save_thread, cont_restore_thread): inline
  (cont_restore_thread): simplify
  (fiber_setcontext): simplify conditions
  (rb_cont_call): remove dereference
  (fiber_t_alloc): update for rb_fiber_t->prev type change
  (rb_fiber_start): ditto
  (fiber_current): extract from rb_fiber_current
  (return_fiber): move, simplify type checks
  (rb_fiber_current): use fiber_current
  (fiber_store): simplify type checks
  (fiber_switch): ditto, simplify call to fiber_setcontext,
   use fiber_current
  (rb_fiber_transfer): update for type changes
  (rb_fiber_terminate): move, use fiber_switch
  (rb_fiber_resume): update for type changes
  (rb_fiber_reset_root_local_storage): ditto
  (rb_fiber_yield): use rb_fiber_switch instead of rb_fiber_transfer
  (rb_fiber_m_transfer): ditto
  [ruby-core:65518] [Feature #10341]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
update doc.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
cont.c: fix build when FIBER_USE_NATIVE is 0

* cont.c (fiber_store): remove references to nextfib

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
cont.c: fix when FIBER_USE_NATIVE is 0

* cont.c (fiber_store): restore references to next_fib (fix typo)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
test/ruby/test_process.rb: avoid killing wrong parent

We must capture intended target PID before forking, since
Process.ppid may change if parent dies (e.g. due to timeout)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e