summaryrefslogtreecommitdiff
path: root/eval_jump.c
AgeCommit message (Collapse)Author
2022-11-22[Bug #19016] re-order error handling at cleanupNobuyoshi Nakada
Build and store the error message with `#detailed_message` before terminating all Ractors, then show the message later. Notes: Merged: https://github.com/ruby/ruby/pull/6778
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2021-05-07Protoized old pre-ANSI K&R style declarations and definitionsNobuyoshi Nakada
2019-08-29drop-in type check for rb_define_global_function卜部昌平
We can check the function pointer passed to rb_define_global_function like we do so in rb_define_method. It turns out that almost anybody is misunderstanding the API.
2019-08-13* expand tabs.git
2019-08-13Renamed ruby_finalize_{0,1}Nobuyoshi Nakada
And pass rb_execution_context_t as an argument.
2017-12-28`$SAFE` as a process global state. [Feature #14250]ko1
* vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state. * vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc` objects don't need to keep `$SAFE` at the creation. Also make `is_from_method` and `is_lambda` as 1 bit fields. * cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation. * eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access `vm->safe_level_` directly. * eval_jump.c: End procs `END{}` doesn't keep `$SAFE`. * proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c. * safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes. * safe.c (safe_setter): use `rb_set_safe_level()`. * thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`. It should be obsolete. * transcode.c (load_transcoder_entry): `rb_safe_level()` only returns 0 or 1 so that this check is not needed. * vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc. * vm.c (rb_proc_create): renamed to `proc_create`. * vm.c (rb_proc_dup): moved from proc.c. * vm.c (vm_invoke_proc): do not need to set and restore `$SAFE` for `Proc#call`. * vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer meaning. * lib/drb/drb.rb: restore `$SAFE`. * lib/erb.rb: restore `$SAFE`, too. * test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests. * test/rubygems/test_gem.rb: do not set `$SAFE = 1`. * bootstraptest/test_proc.rb: catch up this change. * spec/ruby/optional/capi/string_spec.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. * test/fiddle/test_func.rb: ditto. * test/fiddle/test_handle.rb: ditto. * test/net/imap/test_imap_response_parser.rb: ditto. * test/pathname/test_pathname.rb: ditto. * test/readline/test_readline.rb: ditto. * test/ruby/test_file.rb: ditto. * test/ruby/test_optimization.rb: ditto. * test/ruby/test_proc.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_thread.rb: ditto. * test/rubygems/test_gem_specification.rb: ditto. * test/test_tempfile.rb: ditto. * test/test_tmpdir.rb: ditto. * test/win32ole/test_win32ole.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06remove `PUSH_TAG`/`EXEC_AG`/`POP_TAG`/`JUMO_TAG`.ko1
* eval_intern.h: remove non-`EC_` prefix *_TAG() macros. Use `EC_` prefix macros explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29* eval_jump.c (rb_exec_end_proc): use `GET_EC()`.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26introduce EC_*_TAG() instead of TH_*_TAG()ko1
* 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
2017-10-26Use rb_execution_context_t instead of rb_thread_tko1
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
2017-06-28move fields to ec.ko1
* 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
2017-06-23use "enum ruby_tag_type" and TAG_NONE.ko1
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
2016-04-22eval_jump.c: restore previous error infonobu
* eval_jump.c (exec_end_procs_chain): restore previous error info for each end procs. [ruby-core:75038] [Bug #12302] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-24eval.c: use the given threadnobu
* eval.c (setup_exception): use the given thread instead of implicit current thread. * load.c (rb_load_internal0): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-04eval_intern.h: VAR_INITIALIZEDnobu
* eval_intern.h (VAR_INITIALIZED): macro to suppress maybe-uninitialized warnings by gcc 4.7 and 4.8. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-19eval_jump.c: reuse same tagnobu
* eval_jump.c (rb_exec_end_proc): reduce number of pushing/popping and reuse same tag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-18eval_jump.c: refix [Bug #9110]nobu
* eval_jump.c (rb_exec_end_proc): unlink and free procs data before calling for each procs. [Bug #9110] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-15 * eval_jump.c (rb_exec_end_proc): fix double free or corruption errorglass
when reentering by callcc. [ruby-core:58329] [Bug #9110] * test/ruby/test_beginendblock.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-18volatile errinfonobu
* eval_jump.c (rb_exec_end_proc): need volatile to prevent from setjmp/longjmp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-12* eval_jump.c (rb_exec_end_proc): remember the latest exit status.nobu
[ruby-core:43173][Bug #5218] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07cancel subversion backfire. sorrymatz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07* gc.c (rb_gc_set_params): allow GC parameter configuration bymatz
environment variables. based on a patch from funny-falcon at https://gist.github.com/856296, but honors safe level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-26* eval_jump.c (rb_exec_end_proc): remove unused variable.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-16* eval_jump.c (rb_exec_end_proc): changed at_exit and END prockosaki
evaluation order. [Bug #4400] [ruby-core:35237] * eval_jump.c (rb_mark_end_proc): ditto. * test/ruby/test_beginendblock.rb (TestBeginEndBlock#test_nested_at_exit): added a test for nested at_exit. * test/ruby/test_beginendblock.rb (TestBeginEndBlock#test_beginendblock): changed the test to adopt new spec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-28* eval_error.c (error_print): use volatile to suppress warnings.akr
* vm_eval.c (eval_string_with_cref): ditto. * thread.c (rb_exec_recursive): ditto. * eval_jump.c (rb_exec_end_proc): ditto. * eval.c (ruby_exec_node): ditto. (rb_longjmp): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10* include/ruby/intern.h, proc.c: revert rb_proc_call() andko1
create rb_proc_call_with_block() instaed. * include/ruby/ruby.h, eval_jump.c, thread.c, vm_insnhelper.c: rb_blockptr should not be exposed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09* include/ruby/ruby.h, vm_core.h: add a type rb_blockptr.mame
* vm_insnhelper.c (vm_yield_with_cfunc): vm_yield_with_cfunc receives blockptr and passes it to iterating block. * proc.c (rb_proc_call), include/ruby/intern.h: rb_proc_call receives blockptr. "rb_proc_call(self, args, blockptr)" in C corresponds to "self.call(*args, &block)" in Ruby. * proc.c (proc_call): pass blockptr to block that is written in C. * proc.c (curry): receive blockptr and pass it to original proc. [ruby-core:15551] * vm.c (invoke_block_from_c): fix for change of vm_yield_with_cfunc. * thread.c (call_trace_proc), eval_jump.c (rb_call_end_proc): fix for change of rb_proc_call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08* array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,ko1
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c, io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c, string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c, vm.c, gc.c: allocated memory objects by xmalloc (ruby_xmalloc) should be freed by xfree (ruby_xfree). * ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c, ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c, ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c, ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c, ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-24* eval_method.c: renamed from vm_method.c. "vm_method.c" is includedko1
by "vm.c". * vm_eval.c: added. Some codes are moved from "eval.c" * common.mk: fix for above changes. * compile.c: make a vm_eval(0) * eval.c, eval_error.c, eval_intern.h, eval_jump.c, proc.c, vm.c, id.c, id.h, vm_core.h, vm_dump.c, vm_evalbody.c, vm_insnhelper.c, blockinlining.c: fix for above changes. and do some refactoring. this changes improve rb_yield() performance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-05* numeric.c (fix_to_s): avoid rb_scan_args() when no argumentmatz
given. * bignum.c (rb_big_to_s): ditto. * enum.c (enum_first): ditto. * eval_jump.c (rb_f_catch): ditto. * io.c (rb_obj_display): ditto. * class.c (rb_obj_singleton_methods): ditto. * object.c (rb_class_initialize): ditto. * random.c (rb_f_srand): ditto. * range.c (range_step): ditto. * re.c (rb_reg_s_last_match): ditto. * string.c (rb_str_to_i): ditto. * string.c (rb_str_each_line): ditto. * string.c (rb_str_chomp_bang): ditto. * string.c (rb_str_sum): ditto. * string.c (str_modifiable): declare inline. * string.c (str_independent): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03* eval_jump.c (rb_f_catch): Resotre cfp if catched thrown object.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20* common.mk, *.ci: renamed to *.c.ko1
* eval_laod.c: renamed to load.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e