summaryrefslogtreecommitdiff
path: root/eval.c
AgeCommit message (Collapse)Author
2014-06-19* vm.c (rb_vm_rewind_cfp): add new function to rewind specified cfpko1
with invoking RUBY_EVENT_C_RETURN. [Bug #9961] * vm_core.h: ditto. * eval.c (rb_protect): use it. * eval.c (rb_rescue2): ditto. * vm_eval.c (rb_iterate): ditto. * test/ruby/test_settracefunc.rb: add a test. * vm_core.h (rb_name_err_mesg_new): git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18constify parametersnobu
* include/ruby/intern.h: constify `argv` parameters. * include/ruby/ruby.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-17eval.c: pass unknown optionsnobu
* eval.c (extract_raise_opts): pass unknown options to the exception, so that exception class can receive a hash argument. [ruby-core:63203] [Feature #8257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02* eval.c (rb_using_refinement): add write-barriers forko1
cref->nd_refinements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06eval.c: method namenobu
* eval.c (setup_exception): add the method name to system stack error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-04vm.c: Init_vm_objectsnobu
* vm.c (Init_vm_objects): initialize VM internal objects, after heap initialized. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-20* include/ruby/intern.h (rb_obj_call_init, rb_class_new_instance):ko1
constify a parameter (VALUE *). I believe this incompatibility doesn't break any code. However, if you have trouble, please tell us. * eval.c, object.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-09* eval.c: remove needless space.hsbt
[ruby-dev:48026] [Bug #9615] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-26eval.c: suppress a warningnobu
* eval.c (setup_exception): suppress a "clobbered" warning by gcc 4.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-26eval.c: preserve encodingnobu
* eval.c (setup_exception): preserve exception class name encoding in debug mode messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-26eval.c: preserve errinfonobu
* eval.c (setup_exception): preserve errinfo across calling #to_s method on the exception. [ruby-core:61091] [Bug #9568] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-26eval.c: remove unneeded GC guardnobu
* eval.c (setup_exception): remove RB_GC_GUARD which is no longer needed since r41598. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-17eval.c: singleton class constantsnobu
* eval.c (rb_mod_s_constants): return its own constants for other than Module itself. [ruby-core:59763] [Bug #9413] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-09* vm.c (rb_vm_pop_cfunc_frame): added. It cares c_return event.ko1
The patch base by drkaes (Stefan Kaes). [Bug #9321] * variable.c (rb_mod_const_missing): use rb_vm_pop_cfunc_frame() instead of rb_frame_pop(). * vm_eval.c (raise_method_missing): ditto. * vm_eval.c (rb_iterate): ditto. * internal.h (rb_vm_pop_cfunc_frame): add decl. * test/ruby/test_settracefunc.rb: add tests. provided by drkaes (Stefan Kaes). * vm.c, eval.c, include/ruby/intern.h (rb_frame_pop): move definition of rb_frame_pop() and deprecate it. It doesn't care about `return' events. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-01eval.c: extra modifiernobu
* eval.c (rb_longjmp): remove an extra modifier from the forward declaration to match the actual definition. [ruby-core:59451] [Bug #9338] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-31eval.c: raise with causenobu
* eval.c (rb_f_raise): add cause: optional keyword argument. [ruby-core:58610] [Feature #8257] [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-24eval.c: unused declarationnobu
* eval.c (rb_vm_get_cref): remove unused declaration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13eval.c: reuse tagnobu
* eval.c (rb_rescue2): reuse tags pushed for body proc to protect rescue proc too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13* error.c: add Exception#backtrace_locations.ko1
Now, there are no setter and independent from Exception#backtrace. [Feature #8960] * eval.c (setup_exception): set backtrace locations for `bt_location' special attribute. * vm_backtrace.c (rb_backtrace_to_location_ary): added. * internal.h: ditto. * test/ruby/test_backtrace.rb: add a test for Exception#backtrace_locations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13eval.c: clear cachenobu
* eval.c (rb_using_module): clear method cache after applying refinements. * eval.c (mod_using, top_using): remove redundant type checks. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13eval.c: indentnobu
* eval.c (using_module_recursive): adjust indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-11* eval.c (rb_raise_jump): call c_return hook immediately afterko1
popping `raise' frame. Patches by deivid (David Rodriguez). [Bug #8886] * test/ruby/test_settracefunc.rb: catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-11revert r44133. See https://bugs.ruby-lang.org/issues/8886 detailsko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-11* eval.c (rb_raise_jump): pop frame after setup exception.ko1
Patches by deivid (David Rodriguez). [Bug #8886] * test/minitest/test_minitest_unit.rb: catch up this change. * test/ruby/test_backtrace.rb: ditto. * test/ruby/test_settracefunc.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-03* include/ruby/ruby.h (struct RClass): Add wrapper struct aroundtmm1
RClass->m_tbl with serial. This prevents double marking method tables, since many classes/modules can share the same method table. This improves minor mark time in a large application by 30%. * internal.h (struct method_table_wrapper): Define new wrapper struct with additional serial. * internal.h (RCLASS_M_TBL_INIT): New macro for initializing method table wrapper and st_table. * method.h (void rb_sweep_method_entry): Rename rb_free_m_table to rb_free_m_tbl for consistentcy * .gdbinit (define rb_method_entry): Update rb_method_entry gdb helper for new method table structure. * class.c: Use RCLASS_M_TBL_WRAPPER and RCLASS_M_TBL_INIT macros. * class.c (rb_include_class_new): Share WRAPPER between module and iclass, so serial can prevent double marking. * eval.c (rb_prepend_module): ditto. * eval.c (rb_using_refinement): ditto. * gc.c: Mark and free new wrapper struct. * gc.c (obj_memsize_of): Count size of additional wrapper struct. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-30eval.c: determine exit status and signal before finalizationnobu
* eval.c (ruby_cleanup): determine exit status and signal to terminate before finalization, to get rid of access destroyed T_DATA execption object. [ruby-core:58643] [Bug #9167] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-15 * cont.c : Introdule ensure rollback mechanism. Please see below.tarui
* internal.h (ruby_register_rollback_func_for_ensure): catch up above change. Add rollback mechanism API. * vm_core.h (typedef struct rb_vm_struct): catch up above change. Introdule ensure-rollback relation table. * vm_core.h (typedef struct rb_thread_struct): catch up above change. Introdule ensure stack. * eval.c (rb_ensure): catch up above change. Introdule ensure stack. * hash.c : New function for rollback ensure, and register it to ensure-rollback relation table. [ruby-dev:47803] [Bug #9105] Ensure Rollback Mechanism: A rollback's function is a function to rollback a state before ensure's function execution. When the jump of callcc is across the scope of rb_ensure, ensure's functions and rollback's functions are executed appropriately for keeping consistency. Current API is unstable, and only internal use. ruby_register_rollback_func_for_ensure(ensure_func,rollback_func) This API create relation ensure's function to rollback's function. By registered rollback's function, it is executed When jumpping into corresponding rb_ensure scope. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-15eval.c: refactor exception causenobu
* eval.c (setup_exception): set up cause after exception to be raised is fixed. [Feature #8257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-10error.c: Exception#causenobu
* error.c (exc_cause): captured previous exception. * eval.c (make_exception): capture previous exception automagically. [Feature #8257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-05eval.c: suppress warningnobu
* eval.c (rb_protect): get rid of false clobbered warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29* insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: splitcharliesome
ruby_vm_global_state_version into two separate counters - one for the global method state and one for the global constant state. This means changes to constants do not affect method caches, and changes to methods do not affect constant caches. In particular, this means inclusions of modules containing constants no longer globally invalidate the method cache. * class.c, eval.c, include/ruby/intern.h, insns.def, vm.c, vm_method.c: rename rb_clear_cache_by_class to rb_clear_method_cache_by_class * class.c, include/ruby/intern.h, variable.c, vm_method.c: add rb_clear_constant_cache * compile.c, vm_core.h, vm_insnhelper.c: rename vmstat field in rb_call_info_struct to method_state * vm_method.c: rename vmstat field in struct cache_entry to method_state git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-09eval.c, vm_insnhelper.c: adjust stylenobu
* eval.c (rb_refinement_module_get_refined_class): adjust style. * vm_insnhelper.c (vm_profile_show_result): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04* class.c, compile.c, eval.c, gc.h, insns.def, internal.h, method.h,charliesome
variable.c, vm.c, vm_core.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Implement class hierarchy method cache invalidation. [ruby-core:55053] [Feature #8426] [GH-387] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-03* eval.c (Init_eval): Make Module#include and Module#prepend publica_matsuda
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-31* eval.c (rb_mod_refine, mod_using, top_using): don't showshugo
warnings because Refinements are no longer experimental. [ruby-core:55993] [Feature #8632] * test/ruby/test_refinement.rb: related test. * NEWS: fixes for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-01* eval.c (rb_using_module): activate refinements in the ancestors ofshugo
the argument module to support refinement inheritance by Module#include. [ruby-core:55671] [Feature #8571] * test/ruby/test_refinement.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-24* eval_error.c (warn_printf): use rb_vsprintf instead so ruby specificcharliesome
extensions like PRIsVALUE can be used in format strings * eval_error.c (error_print): use warn_print_str (alias for rb_write_error_str) to print a string value instead of using RSTRING_PTR and RSTRING_LEN manually * eval.c (setup_exception): use PRIsVALUE instead of %s and RSTRING_PTR git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22* include/ruby/ruby.h, gc.c: rename macros and functions:ko1
OBJ_WB_GIVEUP() -> OBJ_WB_UNPROTECT(), rb_obj_wb_giveup() -> rb_obj_wb_unprotect(), rb_gc_giveup_promoted_writebarrier() -> rb_gc_writebarrier_unprotect_promoted(), * class.c, eval.c, hash.c: use OBJ_WB_UNPROTECT(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22* class.c (rb_include_class_new), eval.c (rb_using_refinement):ko1
make classes/modules (who share method table) shady. If module `a' and `b' shares method table m_tbl and new method with iseq is added, then write barrier is applied only `a' or `b'. To avoid this issue, shade such classes/modules. * vm_method.c (rb_method_entry_make): add write barriers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-13eval.c: use local variablenobu
* eval.c (make_exception): use local variable for argv[0]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* eval.c (mod_using): new method Module#using, which activatesshugo
refinements of the specified module only in the current class or module definition. [ruby-core:55273] [Feature #8481] * test/ruby/test_refinement.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo
when $SAFE is set to 4. $SAFE=4 is now obsolete. [ruby-core:55222] [Feature #8468] * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust): Kernel#untrusted?, untrust, and trust are now deprecated. Their behavior is same as tainted?, taint, and untaint, respectively. * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED() and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(), respectively. * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c, ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c, ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c, ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c, ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c, ext/socket/socket.c, ext/socket/udpsocket.c, ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c, ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c, load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c, safe.c, string.c, thread.c, transcode.c, variable.c, vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for $SAFE=4. * test/dl/test_dl2.rb, test/erb/test_erb.rb, test/readline/test_readline.rb, test/readline/test_readline_history.rb, test/ruby/test_alias.rb, test/ruby/test_array.rb, test/ruby/test_dir.rb, test/ruby/test_encoding.rb, test/ruby/test_env.rb, test/ruby/test_eval.rb, test/ruby/test_exception.rb, test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb, test/ruby/test_io.rb, test/ruby/test_method.rb, test/ruby/test_module.rb, test/ruby/test_object.rb, test/ruby/test_pack.rb, test/ruby/test_rand.rb, test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb, test/ruby/test_struct.rb, test/ruby/test_thread.rb, test/ruby/test_time.rb: remove tests for $SAFE=4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07* internal.h (numberof): Gathered from various files.akr
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c, load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c, error.c, ruby.c: Remove the definitions of numberof. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-25eval.c: rb_frame_callee returns current namenobu
* eval.c (rb_frame_callee): returns the called name of the current frame, not the previous frame. * eval.c (prev_frame_callee, prev_frame_func): rename and make static, as these are used by rb_f_method_name() and rb_f_callee_name() only. * variable.c (set_const_visibility): use the called name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19fix typos. Patch by k_takata.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* include/ruby/ruby.h: constify RBasic::klass and addko1
RBASIC_CLASS(obj) macro which returns a class of `obj'. This change is a part of RGENGC branch [ruby-trunk - Feature #8339]. * object.c: add new function rb_obj_reveal(). This function reveal interal (hidden) object by rb_obj_hide(). Note that do not change class before and after hiding. Only permitted example is: klass = RBASIC_CLASS(obj); rb_obj_hide(obj); .... rb_obj_reveal(obj, klass); TODO: API design. rb_obj_reveal() should be replaced with others. TODO: modify constified variables using cast may be harmful for compiler's analysis and optimizaton. Any idea to prohibt inserting RBasic::klass directly? If rename RBasic::klass and force to use RBASIC_CLASS(obj), then all codes such as `RBASIC(obj)->klass' will be compilation error. Is it acceptable? (We have similar experience at Ruby 1.9, for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)". * internal.h: add some macros. * RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal object. * RBASIC_SET_CLASS(obj, cls) set RBasic::klass. * RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS without write barrier (planned). * RCLASS_SET_SUPER(a, b) set super class of a. * array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c, file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c, parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c, string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c: Use above macros and functions to access RBasic::klass. * ext/coverage/coverage.c, ext/readline/readline.c, ext/socket/ancdata.c, ext/socket/init.c, * ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-01eval.c: use predefined IDsnobu
* eval.c (frame_func_id): use predefined IDs. * vm.c (rb_vm_control_frame_id_and_class): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04reduce overhead of TYPEnobu
* array.c (ary_join_1): reduce overhead of TYPE(). * eval.c (rb_frozen_class_p, rb_mod_{append,prepend}_features): ditto. * string.c (rb_to_id): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-08eval.c: preserve errinfonobu
* eval.c (rb_ensure): preserve errinfo accross ensure proc before JUMP_TAG(). [ruby-core:52022] [Bug #7802] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24re-fix documentsnobu
File.realdirpath(path) is not a shorthand for File.dirname(File.realpath(path)), just does not err if the last component does not exist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e