* bignum.c (big_div_struct): added volatile to 'stop' member.
  Otherwise, "if (bds->stop)" check in bigdivrem1 don't read
  memory and ignore interrupt.
* bignum.c (bigdivrem, rb_big_stop): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bignum.c (bigdivrem): restart calculation when bigdivrem1 was
  interrupted by signal. Otherwise, ruby script may see a garbage
  value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c (argf_each_codepoint): add missing ARGF#codepoints [Bug #7438]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_thread_struct): added 'in_trap' member for marking
  running trap handler.
* signal.c (signal_exec): turn on in_trap when running trap.
* thread.c (Init_Thread, thread_create_core): initialize in_trap
  when creating new threads.
* thread.c (thread_join_m): raise ThreadError when running trap
  handler.Bug [#6416][ruby-core:44956]
* test/ruby/test_thread.rb (test_thread_join_in_trap): new test
  for the above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c (rb_str_enumerate_chars, rb_str_enumerate_codepoints)
(rb_str_enumerate_lines): suppress "may be used uninitialized in
  this function" warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* benchmark/driver.rb: accept multiple `-e'.
  You don't need to use `;' separation character.
  [ruby-core:50139] [ruby-trunk - Bug #7380]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
split trap interrupt and async interrupt

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (signal_exec): suppress "warning: variable 'signum'
  might be clobbered by 'longjmp' or 'vfork'" warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (signal_exec): add volatile to make sure setjmp safe.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* common.mk: specify label `built-ruby'.
* benchmark/driver.rb: quote path.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bootstraptest/test_thread.rb: try to `join' each 100
  threads.
  This benchmark seems consuming long time on travis-ci
  several times (and make `failure').



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.c (make_compile_option_value): add trace_instruction option.
  a patch by davidbalbert (David Albert).
  [Bug #6786]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby_atomic.h (ATOMIC_CAS): new macro for compare-and-exchange.

* vm_core.h (struct rb_thread_struct): add interrupt_mask member.
* thread.c (thread_create_core, Init_Thread): initialize
  th->thread_mask.

* vm_core.h (RUBY_VM_INTERRUPTED_ANY): new macro for avoiding
  bare th->interrupt_flag.
* vm_core.h (RUBY_VM_INTERRUPTED, RUBY_VM_INTERRUPTED): check
  th->interrupt_mask.
* thread.c (set_unblock_function, rb_thread_schedule): replace
  th->interrupt_flag with RUBY_VM_INTERRUPTED_ANY()

* signal.c (signal_exec): set up thread->interrupt_mask for
  preventing recursive trap handler.
* vm_core.h (RUBY_VM_CHECK_INTS, RUBY_VM_CHECK_INTS_BLOCKING): ditto.

* thread.c (rb_threadptr_execute_interrupts):
  don't process interrupt if it is masked.
  [Bug #6009] [ruby-core:42524]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_argf.rb (TestArgf#test_chars): since marshal data is
  binary, shouldn't pass via text mode.  use base64 encoded data.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c (thread_join_m): use th->interrupt_mask instead of
  th->in_trap.

* vm_core.h (struct rb_thread_struct): remove in_trap member.
* signal.c (signal_exec): ditto.
* thread.c (thread_create_core): ditto.
* thread.c (Init_Thread): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT)
(RUBY_VM_SET_FINALIZER_INTERRUPT, RUBY_VM_SET_TRAP_INTERRUPT)
(RUBY_VM_INTERRUPTED): use enum symbol instead of immediate value.
* thread.c (thread_join_m, rb_threadptr_execute_interrupts): ditto.
* signal.c (signal_exec): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c (rb_thread_terminate_all): use native_sleep() instead
  of rb_thread_schedule(). Otherwise, it consume 100% cpu meaninglessly.
  [Bug #5368] [ruby-dev:44546]
* thread.c (thread_start_func_2): last sub-thread wakes up main thread.

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