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

415 Коммитов

Автор SHA1 Сообщение Дата
nobu 16095eb187 vm.c: hide singleton class of frozen-core
* vm.c (Init_VM): hide also the singleton class of frozen-core, not
  only frozen-core itself.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-10 02:11:37 +00:00
sorah c4b4e77c72 * insns.def (opt_regexpmatch2): Check String#=~ hasn't overridden
before calling rb_reg_match().

* test/ruby/test_string.rb: Test for above.

* vm.c (vm_init_redefined_flag): Add BOP flag for String#=~

[ruby-core:57385] [Bug #8953]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26 07:58:28 +00:00
charliesome b18151cf53 * insns.def (opt_regexpmatch1): check Regexp#=~ is not defined before
calling rb_reg_match()

* test/ruby/test_regexp.rb: add test

* vm.c (ruby_vm_redefined_flag): change type to short[]

* vm.c (vm_redefinition_check_flag): return REGEXP_REDEFINED_OP_FLAG if
  klass == rb_cRegexp

* vm.c (vm_init_redefined_flag): setup BOP flag for Regexp#=~

* vm_insnhelper.h: add REGEXP_REDEFINED_OP_FLAG

[ruby-core:57385] [Bug #8953]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-26 07:39:48 +00:00
nobu eeb39e0152 vm.c: prototype
* vm.c (rb_next_class_sequence): use ANSI style definition and
  prorotype declaration, instead of old-K&R style.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04 07:18:24 +00:00
charliesome 2f522b9cc6 * class.c, compile.c, eval.c, gc.h, insns.def, internal.h, method.h,
variable.c, vm.c, vm_core.c, vm_insnhelper.c, vm_insnhelper.h,
  vm_method.c: Implement class hierarchy method cache invalidation.

  [ruby-core:55053] [Feature #8426] [GH-387]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04 05:25:06 +00:00
ko1 7e5d63f483 * compile.c (rb_iseq_compile_node): accept NODE_IFUNC to support
custom compilation.
* compile.c (NODE_POSTEXE): compile to
  "ONCE{ VMFrozenCore::core#set_postexe{...} }" with a new custom
  compiler `build_postexe_iseq()'.
* vm.c (m_core_set_postexe): remove parameters (passed by a block).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-22 06:50:42 +00:00
ko1 30b1947df2 * insns.def: fix regexp's once option behavior.
fix [ruby-trunk - Bug #6701]
* insns.def: remove `onceinlinecache' and introduce `once' instruction.
  `once' doesn't use `setinlinecache' insn any more.
* vm_core.h: `union iseq_inline_storage_entry' to store once data.
* compile.c: catch up above changes.
* iseq.c: ditto.
* vm.c, vm_insnhelper.c: ditto. fix `m_core_set_postexe()' which
  is depend on `onceinlinecache' insn.
* test/ruby/test_regexp.rb: add tests.
* iseq.c: ISEQ_MINOR_VERSION to 1 (should increment major?)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-20 17:41:13 +00:00
ko1 568c5a8193 * proc.c: add Binding#local_variable_get/set/defined?
to access local variables which a binding contains.
  Most part of implementation by nobu.
* test/ruby/test_proc.rb: add a tests for above.
* vm.c, vm_core.h (rb_binding_add_dynavars): add a new function
  to add a new environment to create space for new local variables.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-09 09:51:00 +00:00
ko1 22468a4f92 * vm_insnhelper.c (vm_push_frame): fix stack overflow check codes.
Stack overflow check should be done *after* pushing a stack frame.
  However, some stack overflow checking codes checked *before*
  pushing a stack frame with iseq->stack_max.
  To solve this problem, add a new parameter `stack_max' to specify
  a possible consuming stack size.
* vm_core.h (CHECK_VM_STACK_OVERFLOW0): add to share the stack overflow
  checking code.
* insns.def: catch up this change.
* vm.c, vm_eval.c: ditto.
* test/ruby/test_exception.rb: add a stack overflow test.
  This code is reported by nobu.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-06 08:33:05 +00:00
usa 0f0b60ea86 * vm.c (m_core_define_method, m_core_define_singleton_method): now
the value of def-expr is the Symbol of the name of the method, not
  nil.
  ref. [ruby-dev:42151] [Feature #3753]

* test/ruby/test_syntax.rb (TestSyntax#test_value_of_def): test for
  above changes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-02 14:58:11 +00:00
ko1 4223f00713 * include/ruby/ruby.h (OBJ_WRITE): cast to (VALUE *) for second
parameter `slot'. You don't need to write a cast (VALUE *) any more.
* class.c, compile.c, hash.c, iseq.c, proc.c, re.c, variable.c,
  vm.c, vm_method.c: remove cast expressions for OBJ_WRITE().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 19:52:40 +00:00
ko1 9b47ec04a8 * include/ruby/ruby.h (struct rb_data_type_struct), gc.c: add
rb_data_type_struct::flags. Now, this flags is passed
  at T_DATA object creation. You can specify FL_WB_PROTECTED
  on this flag.
* iseq.c: making non-shady iseq objects.
* class.c, compile.c, proc.c, vm.c: add WB for iseq objects.
* vm_core.h, iseq.h: constify fields to detect WB insertion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19 06:26:01 +00:00
ko1 5a70af1d59 * vm.c (kwmerge_i): add WB.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18 21:30:42 +00:00
nobu 6db56c86c9 fill rdocs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-02 03:12:04 +00:00
ktsj edb98f8b91 fix typos. Patch by k_takata.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 03:10:21 +00:00
nobu 4621799d3d vm.c: narrow variable scope
* vm.c (vm_exec): move escape_ep into exception block, since it is
  updated every time entering the block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-17 03:39:40 +00:00
nobu 83b1c8da9b revert r40760
* vm.c (vm_invoke_proc): revert r40760 partially, which causes timeout
  in test/ruby/test_thread.rb:test_stack_size.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-15 16:08:48 +00:00
nobu 17bce7d0c4 vm.c: suppress warnings
* vm.c (vm_invoke_proc, vm_exec), vm_eval.c (rb_eval_cmd): add
  volatile to suppress -Wclobbered warnings by gcc 4.9.0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-15 08:06:10 +00:00
ko1 83aba04862 * include/ruby/ruby.h: constify RBasic::klass and add
RBASIC_CLASS(obj) macro which returns a class of `obj'.
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
  This function reveal interal (hidden) object by rb_obj_hide().
  Note that do not change class before and after hiding.
  Only permitted example is:
  klass = RBASIC_CLASS(obj);
  rb_obj_hide(obj);
  ....
  rb_obj_reveal(obj, klass);
  TODO: API design. rb_obj_reveal() should be replaced with others.
  TODO: modify constified variables using cast may be harmful for
  compiler's analysis and optimizaton.
  Any idea to prohibt inserting RBasic::klass directly?
  If rename RBasic::klass and force to use RBASIC_CLASS(obj),
  then all codes such as `RBASIC(obj)->klass' will be
  compilation error. Is it acceptable? (We have similar
  experience at Ruby 1.9,
  for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
  object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
  without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
  file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
  parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
  string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
  Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
  ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 10:49:11 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
nobu 31457774a8 thread.c: id locals
* thread.c (id_locals): use cached ID.
* vm.c (ruby_thread_init): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-02 07:55:50 +00:00
nobu 7ef7a65df6 eval.c: use predefined IDs
* eval.c (frame_func_id): use predefined IDs.
* vm.c (rb_vm_control_frame_id_and_class): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-01 02:40:41 +00:00
nobu 9644f9b572 proc.c: use predefined IDs
* defs/id.def (predefined): add "idProc".
* proc.c (mnew, mproc, mlambda): use predefined IDs.
* vm.c (Init_VM): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-01 02:38:44 +00:00
nobu 787cdae5df proc.c: frozen core methods
* proc.c (mproc, mlambda): use frozen core methods instead of plain
  global methods, so that methods cannot be overridden.
  [ruby-core:54687] [Bug #8345]
* vm.c (Init_VM): define proc and lambda on the frozen core object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-30 03:31:43 +00:00
nobu c81f5fd326 * vm.c (VM_EP_LEP): simplify infinite loop.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-29 08:44:16 +00:00
nobu 228b29a697 load.c: loaded_features_index st_table
* load.c (rb_feature_p), vm_core.h (rb_vm_struct): turn
  loaded_features_index into st_table.  patches by tmm1 (Aman Gupta)
  in [ruby-core:53251] and [ruby-core:53274] [Bug #8048]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-22 08:38:51 +00:00
nobu 2d1c94a18d prefix global symbols
* iseq.c (rb_insn_operand_intern): prefix global symbols.

* numeric.c (ruby_num_interval_step_size): ditto.

* vm_backtrace.c (rb_vm_backtrace_str_ary),
  (rb_vm_backtrace_location_ary, rb_vm_thread_backtrace),
  (rb_vm_thread_backtrace_locations): ditto.

* vm_trace.c (rb_vm_trace_mark_event_hooks): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-06 06:30:03 +00:00
nobu f113ab552c class.c: check redefinition
* class.c (rb_prepend_module): check redefinition of built-in opimized
  methods.  [ruby-dev:47124] [Bug #7983]
* vm.c (rb_vm_check_redefinition_by_prepend): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05 12:36:45 +00:00
zzak b8e24f19b5 * vm.c: Typo in overview for example of Thread#status returning false
Reported by Lee Jarvis


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-27 17:43:25 +00:00
eregon 20514a0893 * vm.c (Thread): fix typos in overview
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-27 10:54:11 +00:00
zzak 6c9fdc616a * vm.c (Thread): Typo in overview, swap setting and getting
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-27 04:22:08 +00:00
zzak ab0d28c1bd * vm.c (Thread): Documentation overview of Thread class
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-27 04:02:06 +00:00
ktsj 16aedfe0a0 * vm.c (ENV_IN_HEAP_P): fix off-by-one error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-16 11:58:33 +00:00
ko1 b4add2ac2b * vm.c (rb_thread_mark): mark a working Proc of bmethod
(a method defined by define_method) even if the method was removed.
  We could not trace working Proc object which represents the body
  of bmethod if the method was removed (alias/undef/overridden).
  Simply, it was mark miss.
  This patch by Kazuki Tsujimoto. [Bug #7825]
  NOTE: We can brush up this marking because we do not need to mark
  `me' on each living control frame. We need to mark `me's
  only if `me' was free'ed. This is future work after Ruby 2.0.0.
* test/ruby/test_method.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-16 07:41:55 +00:00
ktsj ca016c705f * vm.c (rb_vm_stack_to_heap): call rb_vm_get_binding_creatable_next_cfp
instead of rb_vm_get_ruby_level_next_cfp to prevent a segfault by
  calling Kernel#callcc. See r39067 for more details.
  [ruby-dev:46908] [ruby-trunk - Bug #7774]

* test/ruby/test_settracefunc.rb: add a test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 15:55:41 +00:00
ko1 88101695ab * proc.c (rb_binding_new_with_cfp): permit to create binding object
of IFUNC frame.
  When `rb_binding_new_with_cfp()' is called, VM finds out the first
  normal (has iseq) frame and create a binding object of this frame
  and create Env objects. `ep's of related frames are updated
  (`ep's point Env object managed spaces).
  However, `ep' of skipped IFUNC frame was not updated and
  old invalid `ep' was remained. It causes serious problems.
  To solve this issue, permit IFUNC to create binding.
  (Maybe there is no problem on it)
  [ruby-dev:46908] [ruby-trunk - Bug #7774]
* test/ruby/test_settracefunc.rb: add a test.
* vm.c (rb_vm_get_binding_creatable_next_cfp), vm_core.h: added.
* vm_trace.c: fix to use `rb_vm_get_binding_creatable_next_cfp()'.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 06:04:59 +00:00
ko1 18e01f6381 * vm_backtrace.c: fix issue of rb_debug_inspector_open().
The order of making binding should be stack (frame) top to bottom.
  [Bug #7635]
  And also fix issue of collecting klass. Collecting klass is same
  as TracePoint#defined_class.
  (previous version, it returns T_ICLASS (internal objects).
* test/-ext-/debug/test_debug.rb: add a test.
* ext/-test-/debug/extconf.rb, init.c, inspector.c: ditto.
* vm_backtrace.c: remove magic number and add enum CALLER_BINDING_*.
* vm_backtrace.c, include/ruby/debug.h: add new C api (experimental)
  rb_debug_inspector_frame_self_get().
* vm.c, vm_core.h, vm_trace.c: move decl. of
  rb_vm_control_frame_id_and_class() and constify first parameter.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-29 08:25:32 +00:00
nobu 4e323c0a9d vm.c: initialize root_svar
* vm.c (th_init, ruby_thread_init): initialize root_svar with Qnil,
  since lep_svar_place() expects uninitialized svar to be nil, not 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-09 06:40:30 +00:00
nobu d00b1a7687 vm.c: suppress warning
* vm.c (check_machine_stack_size): ifdef a variable which is unused on
  non-pthread platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-28 03:03:19 +00:00
ko1 c2693f8bd6 * vm_trace.c (rb_threadptr_exec_event_hooks_and_pop_frame):
pop a frame before JUMP_TAG() if exception occurred.
  This change fix bug of Ruby 1.9.
  [ruby-core:51128] [ruby-trunk - Bug #7624]
* vm_core.h (EXEC_EVENT_HOOK_AND_POP_FRAME): add to use
  `rb_threadptr_exec_event_hooks_and_pop_frame()'.
* vm.c (vm_exec): use EXEC_EVENT_HOOK_AND_POP_FRAME() while
  exception handling. While exception hadnling, if an exception
  is raised in hooks, need to pop current frame and raise this
  raised exception by hook.
* test/ruby/test_settracefunc.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25 13:24:17 +00:00
ko1 270fbd9c05 * vm_core.h, eval_intern.h (CHECK_STACK_OVERFLOW): move
CHECK_STACK_OVERFLOW() to vm_core.h and rename to
  CHECK_VM_STACK_OVERFLOW().
  This change is only move and rename.
* tool/instruction.rb: catch up above changes.
* vm.c, vm_insnhelper.c: ditto.
* vm_insnhelper.c (vm_stackoverflow): add a function to unify
  raising vm stackoverflow exception.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25 09:57:07 +00:00
ko1 0f9b33c793 * thread.c: rename methods:
from Thread.async_interrupt_timing to Thread.handle_interrupt,
  from Thread.async_interrupted? to Thread.pending_interrupt?.
  Also rename option from `defer' to `never'.
  [ruby-core:51074] [ruby-trunk - Feature #6762]
* vm_core.c, thread.c: rename functions and data structure
  `async_errinfo' to `pending_interrupt'.
* thread.c: add global variables sym_immediate, sym_on_blocking and
  sym_never.
* cont.c, process.c, vm.c, signal.c: ditto.
* lib/sync.rb, lib/thread.rb: catch up this renaming.
* test/ruby/test_thread.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-23 10:18:58 +00:00
nagachika 6a35c26b2d * cont.c (rb_fiber_start): in case of jump with TAG_FATAL,
enqueue error into async_errinfo_queue, because you cannot call
  TH_TAG_JUMP() in this function. [ruby-dev:45218]  [Bug #5993]

* thread.c (rb_threadptr_execute_interrupts): now INT2FIX(TAG_FATAL)
  can be popped from async_errinfo_queue.

* vm.c (rb_vm_make_jump_tag_but_local_jump): revert r38441.
  rb_vm_make_jump_tag_but_local_jump() shouldn't return exception
  in case of state == TAG_FATAL.

* test/ruby/test_fiber.rb (test_exit_in_fiber): fix a test to illuminate
  Thread.exit should terminate current Thread.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22 06:45:28 +00:00
nobu 3ec171510e vm.c: fix format
* vm.c (get_param): fix format specifier for size_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-20 01:52:50 +00:00
ko1 87e1616048 * vm.c: support variable VM/Machine stack sizes.
Specified by the following environment variaables:
  - RUBY_THREAD_VM_STACK_SIZE: vm stack size used at thread creation.
  default: 128KB (32bit CPU) or 256KB (64bit CPU).
  - RUBY_THREAD_MACHINE_STACK_SIZE: machine stack size used at thread
  creation. default: 512KB or 1024KB.
  - RUBY_FIBER_VM_STACK_SIZE: vm stack size used at fiber creation.
  default: 64KB or 128KB.
  - RUBY_FIBER_MACHINE_STACK_SIZE: machine stack size used at fiber
  creation. default: 256KB or 256KB.
  This values are specified at launched timing. You can not change
  these values at running time.
  Environ variables are only *hints* because:
  - They are aligned to 4KB.
  - They have minimum values (depend on OSs).
  - Machine stack settings are ignored by some OSs.
  Default values especially fiber stack sizes are increased.
  This change affect Fiber's behavior:
  (1) You can run more complex program on a Fiber.
  (2) You can not make many (thousands) Fibers because of
  lack of address space (on 32bit CPU).
  If (2) bothers you,
  (a) Use 64bit CPU with big memory, or
  (b) Specify RUBY_FIBER_(VM|MACHINE)_STACK_SIZE correctly.
  You need to choose correct stack size carefully. These values
  are completely rely on systems (OS/compiler and so on).
* vm_core.h (rb_vm_t::default_params): add to record above settings.
* vm.c (RubyVM::DEFAULT_PARAMS): add new constant to see
  above setting.
* thread_pthread.c: support RUBY_THREAD_MACHINE_STACK_SIZE.
* cont.c: support RUBY_FIBER_(VM|MACHINE)_STACK_SIZE.
* test/ruby/test_fiber.rb: add tests for above.
* test/ruby/test_thread.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-19 22:29:18 +00:00
nagachika 26221584a9 * vm.c (rb_vm_jump_tag_but_local_jump): remove unnessesary 2nd
argument.

* load.c (rb_load_internal): ditto.

* eval_intern.h (rb_vm_jump_tag_but_local_jump): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-18 17:04:05 +00:00
nagachika 606b66db7d * vm.c (rb_vm_make_jump_tag_but_local_jump): take care of the case
TAG_JUMP() with TAG_FATAL (ex. rb_fatal()).

* test/ruby/test_fiber.rb (test_fatal_in_fiber): add a test for above.

* ext/-test-/fatal/extconf.rb, ext/-test-/fatal/rb_fatal.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-18 04:30:44 +00:00
kosaki aff9dff46d * signal.c (rb_sigaltstack_size): new. calculate stack size for
sigsegv handler. enlarge value when x86 or x86_64 on Linux.
  Linux has very small MINSIGSTKSZ size (2048 bytes) and
  our sigsegv routine need 5KiB at least. [Bug #7141]
* internal.h: add declaration of rb_sigaltstack_size().
* vm_core.h: remove ALT_STACK_SIZE definition.

* signal.c (rb_register_sigaltstack): replace ALT_STACK_SIZE with
  rb_sigaltstack_size();
* gc.c (Init_heap): ditto.
* vm.c (th_init): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-15 14:20:12 +00:00
nobu 63d0ea4c03 vm.c: pass exceptions while handling an exception
* vm.c (vm_exec): pass exceptions while handling an exception.
* vm_trace.c (rb_threadptr_exec_event_hooks): propagate exceptions.
  revert r38293 partially.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-11 18:45:43 +00:00
nobu b949447a49 probes_helper.h: RUBY_DTRACE_HOOK
* probes_helper.h (RUBY_DTRACE_HOOK): surround with do..while.

* vm.c (vm_exec): supply semicolon.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-11 03:37:19 +00:00