aboutsummaryrefslogtreecommitdiffstats
path: root/cont.c
Commit message (Collapse)AuthorAgeFilesLines
* ia64: Don't clear register_stack_startJames Clarke2019-04-271-1/+0
| | | | | | | | r59829 stopped clearing stack_start and enabled the code for !FIBER_USE_NATIVE, but we need to do the same for register_stack_start on ia64, otherwise we end up with NULL in cont_save_machine_stack. Closes: https://github.com/ruby/ruby/pull/2155
* [DOC] fix markups [ci skip]nobu2019-03-221-25/+24
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix styles [ci skip]nobu2019-01-091-2/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix #endif annotation.samuel2018-12-281-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Don't allow rb_fiber_resume to raise exception on unborn fiber.samuel2018-12-281-0/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Implement Fiber#raise. Fixes #10344.samuel2018-12-281-0/+29
| | | | | | | This allows raising exceptions in another fiber, similarly to Thread#raise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Avoid GCing dead stack after switching away from a fibersamuel2018-12-011-0/+1
| | | | | | | Fixes <https://bugs.ruby-lang.org/issues/14561> and discussed <https://bugs.ruby-lang.org/issues/15362>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Give up support for cross-callcc set_trace_func.ko12018-11-261-1/+4
| | | | | | | * cont.c (cont_restore_thread): cause error if trace-status is changed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Support targetting TracePoint [Feature #15289]ko12018-11-261-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * vm_trace.c (rb_tracepoint_enable_for_target): support targetting TracePoint. [Feature #15289] Tragetting TracePoint is only enabled on specified method, proc and so on, example: `tp.enable(target: code)`. `code` should be consisted of InstructionSeuqnece (iseq) (RubyVM::InstructionSeuqnece.of(code) should not return nil) If code is a tree of iseq, TracePoint is enabled on all of iseqs in a tree. Enabled tragetting TracePoints can not enabled again with and without target. * vm_core.h (rb_iseq_t): introduce `rb_iseq_t::local_hooks` to store local hooks. `rb_iseq_t::aux::trace_events` is renamed to `global_trace_events` to contrast with `local_hooks`. * vm_core.h (rb_hook_list_t): add `rb_hook_list_t::running` to represent how many Threads/Fibers are used this list. If this field is 0, nobody using this hooks and we can delete it. This is why we can remove code from cont.c. * vm_core.h (rb_vm_t): because of above change, we can eliminate `rb_vm_t::trace_running` field. Also renamed from `rb_vm_t::event_hooks` to `global_hooks`. * vm_core.h, vm.c (ruby_vm_event_enabled_global_flags): renamed from `ruby_vm_event_enabled_flags. * vm_core.h, vm.c (ruby_vm_event_local_num): added to count enabled targetting TracePoints. * vm_core.h, vm_trace.c (rb_exec_event_hooks): accepts hook list. * vm_core.h (rb_vm_global_hooks): added for convinience. * method.h (rb_method_bmethod_t): added to maintain Proc and `rb_hook_list_t` for bmethod (defined by define_method). * prelude.rb (TracePoint#enable): extracet a keyword parameter (because it is easy than writing in C). It calls `TracePoint#__enable` internal method written in C. * vm_insnhelper.c (vm_trace): check also iseq->local_hooks. * vm.c (invoke_bmethod): check def->body.bmethod.hooks. * vm.c (hook_before_rewind): check iseq->local_hooks and def->body.bmethod.hooks before rewind by exception. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use VirtualAlloc/VirtualProtect/VirtualFree for windows stack allocation.samuel2018-11-221-53/+63
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix conditionnobu2018-11-201-2/+2
| | | | | | | FIBER_USE_NATIVE is always defined as 0 or 1, use `#if` instead of `#ifdef`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Make fiber_entry staticnobu2018-11-201-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix windows builds.samuel2018-11-201-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Expose stack functions to coroutine and non-windows implementations.samuel2018-11-201-12/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix exposure of stack allocations.samuel2018-11-201-2/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use malloc/free for windows stack allocation.samuel2018-11-201-11/+20
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove trailing whitespace.samuel2018-11-201-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Restore native non-coroutine code path.samuel2018-11-201-2/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* It cannot be const because it is being passed to destructive operation ↵samuel2018-11-201-1/+1
| | | | | | (destroy). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Better support for amd64 platformssamuel2018-11-201-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Native implementation of coroutines to improve performance of fiberssamuel2018-11-201-16/+63
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Prefix rb_ec_set_vm_stacknobu2018-11-161-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* suppress integer overflow warningsshyouhei2018-11-131-6/+6
| | | | | | | | | | | | | * random.c: annotate rb_hash_start with NO_SANITIZE (seed.key.hash + h overflows and that seems intentional) * bignum.c: avoid (size_t)-- * cont.c: ditto * util.c: ditto * vm_insnhelper.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: direct use of rb_thread_tshyouhei2018-11-061-3/+1
| | | | | | | | | | | The only usage of rb_fiber_reset_root_local_storage() is from ruby_vm_destruct(), where the object space is already terminated. This `th->self` is not alive. Why not just use `th` itself. See also: https://travis-ci.org/ruby/ruby/jobs/451294954 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiber: fix crash on GC after forkingnormal2018-09-121-16/+13
| | | | | | | | | | | | | | | | | | Remove the remainder of ROOT_FIBER_CONTEXT use and unnecessary differences between the root and non-root fiber. This makes it easier to follow new root fiber at fork time. Multiple sources of truth often leads to bugs, as in this case. We can determinte root fiber by checking a fiber against the root_fiber of its owner thread. The new `fiber_is_root_p' function supports that. Now, we can care only about free-ing/recycling/munmap-ing stacks as appropriate. [Bug #15050] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c (fiber_memsize): do not rely on ROOT_FIBER_CONTEXTnormal2018-09-121-5/+8
| | | | | | | | | | | | | | We can check if the fiber we're interested in is the th->root_fiber for the owner thread, so there is no need to use ROOT_FIBER_CONTEXT. Note: there is no guarantee th->ec points to &th->root_fiber->cont.saved_ec, thus vm::thread_memsize may not account for root fiber correctly (pre-existing bug). [Bug #15050] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c (ec_set_vm_stack): avoid needless castingnormal2018-09-121-2/+2
| | | | | | | | | Am I missing something, here? Casting was totally unnecessary and ugly... [ruby-core:88929] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* share VM stack between threads and fibers if identical in sizenormal2018-09-121-10/+20
| | | | | | | | | | | | | ec->vm_stack is always allocated with malloc, so stack cache for root fiber (thread stack) and non-root fibers can be shared as long as the size is the same. The purpose of this change is to reduce dependencies on ROOT_FIBER_CONTEXT. [Feature #15095] [Bug #15050] v2: vm.c: fix build with USE_THREAD_DATA_RECYCLE==0 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c (rb_fiber_atfork): th->root_fiber may not existnormal2018-08-301-4/+6
| | | | | | | | | | Otherwise, bootstraptest/test_fork.rb fails with -DVM_CHECK_MODE=2 [Bug #15041] Fixes: r64589 "cont.c: set th->root_fiber to current fiber at fork" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: set th->root_fiber to current fiber at forknormal2018-08-291-0/+12
| | | | | | | | | | Otherwise, th->root_fiber can point to an invalid Fiber, because Fibers do not live across fork. So consider whatever Fiber is running the root fiber. [ruby-core:88723] [Bug #15041] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c (rb_context_t): remove ensure_listnormal2018-08-291-1/+0
| | | | | | It is unused (we use rb_execution_context_t.ensure_list instead) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Avoid compiler depend errorkazu2018-08-221-1/+1
| | | | | | ref r64492 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: fix syntax errornobu2018-08-211-1/+1
| | | | | | | * cont.c (struct rb_fiber_struct): fix wrong usage of BITFIELD in r64487, which caused syntax error on pre-C99 compilers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: replace "GetFooPtr" macros with "foo_ptr" functionsnormal2018-08-211-20/+25
| | | | | | | Following ko1's lead in r59192, this gets rid of non-obvious assignments which happen inside macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c (struct rb_fiber_struct): bitfields for trasnferred and statusnormal2018-08-201-2/+2
| | | | | | | On 32-bit x86, this reduces the struct from 836 to 832 bytes and brings us down to 13 (64-byte) cachelines (from 14). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* reduce copy & pasteshyouhei2018-07-301-5/+3
| | | | | | | | | | | We see several occurrence of "diagnostic push/pop" so why not make them macros. Tested on GCC8 / Clang 6. Note that ruby.h is intentionally left untouched because we don't want to introduce new public macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c (ec_switch): prevent delayed/missed trap interrupt racenormal2018-07-261-0/+10
| | | | | | | | | | | | | | | | | | | | | timer-thread may set trap interrupt with rb_threadptr_check_signal at any time independent of GVL. This means timer-thread may set the trap interrupt flag on the previous execution context; causing the flag to be unnoticed until a future ec switch (or lost completely if the ec is done). Note: I avoid relying on th->interrupt_lock here and use atomics because we won't be able to rely on it for proposed lazy timer-thread [Misc #14937]. This regression affects Ruby 2.5 as it was introduced by moving interrupt_flag to `ec' which is an unstable pointer. Ruby <= 2.4 was unaffected because vm->main_thread->interrupt_flag never changed. [ruby-core:88119] [Bug #14939] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* adjust indent [ci skip]nobu2018-07-031-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: handle errors for getcontext()nobu2018-07-031-3/+12
| | | | | | | | | | | | | | | It may raise an error in a certain security configuration. It is very likely to trigger a segmentation fault if `getcontext()` failed silently and we just let it keep going. Related to https://bugs.ruby-lang.org/issues/14883 [Fix GH-1903] Based on the patch from Lion Yang <lion@aosc.io> From: Lion Yang <lion@aosc.io> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: unify the variable name with method namek0kubun2018-06-231-2/+2
| | | | | | | | | | | | `RubyVM::MJIT.enabled?`. It's set to be TRUE even before initialization is finished. So it was actually not "mjit initialized predicate". This flag is also used to check whether JIT-ed code should be called or not, but I'm going to split the responsibility to another flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix type mismatch.ko12018-05-081-1/+1
| | | | | | | * cont.c (fiber_context_create): `func` should accept variable args. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: host out context setupnobu2018-05-081-6/+13
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: wrapper functionnobu2018-05-071-1/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: refined error messagenobu2018-05-071-2/+4
| | | | | | | * cont.c (fiber_machine_stack_alloc): refined the error message on failure at setting a guard page. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: machine stack cache conditionnobu2018-05-071-5/+5
| | | | | | | | * cont.c (fiber_store, rb_fiber_terminate): separate the condition to cache machine stacks, which is not directly restricted to the platforms, and may be used on Windows too in the future. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* cont.c: cleanup needless castnormal2018-05-011-3/+3
| | | | | | | | | | | | | | It seems like leftover development step from r59557 ("refactoring Fiber status"). I will make fiber_status use BITFIELD macro in a future commit. * cont.c (struct rb_fiber_struct): drop const from fiber_status (fiber_status_set): remove cast [ruby-core:86788] [Misc #14720] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* refactoring r63073.ko12018-04-041-30/+11
| | | | | | | | | | | | | | * cont.c (root_fiber_alloc): call `ConvertThreadToFiber()` here. `rb_fiber_t` for root_fiber is allocated before running Threads. Fiber objects wrapping this rb_fiber_t for root_fiber are created when root Fiber object is required explicitly (for example, Fiber switching and so on). We can put calling `ConvertThreadToFiber()`. In other words, we can pending `ConvertThreadToFiber()` until Fiber objects are created. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix Fiber with Thread issue on Windows [Bug #14642]ko12018-04-031-3/+25
| | | | | | | | | | | | | | | | | | | | | | | | * cont.c (rb_threadptr_root_fiber_setup): divide into two functions: * rb_threadptr_root_fiber_setup_by_parent(): called by the parent thread. * rb_threadptr_root_fiber_setup_by_child(): called by the created thread. `rb_threadptr_root_fiber_setup()` is called by the parent thread and set fib->fib_handle by ConvertThreadToFiber() on the parent thread on Windows enveironment. This means that root_fib->fib_handle of child thread is initialized with parent thread's Fiber handle. Furthermore, second call of `ConvertThreadToFiber()` for the same thread fails. This patch solves this weird situateion. However, maybe we can make more clean code. * thread.c (thread_start_func_2): call `rb_threadptr_root_fiber_setup_by_child()` at thread initialize routine. * vm.c (th_init): call `rb_threadptr_root_fiber_setup_by_parent()`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: merge MJIT infrastructurek0kubun2018-02-041-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that allows to JIT-compile Ruby methods by generating C code and using C compiler. See the first comment of mjit.c to know what this file does. mjit.c is authored by Vladimir Makarov <vmakarov@redhat.com>. After he invented great method JIT infrastructure for MRI as MJIT, Lars Kanis <lars@greiz-reinsdorf.de> sent the patch to support MinGW in MJIT. In addition to merging it, I ported pthread to Windows native threads. Now this MJIT infrastructure can be compiled on Visual Studio. This commit simplifies mjit.c to decrease code at initial merge. For example, this commit does not provide multiple JIT threads support. We can resurrect them later if we really want them, but I wanted to minimize diff to make it easier to review this patch. `/tmp/_mjitXXX` file is renamed to `/tmp/_ruby_mjitXXX` because non-Ruby developers may not know the name "mjit" and the file name should make sure it's from Ruby and not from some harmful programs. TODO: it may be better to store this to some temporary directory which Ruby is already using by Tempfile, if it's not bad for performance. mjit.h: New. It has `mjit_exec` interface similar to `vm_exec`, which is for triggering MJIT. This drops interface for AOT compared to the original MJIT. Makefile.in: define macros to let MJIT know the path of MJIT header. Probably we can refactor this to reduce the number of macros (TODO). win32/Makefile.sub: ditto. common.mk: compile mjit.o and mjit_compile.o. Unlike original MJIT, this commit separates MJIT infrastructure and JIT compiler code as independent object files. As initial patch is NOT going to have ultra-fast JIT compiler, it's likely to replace JIT compiler, e.g. original MJIT's compiler or some future JIT impelementations which are not public now. inits.c: define MJIT module. This is added because `MJIT.enabled?` was necessary for testing. test/lib/zombie_hunter.rb: skip if `MJIT.enabled?`. Obviously this wouldn't work with current code when JIT is enabled. test/ruby/test_io.rb: skip this too. This would make no sense with MJIT. ruby.c: define MJIT CLI options. As major difference from original MJIT, "-j:l"/"--jit:llvm" are renamed to "--jit-cc" because I want to support not only gcc/clang but also cl.exe (Visual Studio) in the future. But it takes only "--jit-cc=gcc", "--jit-cc=clang" for now. And only long "--jit" options are allowed since some Ruby committers preferred it at Ruby developers Meeting on January, and some of options are renamed. This file also triggers to initialize MJIT thread and variables. eval.c: finalize MJIT worker thread and variables. test/ruby/test_rubyoptions.rb: fix number of CLI options for --jit. thread_pthread.c: change for pthread abstraction in MJIT. Prefix rb_ for functions which are used by other files. thread_win32.c: ditto, for Windows. Those pthread porting is one of major works that YARV-MJIT created, which is my fork of MJIT, in Feature 14235. thread.c: follow rb_ prefix changes vm.c: trigger MJIT call on VM invocation. Also trigger `mjit_mark` to avoid SEGV by race between JIT and GC of ISeq. The improvement was provided by wanabe <s.wanabe@gmail.com>. In JIT compiler I created and am going to add in my next commit, I found that having `mjit_exec` after `vm_loop_start:` is harmful because the JIT-ed function doesn't proceed other ISeqs on RESTORE_REGS of leave insn. Executing non-FINISH frame is unexpected for my JIT compiler and `exception_handler` triggers executions of such ISeqs. So `mjit_exec` here should be executed only when it directly comes from `vm_exec` call. `RubyVM::MJIT` module and `.enabled?` method is added so that we can skip some tests which don't expect JIT threads or compiler file descriptors. vm_insnhelper.h: trigger MJIT on method calls during VM execution. vm_core.h: add fields required for mjit.c. `bp` must be `cfp[6]` because rb_control_frame_struct is likely to be casted to another struct. The last position is the safest place to add the new field. vm_insnhelper.c: save initial value of cfp->ep as cfp->bp. This is an optimization which are done in both MJIT and YARV-MJIT. So this change is added in this commit. Calculating bp from ep is a little heavy work, so bp is kind of cache for it. iseq.c: notify ISeq GC to MJIT. We should know which iseq in MJIT queue is GCed to avoid SEGV. TODO: unload some GCed units in some safe way. gc.c: add hooks so that MJIT can wait GC, and vice versa. Simultaneous JIT and GC executions may cause SEGV and so we should synchronize them. cont.c: save continuation information in MJIT worker. As MJIT shouldn't unload JIT-ed code which is being used, MJIT wants to know full list of saved execution contexts for continuation and detect ISeqs in use. mjit_compile.c: added empty JIT compiler so that you can reuse this commit to build your own JIT compiler. This commit tries to compile ISeqs but all of them are considered as not supported in this commit. So you can't use JIT compiler in this commit yet while we added --jit option now. Patch author: Vladimir Makarov <vmakarov@redhat.com>. Contributors: Takashi Kokubun <takashikkbn@gmail.com>. wanabe <s.wanabe@gmail.com>. Lars Kanis <lars@greiz-reinsdorf.de>. Part of Feature 12589 and 14235. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ia64: update ia64-specific code to use execution contexthsbt2018-01-301-3/+3
| | | | | | | | | | | | | | | | | | | | This change follows commit 837fd5e494731d7d44786f29e7d6e8c27029806f in '#ifdef __ia64' branches. Noticed as a build failure by John Paul Adrian Glaubitz: ``` cont.c:502:50: error: 'rb_thread_t {aka struct rb_thread_struct}' has no member named 'machine' size = cont->machine.register_stack_size = th->machine.register_stack_end - th->machine.register_stack_start; ^~ ``` The change is trivial: update 'th->machine' usage to 'th->ec->machine'. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e