summaryrefslogtreecommitdiff
path: root/cont.c
AgeCommit message (Collapse)Author
2012-06-11* vm_core.h: remove lfp (local frame pointer) and renameko1
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
2012-05-18decrease fiber stack size. 1MB is too large for windows. [Bug #6344]kosaki
[ruby-dev:45554] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-18* cont.c: bump up fiber machine stack size when running on 64bitkosaki
arch. [Bug #6344] [ruby-dev:45554] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-03* cont.c (rb_fiber_m_transfer): fixed typo in example.ayumin
[ruby-core:44818][Bug #6395] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-02* cont.c (rb_fiber_m_transfer): improve sample code in Fiber#transfernagachika
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
2012-05-02* cont.c: Improved Fiber documentation.[ruby-core:44540][Bug #6343]ayumin
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-17* reduce UNREACHABLE.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13* encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "controldrbrain
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
2012-02-15* cont.c (rb_fiber_reset_root_local_storage): add a new function tonagachika
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
2012-01-12* cont.c (cont_restore_0): prevent optimizing out `sp'. sp is used fornaruse
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
2011-12-05* bignum.c (big_rshift), compile.c (validate_label,nobu
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
2011-11-20* cont.c (fiber_switch): ignore fiber context switchnaruse
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
2011-11-09* cont.c (rb_fiber_m_transfer, rb_fiber_resume): prohibit usingko1
"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
2011-10-24* io.c: use "__sun" instead of "sun" to detect SunOS.akr
* 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
2011-10-13* cont.c (fiber_store): balance braces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-05* cont.c (cont_mark): mark original Thread object from saved_thread.nagachika
[ruby-dev:44567] [Bug #5386] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-02* vm.c (rb_thread_mark), cont.c (cont_mark): revert r33369 and r33371ktsj
that may cause SEGV in certain environments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-01* vm.c (rb_thread_mark), cont.c (cont_mark): self pointer should notktsj
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
2011-08-30* cont.c (fiber_entry): fix stack allocation failure on Debiankosaki
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
2011-08-06* cont.c (HAVE_GETCONTEXT): see getcontext(3) because DragonFly BSDnaruse
x64 port doesn't have it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-19* cont.c (cont_save_thread): fix missing semicolon.takano32
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-08* cont.c (FIBER_MACHINE_STACK_ALLOCATION_SIZE): Fiber stack sizekosaki
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
2011-07-07add a comment why FreeBSD can't use MAP_STACK.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-06* cont.c (FIBER_STACK_FLAGS): workaround fix for r32420 on FreeBSD.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-06* cont.c (fiber_machine_stack_alloc): cleanup pointer arithmetic.kosaki
"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
2011-07-06* cont.c (fiber_machine_stack_alloc): fix mprotect misuse. A stackkosaki
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
2011-07-06* cont.c (fiber_machine_stack_alloc): use MAP_STACK if it's provided.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-06* cont.c (fiber_machine_stack_alloc): use MAP_FAILED instead of -1.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-06* cont.c (fiber_machine_stack_alloc): remove unnecessary cast.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-04* cont.c: disable FIBER_USE_NATIVE on Solaris because resuming anymame
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
2011-06-22* cont.c (cont_capture): add volatile.naruse
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
2011-06-17* internal.h: declare internal functions here.akr
* 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
2011-06-17* suppress compile warnings.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-16* fix for build on solaris 10.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-14* cont.c (cont_save_thread): add new utility function.nagachika
rb_context_t::saved_thread.machine_stack_start and machine_stack_end should be cleared immediately after a snapshot of current thread is stored to saved_thread. this change aims to get rid of unnecessary GC mark at machine stack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-08* cont.c (root_fiber_alloc): set root fiber's status RUNNING.nagachika
in cont_mark() only RUNNING fiber's machine stack is marked. root fiber's status should be RUNNING at the beginning regardless of FIBER_USE_NATIVE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-06* cont.c: use #if FIBER_USE_NATIVE instead of #ifdef.nagachika
you can suppress use of setcontext for Fiber with compile option -DFIBER_USE_NATIVE=0 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 * cont.c (cont_init): clear macihne_stack_start/end of saved thread tonagachika
prevent mark machine stack of GC'ed Thread. root Fiber is not initialized by fiber_init(). based on a patch by Serge Balyuk [ruby-core:35891] fixes #4612 * test/ruby/test_fiber.rb (test_gc_root_fiber): add test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-06* cont.c: parenthesize macro arguments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-03* cont.c (fiber_t_alloc): raise an error when fiber is going to bemame
initialized twice. [ruby-dev:42524] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-03* cont.c (rb_fiber_resume): raise an "double resume" error when rootmame
fiber is going to be resumed. [ruby-dev:42523] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-27* cont.c: apply documentation patch by Run Paint Run Run.naruse
[ruby-core:32915] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12* cont.c (fiber_setcontext): missing variable definition.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-03* cont.c (fiber_memsize): Return size.naruse
Before this change, fiber_memsize always returns 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-28* cont.c: typos.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-28* cont.c: (RB_PAGE_SIZE): renamed from PAGE_SIZE. [ruby-dev:41870]naruse
* cont.c: (RB_PAGE_MASK): renamed from PAGE_MASK. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-27* class.c, compile.c, dir.c, file.c, iseq.c, parse.y, random.c:naruse
clean unused-value warnings. * cont.c, process.c, vm_exec.h: clean cast warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-21* configure.in (XCFLAGS): use -fvisibility=hidden if possible.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18* include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]nobu
add parent member. * error.c (rb_typeddata_inherited_p): new function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-21 * cont.c (fiber_setcontext): Use swapcontext() instead longjmp().kosaki
[ruby-dev:41316] [Bug #3295] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e