aboutsummaryrefslogtreecommitdiffstats
path: root/cont.c
Commit message (Collapse)AuthorAgeFilesLines
...
* cont.c: fiber local svarnobu2013-01-301-0/+2
| | | | | | | * cont.c (cont_restore_thread): svar should be separate per fibers. [ruby-core:51331] [Bug #7678] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c: define FIBER_USE_NATIVE as 0 in ia64.takano322013-01-101-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* adjust stylenobu2012-12-291-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c: rename methods:ko12012-12-231-2/+2
| | | | | | | | | | | | | | | | | | 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
* * cont.c (rb_fiber_start): unify conditions.nagachika2012-12-221-4/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_start): in case of jump with TAG_FATAL,nagachika2012-12-221-0/+3
| | | | | | | | | | | | | | | | | 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
* * vm_core.h, vm_trace.c: fix multi-threading bug for tracing.ko12012-12-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Move `trace_arg' from rb_tp_t::trace_arg to rb_thread_t::trace_arg. `trace_arg' may changed by multiple threads. rb_thread_t::trace_arg can represent rb_thread_t::trace_running (null or non-null) and rb_thread_t::trace_running is removed. After that, `rb_tp_t' is not needed to check tracing or not (A running thread knows tracing or not). This is why I remove tp_attr_check_active() and make new function get_trace_arg(). And this modification disable to work the following code: TracePoint.trace{|tp| Thread.new{p tp.event} # access `tp' from other threads. } I believe nobody mix threads at trace procedure. This is current limitation. * cont.c (fiber_switch, rb_cont_call): use rb_thread_t::trace_arg instead of rb_thread_t::trace_running. * test/ruby/test_settracefunc.rb: add a multi-threading test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c: support variable VM/Machine stack sizes.ko12012-12-191-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * cont.c (rb_fiber_start): don't enqueue Qnil to async_errinfo_queue.nagachika2012-12-151-1/+2
| | | | | | | | | rb_vm_make_jump_tag_but_local_jump() could return Qnil (ex. when finished by Thread.exit). [ruby-dev:45218] [Bug #5993] * test/ruby/test_fiber.rb (test_exit_in_fiber): add test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * revised r37993 to avoid SEGV/ILL in tests. In r37993, a methodshugo2012-12-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | entry with VM_METHOD_TYPE_REFINED holds only the original method definition, so ci->me is set to a method entry allocated in the stack, and it causes SEGV/ILL. In this commit, a method entry with VM_METHOD_TYPE_REFINED holds the whole original method entry. Furthermore, rb_thread_mark() is changed to mark cfp->klass to avoid GC for iclasses created by copy_refinement_iclass(). * vm_method.c (rb_method_entry_make): add a method entry with VM_METHOD_TYPE_REFINED to the class refined by the refinement if the target module is a refinement. When a method entry with VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with the same name is searched in refinements. If such a method is found, the method is invoked. Otherwise, the original method in the refined class (rb_method_definition_t::body.orig_me) is invoked. This change is made to simplify the normal method lookup and to improve the performance of normal method calls. * vm_method.c (EXPR1, search_method, rb_method_entry), vm_eval.c (rb_call0, rb_search_method_entry): do not use refinements for method lookup. * vm_insnhelper.c (vm_call_method): search methods in refinements if ci->me is VM_METHOD_TYPE_REFINED. If the method is called by super (i.e., ci->call == vm_call_super_method), skip the same method entry as the current method to avoid infinite call of the same method. * class.c (include_modules_at): add a refined method entry for each method defined in a module included in a refinement. * class.c (rb_prepend_module): set an empty table to RCLASS_M_TBL(klass) to add refined method entries, because refinements should have priority over prepended modules. * proc.c (mnew): use rb_method_entry_with_refinements() to get a refined method. * vm.c (rb_thread_mark): mark cfp->klass for iclasses created by copy_refinement_iclass(). * vm.c (Init_VM), cont.c (fiber_init): initialize th->cfp->klass. * test/ruby/test_refinement.rb (test_inline_method_cache): do not skip the test because it should pass successfully. * test/ruby/test_refinement.rb (test_redefine_refined_method): new test for the case a refined method is redefined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/util.h: removed extra semicolon in definition oftadf2012-11-211-1/+1
| | | | | | | | | | | | macro. * compile.c: ditto. * cont.c: ditto. * math.c: ditto. * node.c: ditto. * parse.y: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: remove rb_control_frame_t::bp (bp: base pointer).ko12012-09-281-1/+3
| | | | | | | | | | | | | | | | | | | `bp' can be calculate by `sp' (stack pointer) of previous frame. Now, `bp_check' field is remained for debug. You can eliminate this field by setting VM_DEBUG_BP_CHECK as 0. * vm_insnhelper.c (vm_base_ptr): add `vm_base_ptr(cfp). This function calculates base pointer from cfp. * vm_insnhelper.c (vm_setup_method): push `recv' value on top of value stack (before method parameters). This change is for keeping consistency with normal method dispatch. * insns.def: fix to use vm_base_ptr(). * vm.c (vm_exec): ditto. * vm_dump.c: remove `bp' related dumps. * cont.c (fiber_init): fix to check VM_DEBUG_BP_CHECK. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: iclass as klass in cfpnobu2012-08-201-1/+1
| | | | | | | | | * vm_insnhelper.c (vm_call_method): follow iclasses as klass in cfp but not included modules. [ruby-core:47241] [Bug #6891] * vm_insnhelper.c (vm_call_bmethod): pass defined_class to follow proper ancestors. [ruby-core:47241] [Bug #6891] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_trace.c, vm_core.h: simplify tracing mechanism.ko12012-08-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (1) add rb_hook_list_t data structure which includes hooks, events (flag) and `need_clean' flag. If the last flag is true, then clean the hooks list. In other words, deleted hooks are contained by `hooks'. Cleanup process should run before traversing the list. (2) Change check mechanism See EXEC_EVENT_HOOK() in vm_core.h. (3) Add `raw' hooks APIs Normal hooks are guarded from exception by rb_protect(). However, this protection is overhead for too simple functions which never cause exceptions. `raw' hooks are executed without protection and faster. Now, we only provide registration APIs. All `raw' hooks are kicked under protection (same as normal hooks). * include/ruby/ruby.h: remove internal data definition and macros. * internal.h (ruby_suppress_tracing), vm_trace.c: rename ruby_suppress_tracing() to rb_suppress_tracing() and remove unused function parameter. * parse.y: fix to use renamed rb_suppress_tracing(). * thread.c (thread_create_core): no need to set RUBY_VM_VM. * vm.c (mark_event_hooks): move definition to vm_trace.c. * vm.c (ruby_vm_event_flags): add a global variable. This global variable represents all of Threads and VM's event masks (T1#events | T2#events | ... | VM#events). You can check the possibility kick trace func or not with ruby_vm_event_flags. ruby_vm_event_flags is maintained by vm_trace.c. * cont.c (fiber_switch, rb_cont_call): restore tracing status. [Feature #4347] * test/ruby/test_continuation.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_thread_s_control_interrupt,ko12012-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | rb_thread_s_check_interrupt): added for Thread.control_intgerrupt and Thread.check_interrupt. See details on rdoc. I'll make an ticket for this feature. * test/ruby/test_thread.rb: add a test for Thread.control_intgerrupt. * thread.c (rb_threadptr_raise): make a new exception object even if argc is 0. * thread.c (rb_thread_kill): kill thread immediately if target thread is current thread. * vm_core.h (RUBY_VM_CHECK_INTS_BLOCKING): added. CHECK_INTS while/after blocking operation. * vm_core.h (RUBY_VM_CHECK_INTS): require rb_thread_t ptr. * cont.c (fiber_switch): use replaced RUBY_VM_CHECK_INTS(). * eval.c (ruby_cleanup): ditto. * insns.def: ditto. * process.c (rb_waitpid): ditto. * vm_eval.c (vm_call0): ditto. * vm_insnhelper.c (vm_call_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_threadptr_async_errinfo_*): manage async errors queue.ko12012-07-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Async events such as an exception throwed by Thread#raise, Thread#kill and thread termination (after main thread termination) will be queued to th->async_errinfo_queue. - clear: clear the queue. - enque: enque err object into queue. - deque: deque err object from queue. - active_p: return 1 if the queue should be checked. rb_thread_t#thrown_errinfo was removed. * vm_core.h: add declarations of rb_threadptr_async_errinfo_*. remove rb_thread_t#thrown_errinfo field and add rb_thread_t#async_errinfo_queue (queue body: Array), rb_thread_t#async_errinfo_queue_checked (flag), rb_thread_t#async_errinfo_mask_stack(Array, not used yet). * vm.c (rb_thread_mark): fix a mark function. * cont.c (rb_fiber_start): enque an error. * process.c (after_fork): clear async errinfo queue. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (cont_restore_0): improve docs. [Bug #6706][ruby-core:46243]ayumin2012-07-141-8/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: remove lfp (local frame pointer) and renameko12012-06-111-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dfp (dynamic frame pointer) to ep (environment pointer). This change make VM `normal' (similar to other interpreters). Before this commit: Each frame has two env pointers lfp and dfp. lfp points local environment which is method/class/toplevel frame. lfp[0] is block pointer. dfp is block local frame. dfp[0] points previous (parent) environment pointer. lfp == dfp when frame is method/class/toplevel. You can get lfp from dfp by traversing previous environment pointers. After this commit: Each frame has only `ep' to point respective enviornoment. If there is parent environment, then ep[0] points parent envioenment (as dfp). If there are no more environment, then ep[0] points block pointer (as lfp). We call such ep as `LEP' (local EP). We add some macros to get LEP and to detect LEP or not. In short, we replace dfp and lfp with ep and LEP. rb_block_t and rb_binding_t member `lfp' and `dfp' are removed and member `ep' is added. rename rb_thread_t's member `local_lfp' and `local_svar' to `root_lep' and `root_svar'. (VM_EP_PREV_EP(ep)): get previous environment pointer. This macro assume that ep is not LEP. (VM_EP_BLOCK_PTR(ep)): get block pointer. This macro assume that ep is LEP. (VM_EP_LEP_P(ep)): detect ep is LEP or not. (VM_ENVVAL_BLOCK_PTR(ptr)): make block pointer. (VM_ENVVAL_BLOCK_PTR_P(v)): detect v is block pointer. (VM_ENVVAL_PREV_EP_PTR(ptr)): make prev environment pointer. (VM_ENVVAL_PREV_EP_PTR_P(v)): detect v is prev env pointer. * vm.c: apply above changes. (VM_EP_LEP(ep)): get LEP. (VM_CF_LEP(cfp)): get LEP of cfp->ep. (VM_CF_PREV_EP(cfp)): utility function VM_EP_PREV_EP(cfp->ep). (VM_CF_BLOCK_PTR(cfp)): utility function VM_EP_BLOCK_PTR(cfp->ep). * vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, insns.def: apply above changes. * cont.c: ditto. * eval.c, eval_intern.h: ditto. * proc.c: ditto. * thread.c: ditto. * vm_dump.c: ditto. * vm_exec.h: fix function name (on vm debug mode). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* decrease fiber stack size. 1MB is too large for windows. [Bug #6344]kosaki2012-05-181-1/+1
| | | | | | [ruby-dev:45554] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c: bump up fiber machine stack size when running on 64bitkosaki2012-05-181-2/+7
| | | | | | arch. [Bug #6344] [ruby-dev:45554] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_m_transfer): fixed typo in example.ayumin2012-05-031-3/+3
| | | | | | [ruby-core:44818][Bug #6395] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_m_transfer): improve sample code in Fiber#transfernagachika2012-05-021-0/+1
| | | | | | documentation. emphasize the difference between transfer and resume. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c: Improved Fiber documentation.[ruby-core:44540][Bug #6343]ayumin2012-05-021-0/+26
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * reduce UNREACHABLE.nobu2012-04-171-9/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "controldrbrain2012-04-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reaches end of non-void function" warnings. [ruby-trunk - Bug #6066] * re.c (name_to_backref_number): ditto. * object.c (rb_Float): ditto. * io.c (io_readpartial): ditto. * io.c (io_read_nonblock): ditto. * pack.c (rb_uv_to_utf8): ditto. * proc.c (rb_method_entry_arity): ditto. * vm_method.c (rb_f_notimplement): ditto. * struct.c (rb_struct_aset_id): ditto. * class.c (rb_scan_args): ditto. * process.c (rlimit_resource_type): ditto. * process.c (rlimit_resource_value): ditto. * process.c (p_uid_switch): ditto. * process.c (p_gid_switch): ditto. * ext/digest/digest.c (rb_digest_instance_update): ditto. * ext/digest/digest.c (rb_digest_instance_finish): ditto. * ext/digest/digest.c (rb_digest_instance_reset): ditto. * ext/digest/digest.c (rb_digest_instance_block_length): ditto. * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): ditto. * ext/dl/handle.c (rb_dlhandle_close): ditto. * ext/tk/tcltklib.c (pending_exception_check0): ditto. * ext/tk/tcltklib.c (pending_exception_check1): ditto. * ext/tk/tcltklib.c (ip_cancel_eval_core): ditto. * ext/tk/tcltklib.c (lib_get_reltype_name): ditto. * ext/tk/tcltklib.c (create_dummy_encoding_for_tk_core): ditto. * ext/tk/tkutil/tkutil.c (tk_hash_kv): ditto. * ext/openssl/ossl_ssl.c (ossl_ssl_session_reused): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_key_dsa_verify_asn1): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_at_infinit): ditto. * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_on_curve): ditto. * ext/fiddle/conversions.c (generic_to_value): ditto. * ext/socket/raddrinfo.c (rsock_io_socket_addrinfo): ditto. * ext/socket/socket.c (sock_s_getnameinfo): ditto. * ext/ripper/eventids2.c (ripper_token2eventid): ditto. * cont.c (return_fiber): ditto. * dmydln.c (dln_load): ditto. * vm_insnhelper.c (vm_search_normal_superclass): ditto. * bignum.c (big_fdiv): ditto. * marshal.c (r_symlink): ditto. * marshal.c (r_symbol): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_reset_root_local_storage): add a new function tonagachika2012-02-151-0/+24
| | | | | | | | | | | | | | | | | | | | | | | restore rb_thread_t::local_storage. * cont.c (rb_obj_is_fiber): add a new function to tell finalizer to prevent fibers from destroy. * gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing objspace. * internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber): add prototypes. * vm.c (ruby_vm_destruct): reset main thread's local_storage before free main thread. rb_thread_t::local_storage is replaced by fiber's local storage when forked from fiber, and it should be already freed when the fiber was destroyed. * test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork from fiber. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (cont_restore_0): prevent optimizing out `sp'. sp is used fornaruse2012-01-121-5/+4
| | | | | | | | | | | reserving a memory space with ALLOCA_N for restoring machine stack stored in cont->machine_stack, but clang optimized out it (and maybe #5851 is also caused by this). This affected TestContinuation#test_check_localvars. * cont.c (cont_restore_1): revert workaround introduced in r32201. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big_rshift), compile.c (validate_label,nobu2011-12-051-1/+1
| | | | | | | | | | | | | | iseq_build_from_ary_exception), cont.c (cont_capture), dir.c (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open) (rb_io_advise), parse.y (parser_compile_string) (rb_parser_compile_file), proc.c (binding_free), process.c (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core) (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null), signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main), vm_insnhelper.c (vm_expandarray): suppress unused-but-set-variable warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (fiber_switch): ignore fiber context switchnaruse2011-11-201-0/+7
| | | | | | | | because destination fiber is same as current fiber. With out this, it may segv on FreeBSD 9. patched by Koichi Sasada. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (rb_fiber_m_transfer, rb_fiber_resume): prohibit usingko12011-11-091-2/+14
| | | | | | | | | | | "resume" after "transfer" method are used. You should not mix "resume" fiber and "transfer" fiber. [Bug #5526] * NEWS: add information about this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c: use "__sun" instead of "sun" to detect SunOS.akr2011-10-241-1/+1
| | | | | | | | | | | | | | * dln.c: ditto. * cont.c: ditto. * ext/sdbm/_sdbm.c: ditto. [ruby-dev:44693] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (fiber_store): balance braces.nobu2011-10-131-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (cont_mark): mark original Thread object from saved_thread.nagachika2011-10-051-0/+1
| | | | | | [ruby-dev:44567] [Bug #5386] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c (rb_thread_mark), cont.c (cont_mark): revert r33369 and r33371ktsj2011-10-021-1/+1
| | | | | | that may cause SEGV in certain environments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm.c (rb_thread_mark), cont.c (cont_mark): self pointer should notktsj2011-10-011-1/+1
| | | | | | | be marked by itself. Patch by Koichi Sasada. [ruby-dev:44567] [Bug #5386] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (fiber_entry): fix stack allocation failure on Debiankosaki2011-08-301-1/+2
| | | | | | | | | GNU/kFreeBSD. Patch by Lucas Nussbaum <lucas at lucas-nussbaum dot net>. [Bug #5241] [ruby-core:39147] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (HAVE_GETCONTEXT): see getcontext(3) because DragonFly BSDnaruse2011-08-061-1/+1
| | | | | | x64 port doesn't have it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (cont_save_thread): fix missing semicolon.takano322011-07-191-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (FIBER_MACHINE_STACK_ALLOCATION_SIZE): Fiber stack sizekosaki2011-07-081-2/+2
| | | | | | | | don't need to keep multiple number of sizeof(VALUE). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add a comment why FreeBSD can't use MAP_STACK.kosaki2011-07-071-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (FIBER_STACK_FLAGS): workaround fix for r32420 on FreeBSD.naruse2011-07-061-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (fiber_machine_stack_alloc): cleanup pointer arithmetic.kosaki2011-07-061-6/+6
| | | | | | | | | "size/sizeof(VALUE)" is ugly and easy confusing. * cont.c (fiber_initialize_machine_stack_context): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (fiber_machine_stack_alloc): fix mprotect misuse. A stackkosaki2011-07-061-3/+6
| | | | | | | | | | | guard page should have PROT_NONE. * cont.c (fiber_initialize_machine_stack_context): th->machine_stack_maxsize shouldn't be included guard pages size. [Bug #4983][ruby-dev:44043] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (fiber_machine_stack_alloc): use MAP_STACK if it's provided.kosaki2011-07-061-1/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (fiber_machine_stack_alloc): use MAP_FAILED instead of -1.kosaki2011-07-061-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (fiber_machine_stack_alloc): remove unnecessary cast.kosaki2011-07-061-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c: disable FIBER_USE_NATIVE on Solaris because resuming anymame2011-07-041-1/+1
| | | | | | | Fiber caused SEGV. I haven't follow up the issue deeply, but it works when disabling the feature. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * cont.c (cont_capture): add volatile.naruse2011-06-221-3/+4
| | | | | | | | | | | | | | On clang -O, it is needed to avoid the optimization. With this and llvm/clang's recent fix, clang 3.0 can build ruby-trunk with -O option. * cont.c (cont_capture): use for-loop. * array.c (rb_ary_each): add volatile and use it. * vm_insnhelper.c (vm_call_cfunc): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: declare internal functions here.akr2011-06-171-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * node.h: declare NODE dependent internal functions here. * iseq.h: declare rb_iseq_t dependent internal functions here. * vm_core.h: declare rb_thread_t dependent internal functions here. * bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c, enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c, iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y, proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c, thread.c, time.c, transcode.c, variable.c, vm.c, tool/compile_prelude.rb: don't declare internal functions declared in above headers. include above headers if required. Note that rb_thread_mark() was declared as void rb_thread_mark(rb_thread_t *th) in cont.c but defined as void rb_thread_mark(void *ptr) in vm.c. Now it is declared as the later in internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppress compile warnings.nobu2011-06-171-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e