aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
Commit message (Collapse)AuthorAgeFilesLines
* th->ec: rb_threadptr_setup_exceptionko12017-11-071-2/+2
| | | | | | | * eval.c (rb_threadptr_setup_exception): renamed to rb_ec_setup_exception(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval_intern.h: rename macros rb_thread_raised_* toko12017-11-071-1/+1
| | | | | | | rb_ec_raised_*. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename to rb_ec_set_raised().ko12017-11-071-2/+2
| | | | | | | | * thread.c (rb_threadptr_set_raised): rename to rb_ec_set_raised and accepts `ec` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* th->ec: rb_threadptr_reset_raised()ko12017-11-071-3/+3
| | | | | | | | | | | | | | * thread.c (rb_threadptr_reset_raised): rename to `rb_ec_reset_raised` and accepts `ec`. * vm_trace.c: the following functions accept `ec` instead of `th` * exec_hooks_body * exec_hooks_precheck * exec_hooks_unprotected * exec_hooks_protected git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move rb_thread_t::interrupt_flag and maskko12017-11-061-1/+1
| | | | | | | | | | | | | | | | to rb_execution_context_t. * vm_core.h (rb_thread_t): move `rb_thread_t::interrupt_flag` and `rb_thread_t::interrupt_mask` to rb_execution_context_t. RUBY_VM_CHECK_INTS() accepts `ec` instead of `th`. * cont.c (rb_fiber_terminate): to propagate interrupt information, add new parameter `need_interrupt`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use `GET_EC()`.ko12017-10-291-20/+18
| | | | | | | | | | | | | * eval.c (rb_block_given_p): use `GET_EC()` directly. * eval.c (rb_ensure): ditto. * eval.c (rb_errinfo): ditto. * eval.c (previous_frame): accepts `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `rb_ec_error_print()`.ko12017-10-291-1/+1
| | | | | | | | * eval_error.c (rb_threadptr_error_print): renamed to rb_ec_error_print() and it accepts `ec`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* EXEC_EVENT_HOOK(ec, ...)ko12017-10-291-6/+6
| | | | | | | * vm_core.h (EXEC_EVENT_HOOK): accepts `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `th` -> `ec` for backtrace functions.ko12017-10-281-1/+1
| | | | | | | | | | | | | * vm_backtrace.c: accept `ec` and rename `threadptr` to `ec`. * rb_threadptr_backtrace_object -> rb_ec_backtrace_object * rb_threadptr_backtrace_str_ary -> rb_ec_backtrace_str_ar * rb_threadptr_backtrace_location_ary -> rb_ec_backtrace_location_ary * threadptr_backtrace_to_ary -> ec_backtrace_to_ary * vm_eval.c (adjust_backtrace_in_eval): accepts `ec`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `th` -> `ec` for rb_longjmp() and related functions.ko12017-10-281-42/+42
| | | | | | | | | | | | | * eval.c: `th` -> `ec` for the following functions: * rb_longjmp * exc_setup_message * setup_exception * errinfo_place * eval.c (get_thread_errinfo): rename to get_ec_errinfo() and accepts `ec`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `th` -> `ec` for rb_vm_rewind_cfp.ko12017-10-281-20/+20
| | | | | | | * vm.c (rb_vm_rewind_cfp): accepts `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* replace `GET_THREAD()->ec` to `GET_EC()`.ko12017-10-261-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* introduce EC_*_TAG() instead of TH_*_TAG()ko12017-10-261-22/+22
| | | | | | | | | | | | | | | | * eval_intern.h: introduce EC_*_TAG() macros instead of TH_*_TAG() macros. * TH_PUSH_TAG() -> EC_PUSH_TAG() * TH_POP_TAG() -> EC_POP_TAG() * TH_TMPPOP_TAG() -> EC_TMPPOP_TAG() * TH_REPUSH_TAG() -> EC_REPUSH_TAG() * TH_EXEC_TAG() -> EC_EXEC_TAG() * TH_JUMP_TAG() -> EC_JUMP_TAG() rb_threadptr_tag_state() , rb_ec_tag_jump() also accept `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_pop_frame() accepts `ec` instead of `th`.ko12017-10-261-1/+1
| | | | | | | * vm_insnhelper.c (vm_pop_frame): accepts `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* some functions accept `ec` instead of `th`.ko12017-10-261-7/+7
| | | | | | | | | | | | | | | | | | | | | * vm.c (vm_make_env_object): accepts `ec`. * vm.c (rb_vm_get_ruby_level_next_cfp): ditto. * vm.c (rb_vm_make_proc): ditto. * vm.c (rb_vm_make_proc_lambda): ditto. * vm_core.h: some macros accept ec instead of th (and make them inline functions): * RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW * RUBY_VM_END_CONTROL_FRAME * RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P * eval.c (frame_func_id): constify for the first parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use rb_execution_context_t instead of rb_thread_tko12017-10-261-48/+48
| | | | | | | | | | | | | | | | | | | | | | | | | to represent execution context [Feature #14038] * vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer. There are many code using `th` to represent execution context (such as cfp, VM stack and so on). To access `ec`, they need to use `th->ec->...` (adding one indirection) so that we need to replace them by passing `ec` instead of `th`. * vm_core.h (GET_EC()): introduced to access current ec. Also remove `ruby_current_thread` global variable. * cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of rb_context_t::thread_value. * cont.c (ec_set_vm_stack): added to update vm_stack explicitly. * cont.c (ec_switch): added to switch ec explicitly. * cont.c (rb_fiber_close): added to terminate fibers explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: check typenobu2017-09-301-0/+1
| | | | | | | * eval.c (ignored_block): check argument type, which must be Module. [ruby-dev:50270] [Bug #13956] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h: ruby_error_stackfatalnobu2017-08-211-1/+1
| | | | | | | | | | * vm_core.h (ruby_special_exceptions): rename sysstack_gc as stackfatal. * eval.c (Init_eval): modified the message for stackfatal error as "critical region". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: raise ruby_error_sysstack_gcnobu2017-08-181-0/+1
| | | | | | | * vm_insnhelper.c (rb_threadptr_stack_overflow): rb_fatal is not available during GC. raise the preallocated fatal error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename rb_execution_context_t::stack(_size) to vm_stack(_size).ko12017-08-101-1/+1
| | | | | | | | | * vm_core.h: Ruby processes run with two stacks, a machine stack and a VM stack. To make it clear, this fix renames rb_execution_context_t::stack(_size) to vm_stack(_size). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: suppress warningsnobu2017-08-021-9/+16
| | | | | | | | | | | | * eval.c (exc_setup_message): setup exception message as an exception instance, and a cause from a previous exception. split from setup_exception to suppress a warning when RUBY_USE_SETJMPEX is enabled. * eval.c (setup_exception): make state volatile to suppress a warning too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: fix state typenobu2017-08-021-1/+1
| | | | | | | * eval.c (setup_exception): state is a raised thread flag, not for EXEC_TAG. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix typos [ci skip]kazu2017-07-261-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * remove trailing spaces.svn2017-07-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add Doxygen commentsyugui2017-07-221-3/+211
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove dead codeyugui2017-07-201-25/+0
| | | | | | | | * eval.c (errinfo_setter): dead for 10 years since r13091. (rb_rubylevel_errinfo): not used and not exported. usually removed or hidden by linker. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move fields to ec.ko12017-06-281-25/+25
| | | | | | | | | | * vm_core.h (rb_thread.h): move errinfo and trace_arg to rb_execution_context_t. * cont.c (fiber_switch, rb_cont_call): do not restore "trace_arg" here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move fields to ec.ko12017-06-281-3/+3
| | | | | | | | * vm_core.h (rb_thread_t): move root_lep, root_svar and ensure_list to rb_execution_context_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move several fields from rb_thread_t to rb_execution_context_t.ko12017-06-261-4/+4
| | | | | | | | * vm_core.h (rb_thread_t): move several fields which are copied at cont.c to rb_execution_context_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use "enum ruby_tag_type" and TAG_NONE.ko12017-06-231-25/+22
| | | | | | | | | | | | | | | Return value of EXEC_TAG() is saved by "int state". Instead of "int", use "enum ruby_tag_type". First EXEC_TAG() value should be 0, so that define TAG_NONE (= 0) and use it. Some code used "status" instead of "state". To make them clear, rename them to state. We can change variable name from "state" to "tag_state", but this ticket doesn't contain it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rb_execution_context_t: move stack, stack_size and cfp from rb_thread_tnormal2017-05-091-12/+12
| | | | | | | | | | The goal is to reduce rb_context_t and rb_fiber_t size by removing the need to store the entire rb_thread_t in there. [ruby-core:81045] Work-in-progress: soon, we will move more fields here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: fix exit inside TAGnobu2017-04-181-6/+4
| | | | | | | * eval.c (setup_exception): do not exit by goto inside PUSH_TAG/POP_TAG. it causes an infinite loop. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: copy before cause setupnobu2017-04-171-11/+15
| | | | | | | * eval.c (setup_exception): copy frozen exception before setting up a cause not only a backtrace. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: copy special exceptions before raisenobu2017-04-171-44/+14
| | | | | | | | | | | | * eval.c (setup_exception): consider if the exception is frozen, but not one of special exception objects. * gc.c (rb_memerror): copy minimum objects. * thread.c (rb_threadptr_execute_interrupts): prepare special exception queued by another thread to be raised. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c: backtrace functions per threadsnobu2017-04-171-2/+2
| | | | | | | | | | | | * vm_backtrace.c (rb_threadptr_backtrace_object): rename and extern. * vm_backtrace.c (rb_threadptr_backtrace_str_ary): rename as threadptr since the parameter is rb_thread_t*. * vm_backtrace.c (rb_threadptr_backtrace_location_ary): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: share rb_longjmpnobu2017-04-171-9/+5
| | | | | | | * eval.c (rb_longjmp, rb_raise_jump): parameterize thread, and share rb_longjmp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: hide internal objectsnobu2017-02-031-1/+4
| | | | | | | * eval.c (rb_ensure): veil internal exception objects not to leak in ensure functions. [ruby-core:79371] [Bug #13176] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: copy special exceptionnobu2017-01-241-3/+14
| | | | | | | * eval.c (setup_exception): make unfrozen copy of special exception before setting up a cause. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval.c: fix circular causenobu2016-12-211-0/+3
| | | | | | | * eval.c (exc_setup_cause): always set cause of cause to get rid of circular references. [ruby-core:78688] [Bug #13043] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add clang volatile fixes from FreeBSD and NetBSD.shugo2016-12-071-2/+2
| | | | | | | | Use volatile instead of optnone to avoid optimization which causes segmentation faults. Patch by Dimitry Andric. [ruby-core:78531] [Bug #13014] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c: redefined backtracenobu2016-11-131-6/+19
| | | | | | | | | | * error.c (rb_get_backtrace): honor redefined Exception#backtrace method. [ruby-core:78097] [Bug #12925] * eval.c (setup_exception): rescue exceptions during backtrace setup. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c: rb_get_backtracenobu2016-11-131-2/+2
| | | | | | | * error.c (rb_get_backtrace): move from eval_error.c to call exc_backtrace directly. [ruby-core:78097] [Bug #12925] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include and prepend check no argsnobu2016-11-061-0/+3
| | | | | | | | * eval.c (rb_mod_include, rb_mod_prepend): check if arguments are given, as well as Kernel#extend. [ruby-dev:49854] [Bug #12887] [Fix GH-1470] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_trace.c (tracepoint_attr_callee_id, rb_tracearg_callee_id):ktsj2016-11-051-2/+2
| | | | | | | | | | | add TracePoint#callee_id. [ruby-core:77241] [Feature #12747] * cont.c, eval.c, gc.c, include/ruby/intern.h, insns.def, thread.c, vm.c, vm_backtrace.c, vm_core.h, vm_eval.c, vm_insnhelper.c, vm_trace.c: ditto. * test/ruby/test_settracefunc.rb: tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c, method.h, proc.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c:ktsj2016-11-051-1/+1
| | | | | | | | | TracePoint#method_id should return method_id, not callee_id. [ruby-core:77241] [Feature #12747] * test/ruby/test_settracefunc.rb: change accordingly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_mod_refine): refine modules as well.shugo2016-09-231-5/+15
| | | | | | [ruby-core:76199] [Feature #12534] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c: set cause by Thread#raisenobu2016-09-091-0/+11
| | | | | | | | * thread.c (rb_threadptr_raise): set cause from the called thread, but not from the thread to be interrupted. [ruby-core:77222] [Bug #12741] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_mod_s_used_modules): rename Module.used_refinements toshugo2016-09-081-9/+9
| | | | | | Module.used_modules. [Feature #7418] [ruby-core:49805] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_mod_s_used_refinements): new methodshugo2016-09-071-0/+55
| | | | | | | Module.used_refinements. based on the patch by Charlie Somerville. [Feature #7418] [ruby-core:49805] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: introduce VM_FRAME_RUBYFRAME_P()ko12016-08-031-1/+1
| | | | | | | | | | | | | | and VM_FRAME_CFRAME_P(). Most of case, RUBY_VM_NORMAL_ISEQ_P() is no longer needed. * vm_core.h: introduce rb_obj_is_iseq(). * cont.c, vm.c: VM_FRAME_MAGIC_DUMMY with VM_FRAME_FLAG_CFRAME. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e