summaryrefslogtreecommitdiff
path: root/internal.h
AgeCommit message (Collapse)Author
2012-12-06* revised r37993 to avoid SEGV/ILL in tests. In r37993, a methodshugo
entry with VM_METHOD_TYPE_REFINED holds only the original method definition, so ci->me is set to a method entry allocated in the stack, and it causes SEGV/ILL. In this commit, a method entry with VM_METHOD_TYPE_REFINED holds the whole original method entry. Furthermore, rb_thread_mark() is changed to mark cfp->klass to avoid GC for iclasses created by copy_refinement_iclass(). * vm_method.c (rb_method_entry_make): add a method entry with VM_METHOD_TYPE_REFINED to the class refined by the refinement if the target module is a refinement. When a method entry with VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with the same name is searched in refinements. If such a method is found, the method is invoked. Otherwise, the original method in the refined class (rb_method_definition_t::body.orig_me) is invoked. This change is made to simplify the normal method lookup and to improve the performance of normal method calls. * vm_method.c (EXPR1, search_method, rb_method_entry), vm_eval.c (rb_call0, rb_search_method_entry): do not use refinements for method lookup. * vm_insnhelper.c (vm_call_method): search methods in refinements if ci->me is VM_METHOD_TYPE_REFINED. If the method is called by super (i.e., ci->call == vm_call_super_method), skip the same method entry as the current method to avoid infinite call of the same method. * class.c (include_modules_at): add a refined method entry for each method defined in a module included in a refinement. * class.c (rb_prepend_module): set an empty table to RCLASS_M_TBL(klass) to add refined method entries, because refinements should have priority over prepended modules. * proc.c (mnew): use rb_method_entry_with_refinements() to get a refined method. * vm.c (rb_thread_mark): mark cfp->klass for iclasses created by copy_refinement_iclass(). * vm.c (Init_VM), cont.c (fiber_init): initialize th->cfp->klass. * test/ruby/test_refinement.rb (test_inline_method_cache): do not skip the test because it should pass successfully. * test/ruby/test_refinement.rb (test_redefine_refined_method): new test for the case a refined method is redefined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-05* thread.c (rb_uninterruptible): helper function for providingkosaki
temporary async_interrupt_timing(Object => :defer) * io.c (rb_f_p): use rb_uninterruptible. * io.c (rb_f_p_internal): helper function for rb_f_p(). * io.c (struct rb_f_p_arg): new struct for rb_f_p_internal. * test/ruby/test_thread.rb (test_async_interrupt_and_p): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30* revert r37993 to avoid SEGV in tests.shugo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* vm_method.c (rb_method_entry_make): add a method entry withshugo
VM_METHOD_TYPE_REFINED to the class refined by the refinement if the target module is a refinement. When a method entry with VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with the same name is searched in refinements. If such a method is found, the method is invoked. Otherwise, the original method in the refined class (rb_method_definition_t::body.orig_def) is invoked. This change is made to simplify the normal method lookup and to improve the performance of normal method calls. * vm_method.c (EXPR1, search_method, rb_method_entry), vm_eval.c (rb_call0, rb_search_method_entry): do not use refinements for method lookup. * vm_insnhelper.c (vm_call_method): search methods in refinements if ci->me is VM_METHOD_TYPE_REFINED. If the method is called by super (i.e., ci->call == vm_call_super_method), skip the same method entry as the current method to avoid infinite call of the same method. * class.c (include_modules_at): add a refined method entry for each method defined in a module included in a refinement. * class.c (rb_prepend_module): set an empty table to RCLASS_M_TBL(klass) to add refined method entries, because refinements should have priority over prepended modules. * proc.c (mnew): use rb_method_entry_with_refinements() to get a refined method. * test/ruby/test_refinement.rb (test_inline_method_cache): do not skip the test because it should pass successfully. * test/ruby/test_refinement.rb (test_redefine_refined_method): new test for the case a refined method is redefined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* thread.c (struct rb_mutex_struct): add allow_trap field.kosaki
* internal.h (rb_mutex_allow_trap): added. * thread.c (rb_mutex_lock, rb_mutex_unlock): check mutex->allow_trap. * thread.c (mutex_sleep): remove trap check because it uses rb_mutex_lock and rb_mutex_unlock internally. * thread.c (rb_mutex_allow_trap): new helper function for the above. * io.c (io_binwrite): mark fptr->write_lock as writable in trap. * test/ruby/test_signal.rb (test_trap_puts): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-25array.c: refactoring of rb_ary_delete_same()shirosaki
* array.c (ary_resize_smaller): new function to resize array. * array.c (rb_ary_delete): refactoring to extract a function. * array.c (rb_ary_delete_same): refactoring. It renames function, reduces duplicated code and removes unused code. * gc.c (wmap_final_func): follow the above change. * internal.h (rb_ary_delete_same): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-24Fix WeakRef finalizeshirosaki
* array.c (rb_ary_delete_same_obj): new function for WeakRef. This deletes same objects as item argument in the array. * internal.h (rb_ary_delete_same_obj): add a declaration. * gc.c (wmap_final_func): remove WeakRef object reference from the array. rb_ary_delete() is not usable because it uses rb_equal() to compare object references. * gc.c (wmap_finalize): remove recycled object references from weak map hash properly. How to get object reference from object id was wrong. st_delete() doesn't work properly if key and value arguments are same. The key of obj2wmap is referenced object and the value of obj2wmap is WeakRef array. * gc.c (wmap_aset): obj2wmap should contain WeakRef array in the definition. * test/test_weakref.rb (TestWeakRef#test_not_reference_different_object, TestWeakRef#test_weakref_finalize): add tests for above. [ruby-core:49044] [Bug #7304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19* thread.c: add `Thread#backtrace_locations' method.ko1
This method is similart to `caller_locations' method for specific method. And fix to accept `level' and `n' parameters for `Thread#backtrace' and `Thread#backtrace_locations'. `caller' (and `caller_locations') do not return `caller' method frame. However, `Thread#backtrace' (and `Thread#backtrace_locations') return `Thread#backtrace' method frame itself if `Thread.current.backtrace' was called. * vm_backtrace.c: ditto. * internal.h: ditto. * test/ruby/test_backtrace.rb: add tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-12* probes.d: add DTrace probe declarations. [ruby-core:27448]tenderlove
* array.c (empty_ary_alloc, ary_new): added array create DTrace probe. * compile.c (rb_insns_name): allowing DTrace probes to access instruction sequence name. * Makefile.in: translate probes.d file to appropriate header file. * common.mk: declare dependencies on the DTrace header. * configure.in: add a test for existence of DTrace. * eval.c (setup_exception): add a probe for when an exception is raised. * gc.c: Add DTrace probes for mark begin and end, and sweep begin and end. * hash.c (empty_hash_alloc): Add a probe for hash allocation. * insns.def: Add probes for function entry and return. * internal.h: function declaration for compile.c change. * load.c (rb_f_load): add probes for `load` entry and exit, require entry and exit, and wrapping search_required for load path search. * object.c (rb_obj_alloc): added a probe for general object creation. * parse.y (yycompile0): added a probe around parse and compile phase. * string.c (empty_str_alloc, str_new): DTrace probes for string allocation. * test/dtrace/*: tests for DTrace probes. * vm.c (vm_invoke_proc): add probes for function return on exception raise, hash create, and instruction sequence execution. * vm_core.h: add probe declarations for function entry and exit. * vm_dump.c: add probes header file. * vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on function entry and return. * vm_exec.c: expose instruction number to instruction name function. * vm_insnshelper.c: add function entry and exit probes for cfunc methods. * vm_insnhelper.h: vm usage information is always collected, so uncomment the functions. 12 19:14:50 2012 Akinori MUSHA <knu@iDaemons.org> * configure.in (isinf, isnan): isinf() and isnan() are macros on DragonFly which cannot be found by AC_REPLACE_FUNCS(). This workaround enforces the fact that they exist on DragonFly. 12 15:59:38 2012 Shugo Maeda <shugo@ruby-lang.org> * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo), vm_insnhelper.c (vm_search_method): revert r37616 because it's too slow. [ruby-dev:46477] * test/ruby/test_refinement.rb (test_inline_method_cache): skip the test until the bug is fixed efficiently. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-11hash.c: refine error messagesnobu
* hash.c (rb_hash_s_create): refine error messages. * error.c (rb_builtin_class_name): share for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06enum.c: prefixnobu
* enum.c (rb_enum_cycle_size): prefix with rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* enumerator.c: Support for lazy.cycle.sizemarcandre
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06* numeric.c (num_step): Support for Numeric#step.sizemarcandre
[Feature #6636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05Fix compatibility of cached expanded load pathshirosaki
* file.c (rb_get_path_check_to_string): extract from rb_get_path_check(). We change the spec not to call to_path of String object. * file.c (rb_get_path_check_convert): extract from rb_get_path_check(). * file.c (rb_get_path_check): follow the above change. * file.c (rb_file_expand_path_fast): remove check_expand_path_args(). Instead we call it in load.c. * file.c (rb_find_file_ext_safe): use rb_get_expanded_load_path() to reduce expand cost. * file.c (rb_find_file_safe): ditto. * internal.h (rb_get_expanded_load_path): add a declaration. * internal.h (rb_get_path_check_to_string, rb_get_path_check_convert): add declarations. * load.c (rb_construct_expanded_load_path): fix for compatibility. Same checks in rb_get_path_check() are added. We don't replace $LOAD_PATH and ensure that String object of $LOAD_PATH are frozen. We don't freeze non String object and expand it every times. We add arguments for expanding load path partially and checking if load path have relative paths or non String objects. * load.c (load_path_getcwd): get current working directory for checking if it's changed when getting load path. * load.c (rb_get_expanded_load_path): fix for rebuilding cache properly. We check if current working directory is changed and rebuild expanded load path cache. We expand paths which start with ~ (User HOME) and non String objects every times for compatibility. We make this accessible from other source files. * load.c (rb_feature_provided): call rb_get_path() since we changed rb_file_expand_path_fast() not to call it. * load.c (Init_load): initialize vm->load_path_check_cache. * vm.c (rb_vm_mark): mark vm->load_path_check_cache for GC. * vm_core.h (rb_vm_struct): add vm->load_path_check_cache to store data to check load path cache validity. * test/ruby/test_require.rb (TestRequire): add tests for require compatibility related to cached expanded load path. [ruby-core:47970] [Bug #7158] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-09process.c: uid gid exec optionsnobu
* process.c (rb_execarg_addopt, rb_execarg_run_options): add :uid and :gid options. [ruby-core:47414] [Feature #6975] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-19array.c, enum.c: TypeError in zipnobu
* array.c (take_items), enum.c (enum_zip): raise TypeError at non-enumerable objects, not NoMethodError. [ruby-dev:46145] [Bug #7038] * vm_eval.c (rb_check_block_call): check_funcall variant with block function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-08internal.h: allocator function in rb_classext_tnobu
* internal.h (struct rb_classext_struct): move allocator function into rb_classext_t from ordinary method table. [ruby-dev:46121] [Feature #6993] * object.c (rb_obj_alloc): call allocator function directly. * vm_method.c (rb_define_alloc_func, rb_undef_alloc_func) (rb_get_alloc_func): use allocator function in rb_classext_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-29* internal.h (rb_last_status_clear): declared.akr
* process.c (rb_last_status_clear): exported. (rb_f_system): call rb_last_status_clear. * io.c (rb_f_backquote): call rb_last_status_clear. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-24Improve require/File.expand_path performance on Windowsluislavena
* configure.in (mingw): add shlwapi to the list of dependency libs for Windows. * win32/Makefile.sub (EXTSOLIBS): ditto. * internal.h: declare internal functions rb_w32_init_file, rb_file_expand_path_internal and rb_file_expand_path_fast. * file.c (Init_File): invoke Windows initialization rb_w32_init_file * win32/file.c (rb_file_load_path_internal): new function. Windows-specific implementation that replaces file_expand_path. [Bug #6836][ruby-core:46996] * win32/file.c (rb_w32_init_file): new function. Initialize codepage cache for faster conversion encodings lookup. * file.c (file_expand_path): rename to rb_file_expand_path_internal. Conditionally exclude from Windows. * file.c (rb_file_expand_path_fast): new function. delegates to rb_file_expand_path_internal without performing a hit to the filesystem. * file.c (file_expand_path_1): use rb_file_expand_path_internal without path expansion (used by require). * file.c (rb_find_file_ext_safe): ditto. * file.c (rb_find_file_safe): ditto. * load.c (rb_get_expanded_load_path): use rb_file_expand_path_fast. * load.c (rb_feature_provided): ditto. * file.c (rb_file_expand_path): use rb_file_expand_path_internal with path expansion. * file.c (rb_file_absolute_path): ditto. * test/ruby/test_file_exhaustive.rb: new tests to exercise rb_file_expand_path_internal implementation and compliance with existing behaviors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-16* vm_trace.c, vm_core.h: simplify tracing mechanism.ko1
(1) add rb_hook_list_t data structure which includes hooks, events (flag) and `need_clean' flag. If the last flag is true, then clean the hooks list. In other words, deleted hooks are contained by `hooks'. Cleanup process should run before traversing the list. (2) Change check mechanism See EXEC_EVENT_HOOK() in vm_core.h. (3) Add `raw' hooks APIs Normal hooks are guarded from exception by rb_protect(). However, this protection is overhead for too simple functions which never cause exceptions. `raw' hooks are executed without protection and faster. Now, we only provide registration APIs. All `raw' hooks are kicked under protection (same as normal hooks). * include/ruby/ruby.h: remove internal data definition and macros. * internal.h (ruby_suppress_tracing), vm_trace.c: rename ruby_suppress_tracing() to rb_suppress_tracing() and remove unused function parameter. * parse.y: fix to use renamed rb_suppress_tracing(). * thread.c (thread_create_core): no need to set RUBY_VM_VM. * vm.c (mark_event_hooks): move definition to vm_trace.c. * vm.c (ruby_vm_event_flags): add a global variable. This global variable represents all of Threads and VM's event masks (T1#events | T2#events | ... | VM#events). You can check the possibility kick trace func or not with ruby_vm_event_flags. ruby_vm_event_flags is maintained by vm_trace.c. * cont.c (fiber_switch, rb_cont_call): restore tracing status. [Feature #4347] * test/ruby/test_continuation.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-06method in instance_evalnobu
* class.c (rb_special_singleton_class_of): utility function. * vm_eval.c (eval_under): special deal for class variable scope with instance_eval. * vm_eval.c (rb_obj_instance_eval, rb_obj_instance_exec): allow method definition in instance_eval of special constants. [ruby-core:28324] [Bug #2788] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-06* internal.h, class.c, eval.c, insns.def: find the appropriateshugo
receiver for super called in instance_eval. If such a receiver is not found, raise NoMethodError. [ruby-dev:39772] [Bug #2402] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-19internal.h: move mark functionsnobu
* internal.h: move mark function declarations that should be private. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-16* bignum.c (rb_integer_float_eq): new function.akr
(rb_big_eq): use rb_integer_float_eq. * internal.h (rb_integer_float_eq): declared. * numeric.c (flo_eq): use rb_integer_float_eq. (fix_equal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-16* bignum.c (rb_integer_float_cmp): renamed from rb_big_float_cmp.akr
* internal.h: follow the above change. * numeric.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-16* internal.h (rb_big_float_cmp): declared.akr
* bignum.c (rb_big_float_cmp): extracted from rb_big_cmp and big_op. (rb_big_cmp): use rb_big_float_cmp. (big_op): ditto. * numeric.c (flo_cmp): use rb_big_float_cmp. (flo_gt): ditto. (flo_ge): ditto. (flo_lt): ditto. (flo_le): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-10rb_thread_call_without_gvlnobu
* include/ruby/thread.h: new header file for thread stuff. * thread.c (rb_thread_call_without_gvl): export. [Feature#4328] returns void* instead of VALUE. [Feature #5543] * thread.c (rb_thread_blocking_region): deprecate. [ruby-core:46295] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-05ThreadShieldnobu
* internal.h: move ThreadShield declarations from intern.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-29rb_builtin_type_namenobu
* error.c (rb_builtin_type_name): extract from rb_check_type() for debug purpose. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-27Module#prependnobu
* class.c (rb_prepend_module): prepend module into another module. * eval.c (rb_mod_prepend): new method Module#prepend. [Feature #1102] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-27popen: shell commands with envvars and execoptsnobu
* io.c (is_popen_fork): check if fork and raise NotImplementedError if unavailable. * io.c (rb_io_s_popen): allow environment variables hash and exec options as flat parameters, not in an array arguments. [Feature#6651] [EXPERIMENTAL] * process.c (rb_execarg_extract_options): extract exec options, but no exceptions on non-exec options and returns them as a Hash. * process.c (rb_execarg_setenv): set environment variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-25* internal.h: use rb_pid_t instead of pid_t because of there is nousa
definition of pid_t here on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23* internal.h (rb_execarg): options field removed.akr
* process.c: follow the rb_execarg change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23* internal.h (rb_execarg): add new_pgroup_given and new_pgroup_flagakr
fields. * process.c (EXEC_OPTION_NEW_PGROUP): removed. (proc_spawn_cmd): take a struct rb_execarg argument. use the new fields. (rb_execarg_addopt): use the new fields. (rb_spawn_process): follow the proc_spawn_cmd change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23* internal.h (rb_execarg): add fd_dup2, fd_close, fd_open,akr
fd_dup2_child fields. * process.c (EXEC_OPTION_DUP2): removed. (EXEC_OPTION_CLOSE): removed. (EXEC_OPTION_OPEN): removed. (EXEC_OPTION_DUP2_CHILD): removed. (mark_exec_arg): mark the new fields. (check_exec_redirect1): change condition for default option. (check_exec_redirect): take a struct rb_execarg argument. use the new fields. (rb_execarg_addopt): follow the check_exec_redirect change. (check_exec_fds): use the new fields. (save_redirect_fd): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23* internal.h (rb_execarg): add env_modification field.akr
* process.c (EXEC_OPTION_ENV): removed. (mark_exec_arg): mark env_modification field. (rb_exec_fillarg): update the new field, instead of options array. (rb_execarg_fixup): use the new field. (save_env): ditto. (rb_execarg_run_options): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23* internal.h (rb_execarg): add rlimit_limits field.akr
* process.c (EXEC_OPTION_RLIMIT): removed. (mark_exec_arg): mark rlimit_limits field. (rb_execarg_addopt): update the new fields, instead of options array. (run_exec_rlimit): use the new field. (rb_execarg_run_options): clear sarg using MEMZERO. use the new field. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23* internal.h (rb_execarg): add chdir_given and chdir_dir fields.akr
* process.c (EXEC_OPTION_CHDIR): removed. (mark_exec_arg): mark chdir_dir field. (rb_execarg_addopt): update the new fields, instead of options array. (rb_execarg_run_options): use the new fields. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23* internal.h (rb_execarg): add close_others_given, close_others_do andakr
close_others_maxhint fields. * process.c (EXEC_OPTION_CLOSE_OTHERS): removed. (rb_execarg_addopt): update the new fields, instead of options array. (check_exec_fds): take eargp as an argument. update the close_others_maxhint field. (rb_execarg_fixup): follow the argument change of check_exec_fds. (rb_execarg_run_options): use the new fields. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-23* internal.h (rb_execarg): add unsetenv_others_given andakr
unsetenv_others_do fields. * process.c (EXEC_OPTION_UNSETENV_OTHERS): removed. (rb_execarg_addopt): update the new fields, instead of options array. (rb_execarg_fixup): use the new fields. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22* internal.h (rb_execarg): add pgroup_given and pgroup_pgid fields.akr
* process.c (EXEC_OPTION_PGROUP): removed. (rb_execarg_addopt): update the new fields, instead of options array. (run_exec_pgroup): take a struct rb_execarg argument. refer the new fields. (rb_execarg_run_options): follow run_exec_pgroup change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22* iseq.c, vm_eval.c: set th->base_block properly.ko1
th->base_block is information for (a) parsing, (b) compiling and (c) setting up the frame to execute the program passed by `eval' method. For example, (1) parser need to know up-level variables to detect it is variable or method without paren. Befor (a), (b) and (c), VM set th->base_block by passed bindng (or previous frame information). After execute (a), (b) and (c), VM should clear th->base_block. However, if (a), (b) or (c) raises an exception, then th->base_block is not cleared. Problem is that the uncleared value th->balo_block is used for irrelevant iseq compilation. It causes SEGV or critical error. I tried to solve this problem: to clear them before exception, but finally I found out that it is difficult to do it (Ruby program can be run in many places). Because of this background, I set th->base_block before compiling iseq and restore it after compiling. Basically, th->base_block is dirty hack (similar to global variable) and this patch is also dirty. * bootstraptest/test_eval.rb: add a test for above. * internal.h: remove unused decl. * iseq.c (rb_iseq_compile_with_option): add base_block parameter. set th->base_block before compation and restore it after compilation. * ruby.c (require_libraries): pass 0 as base_block instead of setting th->base_block * tool/compile_prelude.rb (prelude_eval): apply above changes. * vm.c, vm_eval.c: ditto. * vm_core.h: add comments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21* process.c (rb_execarg_addopt): take a VALUE argument instead ofakr
struct rb_execarg. (rb_exec_arg_addopt): follow the rb_execarg_addopt change. (check_exec_options_i): ditto. * io.c (pipe_open): follow the rb_execarg_addopt change. * internal.h (rb_execarg_addopt): follow the definition change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-21* process.c (rb_execarg_init): take a VALUE argument instead ofakr
struct rb_execarg. (rb_execarg_new): follow the rb_execarg_init change. (rb_exec_arg_init): ditto. * internal.h (rb_execarg_init): follow the definition change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20* process.c (rb_execarg_fixup): take a VALUE argument instead ofakr
struct rb_execarg. * internal.h (rb_execarg_fixup): follow the definition change. * io.c (pipe_open): follow rb_execarg_fixup change. * ext/pty/pty.c (establishShell): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20* internal.h (struct rb_execarg): add umask_given and umask_maskakr
fields. * process.c (STATIC_ASSERT): removed. (rb_execarg_addopt): follow the rb_execarg change. (rb_execarg_run_options): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20* internal.h (struct rb_execarg) moved and renamed fromakr
struct rb_exec_arg in intern.h. * include/ruby/intern.h (struct rb_exec_arg): refer Data object which contains struct rb_execarg. * process.c: use struct rb_execarg instead of struct rb_exec_arg except functions declared in intern.h. (rb_exec_arg_addopt): extract a pointer to struct rb_execarg from struct rb_exec_arg. (rb_exec_arg_init): ditto. (rb_exec_arg_fixup): ditto. (rb_run_exec_options_err): ditto. (rb_run_exec_options): ditto. (rb_exec_err): ditto. (rb_exec): ditto. * io.c: use struct rb_execarg instead of struct rb_exec_arg. * ext/pty/pty.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20* internal.h (rb_execarg_new): declared.akr
(rb_execarg_get): ditto. * process.c (mark_exec_arg): new function. (free_exec_arg): ditto. (memsize_exec_arg): ditto. (exec_arg_data_type): defined. (rb_execarg_new): new function. (rb_execarg_get): ditto. (rb_f_exec): use rb_execarg_new. (rb_spawn_internal): ditto. (rb_f_spawn): ditto. * io.c (pipe_open_v): use rb_execarg_new. (pipe_open_s): ditto. * ext/pty/pty.c (establishShell): use rb_execarg_new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-12* include/ruby/intern.h (rb_exec_arg_init): deprecated.akr
(rb_exec_arg_addopt): ditto. (rb_exec_arg_fixup): ditto. (rb_run_exec_options): ditto. (rb_run_exec_options_err): ditto. * internal.h (rb_execarg_init): declared. (rb_execarg_addopt): ditto. (rb_execarg_fixup): ditto. (rb_execarg_run_options): ditto. * process.c: call rb_execarg_addopt, rb_execarg_fixup, rb_execarg_run_options, rb_execarg_init. (rb_execarg_addopt): renamed from rb_exec_arg_addopt. (rb_exec_arg_addopt): stub to call rb_execarg_addopt. (rb_execarg_init): renamed from rb_exec_arg_init. (rb_exec_arg_init): stub to call rb_execarg_init. (rb_execarg_fixup): renamed from rb_exec_arg_fixup. (rb_exec_arg_fixup): stub to call rb_execarg_fixup. (rb_execarg_run_options): renamed from rb_run_exec_options_err. (rb_run_exec_options_err): stub to call rb_execarg_run_options. (rb_run_exec_options): call rb_execarg_run_options. * io.c: call rb_execarg_addopt, rb_execarg_fixup, rb_execarg_run_options, rb_execarg_init. * ext/pty/pty.c (establishShell): call rb_execarg_init and rb_execarg_fixup. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10* process.c (rb_fork_ruby): new function.akr
(rb_f_fork): use rb_fork_ruby instead of rb_fork. (rb_daemon): ditto. * io.c (pipe_open): use rb_fork_ruby instead of rb_fork. * internal.h (rb_fork_ruby): declared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e