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
* vm_core.h (rb_vm_struct): trace_running should be a counter but
not a bit flag. [ruby-core:78514] [Bug #13011]
Author: David Rodríguez <deivid.rodriguez@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (VM_ASSERT): stringify expr here before expansion in
RUBY_ASSERT_WHEN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
are imemo objects (imemo_env).
* NEWS: describe this change. I believe nobody touch these objects
because there are no method defined.
* vm_core.h: remove the following definitions.
* rb_cEnv decl.
* GetEnvPtr() because Env is no longer T_DATA object.
* vm_core.h (rb_env_t): fix layout for imemo values.
* vm_core.h (vm_assert_env): added.
* vm_core.h (vm_env_new): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Bug #12628]
This patch introduce many changes.
* Introduce concept of "Block Handler (BH)" to represent
passed blocks.
* move rb_control_frame_t::flag to ep[0] (as a special local
variable). This flags represents not only frame type, but also
env flags such as escaped.
* rename `rb_block_t` to `struct rb_block`.
* Make Proc, Binding and RubyVM::Env objects wb-protected.
Check [Bug #12628] for more details.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
instead of setting rb_thread_t::cfp directly.
* vm_insnhelper.c (vm_pop_frame): return the result of
finish frame or not.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [Feature #12005] Unify Fixnum and Bignum into Integer
* include/ruby/ruby.h (rb_class_of): Return rb_cInteger for fixnums.
* insns.def (INTEGER_REDEFINED_OP_FLAG): Unified from
FIXNUM_REDEFINED_OP_FLAG and BIGNUM_REDEFINED_OP_FLAG.
* vm_core.h: Ditto.
* vm_insnhelper.c (opt_eq_func): Use INTEGER_REDEFINED_OP_FLAG instead
of FIXNUM_REDEFINED_OP_FLAG.
* vm.c (vm_redefinition_check_flag): Use rb_cInteger instead of
rb_cFixnum and rb_cBignum.
(C): Use Integer instead of Fixnum and Bignum.
* numeric.c (fix_succ): Removed.
(Init_Numeric): Define Fixnum as Integer.
* bignum.c (bignew): Use rb_cInteger instead of Rb_cBignum.
(rb_int_coerce): replaced from rb_big_coerce and return fixnums
as-is.
(Init_Bignum): Define Bignum as Integer.
Don't define ===.
* error.c (builtin_class_name): Return "Integer" for fixnums.
* sprintf.c (ruby__sfvextra): Use rb_cInteger instead of rb_cFixnum.
* ext/-test-/testutil: New directory to test.
Currently it provides utilities for fixnum and bignum.
* ext/json/generator/generator.c: Define mInteger_to_json.
* lib/mathn.rb (Fixnum#/): Redefinition removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_vm_struct): make at_exit a single linked list but
not RArray, not to mark the registered functions by the write
barrier. based on the patches by Evan Phoenix.
[ruby-core:73908] [Bug #12095]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c (rb_compile_err_append): rb_thread_t::base_block is no
longer used.
* iseq.c (rb_iseq_compile_with_option): ditto, no protection is
needed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (struct parser_params): move parse_in_eval flag from
rb_thread_t.
* parse.y (rb_parser_set_context): set parsing context, not only
mild error flag.
* iseq.c (rb_iseq_compile_with_option): the parser now refers no
thread local states to be restored.
* vm_eval.c (eval_string_with_cref): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.c (rb_iseq_compile_with_option): make the parser in mild
error.
* load.c (rb_load_internal0): ditto.
* parse.y (yycompile0): return the error message within the error
to be raised. [Feature #11951]
* parse.y (parser_compile_error): accumulate error messages in the
error_buffer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Now `[x, y].max` is optimized so that a temporal array object is not
created in some condition.
* insns.def (opt_newarray_max, opt_newarray_min): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (CoreDataFromValue): split as an expression from
GetCoreDataFromValue, which can be a statement only.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby_assert.h (RUBY_ASSERT_WHEN): fix reference to macro name
* vm_core.h: include ruby_assert.h before using
[ruby-core:73371]
This does not fix the test failure documented in [ruby-core:73371],
that is for later.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
and a pre-compilation/runtime loader sample.
[Feature #11788]
* iseq.c: add new methods:
* RubyVM::InstructionSequence#to_binary_format(extra_data = nil)
* RubyVM::InstructionSequence.from_binary_format(binary)
* RubyVM::InstructionSequence.from_binary_format_extra_data(binary)
* compile.c: implement body of this new feature.
* load.c (rb_load_internal0), iseq.c (rb_iseq_load_iseq):
call RubyVM::InstructionSequence.load_iseq(fname) with
loading script name if this method is defined.
We can return any ISeq object as a result value.
Otherwise loading will be continue as usual.
This interface is not matured and is not extensible.
So that we don't guarantee the future compatibility of this method.
Basically, you should'nt use this method.
* iseq.h: move ISEQ_MAJOR/MINOR_VERSION (and some definitions)
from iseq.c.
* encoding.c (rb_data_is_encoding), internal.h: added.
* vm_core.h: add several supports for lazy load.
* add USE_LAZY_LOAD macro to specify enable or disable of
this feature.
* add several fields to rb_iseq_t.
* introduce new macro rb_iseq_check().
* insns.def: some check for lazy loading feature.
* vm_insnhelper.c: ditto.
* proc.c: ditto.
* vm.c: ditto.
* test/lib/iseq_loader_checker.rb: enabled iff suitable
environment variables are provided.
* test/runner.rb: enable lib/iseq_loader_checker.rb.
* sample/iseq_loader.rb: add sample compiler and loader.
$ ruby sample/iseq_loader.rb [dir]
will compile all ruby scripts in [dir].
With default setting, this compile creates *.rb.yarb files
in same directory of target .rb scripts.
$ ruby -r sample/iseq_loader.rb [app]
will run with enable to load compiled binary data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
nil/true/false are special literals just like floats, integers,
literal strings, and symbols. Optimize when statements with
them by using a jump table, too.
target 0: a (ruby 2.3.0dev (2015-12-08 trunk 52928) [x86_64-linux]) at "/home/ew/rrrr/b/ruby"
target 1: b (ruby 2.3.0dev (2015-12-08 master 52928) [x86_64-linux]) at "/home/ew/ruby/b/ruby"
benchmark results:
minimum results in each 5 measurements.
Execution time (sec)
name a b
loop_whileloop2 0.102 0.103
vm2_case_lit* 1.657 0.549
Speedup ratio: compare with the result of `a' (greater is better)
name b
loop_whileloop2 0.988
vm2_case_lit* 3.017
* benchmark/bm_vm2_case_lit.rb: new benchmark
* compile.c (case_when_optimizable_literal): add nil/true/false
* insns.def (opt_case_dispatch): ditto
* vm.c (vm_redefinition_check_flag): ditto
* vm.c (vm_init_redefined_flag): ditto
* vm_core.h: ditto
* object.c (InitVM_Object): define === explicitly for nil/true/false
* test/ruby/test_case.rb (test_deoptimize_nil): new test
* test/ruby/test_optimization.rb (test_opt_case_dispatch): update
(test_eqq): new test
[ruby-core:71923] [Feature #11769]
Original patch by Aaron Patterson <tenderlove@ruby-lang.org>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Fields in rb_iseq_t::variable_body are contained by
rb_iseq_t::body::mark_ary (hidden Array object).
Index 0 to 2 of mark_ary are reserved by these objects.
* iseq.c: catch up this fix.
* compile.c (rb_iseq_original_iseq): trivial rewrite.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ISEQ_ORIGINAL_ISEQ_ALLOC() macro.
* compile.c: use them to access original iseq buffer.
* iseq.c: ditto.
* vm_core.h: rename iseq field to support this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each): use it.
* vm_core.h: rename flip_cnt field to support this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: use them.
* iseq.c: ditto.
* iseq.c (rb_iseq_coverage): added.
* thread.c (update_coverage): use rb_iseq_coverage().
* vm_core.h: rename coverage field name to support this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c, iseq.c: use ISEQ_COMPILE_DATA().
* vm_core.h: rename compile_data field to support this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Some external functions I wish to call may take a long time
and unnecessarily block other threads. This may lead to performance
regressions for fast functions as releasing/acquiring the GVL is not
cheap, but can improve performance for long-running functions
in multi-threaded applications.
This also means we must reacquire the GVL when calling Ruby-defined
callbacks for Fiddle::Closure, meaning we must detect whether the
current thread has the GVL by exporting ruby_thread_has_gvl_p
in internal.h
* ext/fiddle/function.c (struct nogvl_ffi_call_args):
new struct for GVL release
(nogvl_ffi_call): new function
(function_call): adjust for GVL release
[ruby-core:71642] [Feature #11607]
* ext/fiddle/closure.c (struct callback_args):
new struct for GVL acquire
(with_gvl_callback): adjusted original callback function
(callback): wrapper for conditional GVL acquire
* ext/fiddle/depend: add dependencies
* ext/fiddle/extconf.rb: include top_srcdir for internal.h
* internal.h (ruby_thread_has_gvl_p): expose for fiddle
* vm_core.h (ruby_thread_has_gvl_p): moved to internal.h
* test/fiddle/test_function.rb (test_nogvl_poll): new test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
current cref only when cached CREF list includes singleton class.
Singleton classes have own namespaces, so that we need to check
cref as a key (#10943).
However, if current CREF list does not include singleton class,
no need to check CREF beacuse it should be same name space.
* vm_insnhelper.c (vm_get_const_key_cref): add a function returns
CREF only when it includes singleton class.
* vm_core.h: constify iseq_inline_cache_entry::ic_cref.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (vm_thread_with_frame): skip function call in
GET_THREAD which is empty unless OPT_CALL_CFUNC_WITHOUT_FRAME is
enabled.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rb_call_info (ci) has compiled fixed information.
* if ci->flag & VM_CALL_KWARG, then rb_call_info is
also rb_call_info_with_kwarg. This technique reduce one word
for major rb_call_info data.
* rb_calling_info has temporary data (argc, blockptr, recv).
for each method dispatch. This data is allocated only on
machine stack.
* rb_call_cache is for inline method cache.
Before this patch, only rb_call_info_t data is passed.
After this patch, above three structs are passed.
This patch improves:
* data locarity (rb_call_info is now read-only data).
* reduce memory consumption (rb_call_info_with_kwarg,
rb_calling_info).
* compile.c: use above data.
* insns.def: ditto.
* iseq.c: ditto.
* vm_args.c: ditto.
* vm_eval.c: ditto.
* vm_insnhelper.c: ditto.
* vm_insnhelper.h: ditto.
* iseq.h: add iseq_compile_data::ci_index and
iseq_compile_data::ci_kw_indx.
* tool/instruction.rb: introduce TS_CALLCACHE operand type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (ENABLE_VM_OBJSPACE): disable now, as socklist and
conlist will be freed exit_handler(), after object space
destruction.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (ENABLE_VM_OBJSPACE): enable per-VM object space on
Windows by default, as rb_w32_sysinit() no longer depends on
ruby_xmalloc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: introduce shortcut functions for opt_pc == 0
because opt_pc is always 0 on shortcut function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Shutting down the timer thread now always closes pipes to free FDs.
In fact, we close the write ends of the pipes is done in the main
RubyVM to signal the timer thread shutdown.
To effectively close pipes, we implement userspace locks via
atomics to force the pipe closing thread to wait on any signal
handlers which may be waking up.
While we're at it, improve robustness during resource exhaustion and
allow it to limp along non-fatally if restarting a timer thread
fails.
This reverts r51268
Note: this change is tested with VM_CHECK_MODE 1 in vm_core.h
* process.c (close_unless_reserved): add extra check
(dup2_with_divert): remove
(redirect_dup2): use dup2 without divert
(before_exec_non_async_signal_safe): adjust call + comment
(rb_f_exec): stop timer thread for all OSes
(rb_exec_without_timer_thread): remove
* eval.c (ruby_cleanup): adjust call
* thread.c (rb_thread_stop_timer_thread): always close pipes
* thread_pthread.c (struct timer_thread_pipe): add writing field,
mark owner_process volatile for signal handlers
(rb_thread_wakeup_timer_thread_fd): check valid FD
(rb_thread_wakeup_timer_thread): set writing flag to prevent close
(rb_thread_wakeup_timer_thread_low): ditto
(CLOSE_INVALIDATE): new macro
(close_invalidate): new function
(close_communication_pipe): removed
(setup_communication_pipe_internal): make errors non-fatal
(setup_communication_pipe): ditto
(thread_timer): close reading ends inside timer thread
(rb_thread_create_timer_thread): make errors non-fatal
(native_stop_timer_thread): close write ends only, always,
wait for signal handlers to finish
(rb_divert_reserved_fd): remove
* thread_win32.c (native_stop_timer_thread): adjust (untested)
(rb_divert_reserved_fd): remove
* vm_core.h: adjust prototype
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to iseq.h because this function is shared with iseq.c and compile.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_call_info_kw_arg_bytes): extract from compile.c
* compile.c (iseq_build_callinfo_from_hash): use above function
This will be use for implementing iseq_memsize
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_iseq_constant_body::param::keyword.
* compile.c: catch up this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_iseq_param_keyword::table and
rb_iseq_param_keyword::default_values.
* compile.c: catch up this fix.
* iseq.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
All contents of previous rb_iseq_t is in rb_iseq_t::body.
Remove rb_iseq_t::self because rb_iseq_t is an object.
RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq.
So RubyVM::ISeq.of(something) method returns different wrapper
objects but they point the same T_IMEMO/iseq object.
This patch is big, but most of difference is replacement of
iseq->xxx to iseq->body->xxx.
(previous) rb_iseq_t::compile_data is also located to
rb_iseq_t::compile_data.
It was moved from rb_iseq_body::compile_data.
Now rb_iseq_t has empty two pointers.
I will split rb_iseq_body data into static data and dynamic data.
* compile.c: rename some functions/macros.
Now, we don't need to separate iseq and iseqval (only VALUE).
* eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq).
* ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq.
* gc.c: check T_IMEMO/iseq.
* internal.h: add imemo_type::imemo_iseq.
* iseq.c: define RubyVM::InstructionSequnce as T_OBJECT.
Methods are implemented by functions named iseqw_....
* load.c (rb_load_internal0): rb_iseq_new_top() returns
rb_iseq_t (T_IMEMO/iesq).
* method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq).
* vm_core.h (GetISeqPtr): removed because it is not T_DATA now.
* vm_core.h (struct rb_iseq_body): remove padding for
[Bug #10037][ruby-core:63721].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (RUBY_VM_CHECK_INTS): evaluate the argument only once
to get rid of inadvertent side effects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c (RUBY_VM_CHECK_INTS_BLOCKING): move from vm_core.h for
the static function rb_threadptr_pending_interrupt_empty_p.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (EXEC_EVENT_HOOK_ORIG): evaluate each arguments only
once to get rid of inadvertent side effects. fix use of `th`
variable in the second `if` statement.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_iseq_t::local_iseq is not constant data because
local_iseq::flip_cnt can be modified (commentted).
* compile.c: catch up this fix.
* iseq.c: ditto.
* vm_insnhelper.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
via env->ep.
rb_vm_env_prev_envval(env) returns prev_envval via env->ep.
* vm_core.h (rb_vm_env_local_variables): change parameter type
from VALUE (T_DATA/env) to `const rb_env_t *' to make same as
rb_vm_env_prev_envval().
* proc.c: catch up these changes.
* vm_dump.c: ditto.
* vm.c: rename macros.
* ENV_IN_HEAP_P() to VM_EP_IN_HEAP_P() because it uses ep.
* ENV_VAL() to VM_ENV_EP_ENVVAL() because it is too short.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h: remove blockprocval field from rb_proc_t and rb_binding_t.
Instead of this field, mark given block in Proc at rb_env_t::env.
* vm.c (vm_make_env_each): make an Env object with this layout.
And also simplify parameters.
* proc.c: catch up this fix.
* vm_core.h: remove rb_env_t::local_size because it is not used.
* vm_dump.c (rb_vmdebug_env_dump_raw): catch up this fix.
* vm_core.h (rb_vm_make_env_object): remove rb_vm_make_env_object()
because it is only refered from vm.c.
* vm_eval.c (eval_string_with_cref): catch up this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_callable_method_entry_t has information about defined class.
* vm_insnhelper.c (vm_search_method): don't set ci->klass because
it is removed.
* vm_insnhelper.c (rb_equal_opt): ditto.
* vm_insnhelper.c (vm_search_superclass): removed because it is too
simple to write code directly.
* vm_insnhelper.c (vm_defined): don't use vm_search_superclass().
This fix avoid searching current callable `me' twice.
* vm_insnhelper.c (vm_search_super_method): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h, iseq.c (rb_iseq_klass): remove it because
rb_iseq_t::klass is removed.
* vm_insnhelper.c (vm_super_outside): do not see cfp->iseq, but
check callable method entry on a frame.
This fix simplify the logic to search super class.
* test/ruby/test_method.rb: support super() from Proc.
Now, [Bug #4881] and [Bug #3136] was solved.
* proc.c (rb_mod_define_method): catch up this change.
* vm.c (vm_define_method): ditto.
* vm_backtrace.c (rb_profile_frames): now, each `frame' objects
are rb_callable_method_entry_t data or iseq VALUEs.
This fix introduce minor compatibility issue that
rb_profile_frame_label() always returns
rb_profile_frame_base_label().
* test/-ext-/debug/test_profile_frames.rb: catch up this change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_control_frame_t::klass.
[Bug #11278], [Bug #11279]
rb_method_entry_t data belong to modules/classes.
rb_method_entry_t::owner points defined module or class.
module M
def foo; end
end
In this case, owner is M.
rb_callable_method_entry_t data belong to only classes.
For modules, MRI creates corresponding T_ICLASS internally.
rb_callable_method_entry_t can also belong to T_ICLASS.
rb_callable_method_entry_t::defined_class points T_CLASS or
T_ICLASS.
rb_method_entry_t data for classes (not for modules) are also
rb_callable_method_entry_t data because it is completely same data.
In this case, rb_method_entry_t::owner == rb_method_entry_t::defined_class.
For example, there are classes C and D, and incldues M,
class C; include M; end
class D; include M; end
then, two T_ICLASS objects for C's super class and D's super class
will be created.
When C.new.foo is called, then M#foo is searcheed and
rb_callable_method_t data is used by VM to invoke M#foo.
rb_method_entry_t data is only one for M#foo.
However, rb_callable_method_entry_t data are two (and can be more).
It is proportional to the number of including (and prepending)
classes (the number of T_ICLASS which point to the module).
Now, created rb_callable_method_entry_t are collected when
the original module M was modified. We can think it is a cache.
We need to select what kind of method entry data is needed.
To operate definition, then you need to use rb_method_entry_t.
You can access them by the following functions.
* rb_method_entry(VALUE klass, ID id);
* rb_method_entry_with_refinements(VALUE klass, ID id);
* rb_method_entry_without_refinements(VALUE klass, ID id);
* rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me);
To invoke methods, then you need to use rb_callable_method_entry_t
which you can get by the following APIs corresponding to the
above listed functions.
* rb_callable_method_entry(VALUE klass, ID id);
* rb_callable_method_entry_with_refinements(VALUE klass, ID id);
* rb_callable_method_entry_without_refinements(VALUE klass, ID id);
* rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me);
VM pushes rb_callable_method_entry_t, so that rb_vm_frame_method_entry()
returns rb_callable_method_entry_t.
You can check a super class of current method by
rb_callable_method_entry_t::defined_class.
* method.h: renamed from rb_method_entry_t::klass to
rb_method_entry_t::owner.
* internal.h: add rb_classext_struct::callable_m_tbl to cache
rb_callable_method_entry_t data.
We need to consider abotu this field again because it is only
active for T_ICLASS.
* class.c (method_entry_i): ditto.
* class.c (rb_define_attr): rb_method_entry() does not takes
defiend_class_ptr.
* gc.c (mark_method_entry): mark RCLASS_CALLABLE_M_TBL() for T_ICLASS.
* cont.c (fiber_init): rb_control_frame_t::klass is removed.
* proc.c: fix `struct METHOD' data structure because
rb_callable_method_t has all information.
* vm_core.h: remove several fields.
* rb_control_frame_t::klass.
* rb_block_t::klass.
And catch up changes.
* eval.c: catch up changes.
* gc.c: ditto.
* insns.def: ditto.
* vm.c: ditto.
* vm_args.c: ditto.
* vm_backtrace.c: ditto.
* vm_dump.c: ditto.
* vm_eval.c: ditto.
* vm_insnhelper.c: ditto.
* vm_method.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (VM_ASSERT): make an expression, as well as standard
assert().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* class.c (clone_method): use renamed name.
* vm_insnhelper.c (rb_vm_rewrite_cref): do not use `node' in variable
names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h: use enum method_missing_reason for
rb_thread_t::method_missing_reason.
* vm_eval.c: catch up this fix.
* vm_insnhelper.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`flag' contains several categories of attributes and it makes us
confusion (at least, I had confused).
* rb_method_visibility_t (flags::visi)
* NOEX_UNDEF -> METHOD_VISI_UNDEF = 0
* NOEX_PUBLIC -> METHOD_VISI_PUBLIC = 1
* NOEX_PRIVATE -> METHOD_VISI_PRIVATE = 2
* NOEX_PROTECTED -> METHOD_VISI_PROTECTED = 3
* NOEX_SAFE(flag)) -> safe (flags::safe, 2 bits)
* NOEX_BASIC -> basic (flags::basic, 1 bit)
* NOEX_MODFUNC -> rb_scope_visibility_t in CREF
* NOEX_SUPER -> MISSING_SUPER (enum missing_reason)
* NOEX_VCALL -> MISSING_VCALL (enum missing_reason)
* NOEX_RESPONDS -> BOUND_RESPONDS (macro)
Now, NOEX_NOREDEF is not supported (I'm not sure it is needed).
Background:
I did not know what "NOEX" stands for.
I asked Matz (who made this name) and his answer was "Nothing".
"At first, it meant NO EXport (private), but the original
meaning was gone."
This is why I remove the mysterious word "NOEX" from MRI.
* vm_core.h: introduce `enum missing_reason' to represent
method_missing (NoMethodError) reason.
* eval_intern.h: introduce rb_scope_visibility_t to represent
scope visibility.
It has 3 method visibilities (public/private/protected)
and `module_function`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Motivation and new data structure are described in [Bug #11203].
This patch also solve the following issues.
* [Bug #11200] Memory leak of method entries
* [Bug #11046] __callee__ returns incorrect method name in orphan
proc
* test/ruby/test_method.rb: add a test for [Bug #11046].
* vm_core.h: remvoe rb_control_frame_t::me. me is located at value
stack.
* vm_core.h, gc.c, vm_method.c: remove unlinked_method... codes
because method entries are simple VALUEs.
* method.h: Now, all method entries has own independent method
definititons. Strictly speaking, this change is not essential,
but for future changes.
* rb_method_entry_t::flag is move to rb_method_definition_t::flag.
* rb_method_definition_t::alias_count is now
rb_method_definition_t::alias_count_ptr, a pointer to the counter.
* vm_core.h, vm_insnhelper.c (rb_vm_frame_method_entry) added to
search the current method entry from value stack.
* vm_insnhelper.c (VM_CHECK_MODE): introduced to enable/disable
assertions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
during complex parameter setting process (splat, kw, and so on).
[Bug #11027]
* vm_core.h: remove rb_thead_t::mark_stack_len.
With this modification, we don't need to use th->mark_stack_len.
* test/ruby/test_keyword.rb: add a test.
* cont.c (cont_capture): catch up this fix.
* vm.c (rb_thread_mark): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_cref_t is data type of CREF. Now, the body is still NODE.
It is easy to understand what is CREF and what is pure NODE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h, method.h: remove rb_iseq_t::cref_stack. CREF is stored
to rb_method_definition_t::body.iseq_body.cref.
* vm_insnhelper.c: modify SVAR usage.
When calling ISEQ type method, push CREF information onto method
frame, SVAR located place. Before this fix, SVAR is simply nil.
After this patch, CREF (or NULL == Qfalse for not iseq methods)
is stored at the method invocation.
When SVAR is requierd, then put NODE_IF onto SVAR location,
and NDOE_IF::nd_reserved points CREF itself.
* vm.c (vm_cref_new, vm_cref_dump, vm_cref_new_toplevel): added.
* vm_insnhelper.c (vm_push_frame): accept CREF.
* method.h, vm_method.c (rb_add_method_iseq): added. This function
accepts iseq and CREF.
* class.c (clone_method): use rb_add_method_iseq().
* gc.c (mark_method_entry): mark method_entry::body.iseq_body.cref.
* iseq.c: remove CREF related codes.
* insns.def (getinlinecache/setinlinecache): CREF should be cache key
because a different CREF has a different namespace.
* node.c (rb_gc_mark_node): mark NODE_IF::nd_reserved for SVAR.
* proc.c: catch up changes.
* struct.c: ditto.
* insns.def: ditto.
* vm_args.c (raise_argument_error): ditto.
* vm_eval.c: ditto.
* test/ruby/test_class.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
of orignal crefs. It fixes segmentation fault when calling
refined method in duplicate module. [ruby-dev:48878] [Bug #10885]
* vm_core.h, class.c: change accordingly.
* test/ruby/test_refinement.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_call_info_kw_arg_struct): make keywords a symbols
list to get rid of inadvertent creation by variable keyword
arguments. [ruby-core:68031] [Bug #10831]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
I'm hesitant to consider this as spec, but this causes a
user-visible change which could break user code.
* vm_core.h (rb_vm_living_threads_insert): preserve order
[Bug #10660] [ruby-core:67154] [ruby-core:67159]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_thread_t::local_storage_recursive_hash_for_trace to store
recursive hash to avoid creating new recursive (nested) hashes
for each trace events.
[Bug #10511]
* vm_trace.c (rb_threadptr_exec_event_hooks_orig): use it.
* cont.c: catch up this fix.
* vm.c (rb_thread_mark): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c (rb_vm_make_proc_lambda): similar to rb_vm_make_proc() with
is_lambda argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`opt_num' was the number of optional parameters + 1.
`opt_table' has "opt_num" entries.
Change them to:
`opt_num' is the number of optional parameters.
`opt_talbe' has "opt_num + 1" entries.
This change simplify parameter fitting logics.
* compile.c: catch up this change.
* iseq.c: ditto.
* proc.c: ditto.
* vm_args.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
https://bugs.ruby-lang.org/issues/10440#change-49694
* change terminology `arg' to `param'.
* move rb_iseq_t::arg_* to rb_iseq_t::param.
* move rb_iseq_t::arg_size to rb_iseq_t::param::size.
* move rb_iseq_t::argc to rb_iseq_t::param::lead_num.
* move rb_iseq_t::arg_opts to rb_iseq_t::param::opt_num.
* move rb_iseq_t::arg_rest to rb_iseq_t::param::rest_start.
* move rb_iseq_t::arg_post_num to rb_iseq_t::param::post_num.
* move rb_iseq_t::arg_post_start to rb_iseq_t::param::post_start.
* move rb_iseq_t::arg_block to rb_iseq_t::param::block_start.
* move rb_iseq_t::arg_keyword* to rb_iseq_t::param::keyword.
rb_iseq_t::param::keyword is allocated only when keyword
parameters are available.
* introduce rb_iseq_t::param::flags to represent parameter
availability. For example, rb_iseq_t::param:🎏:has_kw
represents that this iseq has keyword parameters and
rb_iseq_t::param::keyword is allocated.
We don't need to compare with -1 to check availability.
* remove rb_iseq_t::arg_simple.
* compile.c: catch up this change.
* iseq.c: ditto.
* proc.c: ditto.
* vm.c, vm_args.c, vm_dump.c, vm_insnhelper.c: ditto.
* iseq.c (iseq_data_to_ary): support keyword argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
keyword arguments/parameters and a splat argument.
[Feature #10440] (Details are described in this ticket)
Most of complex part is moved to vm_args.c.
Now, ISeq#to_a does not catch up new instruction format.
* vm_core.h: change iseq data structures.
* introduce rb_call_info_kw_arg_t to represent keyword arguments.
* add rb_call_info_t::kw_arg.
* rename rb_iseq_t::arg_post_len to rb_iseq_t::arg_post_num.
* rename rb_iseq_t::arg_keywords to arg_keyword_num.
* rename rb_iseq_t::arg_keyword to rb_iseq_t::arg_keyword_bits.
to represent keyword bitmap parameter index.
This bitmap parameter shows that which keyword parameters are given
or not given (0 for given).
It is refered by `checkkeyword' instruction described bellow.
* rename rb_iseq_t::arg_keyword_check to rb_iseq_t::arg_keyword_rest
to represent keyword rest parameter index.
* add rb_iseq_t::arg_keyword_default_values to represent default
keyword values.
* rename VM_CALL_ARGS_SKIP_SETUP to VM_CALL_ARGS_SIMPLE
to represent
(ci->flag & (SPLAT|BLOCKARG)) &&
ci->blockiseq == NULL &&
ci->kw_arg == NULL.
* vm_insnhelper.c, vm_args.c: rewrite with refactoring.
* rewrite splat argument code.
* rewrite keyword arguments/parameters code.
* merge method and block parameter fitting code into one code base.
* vm.c, vm_eval.c: catch up these changes.
* compile.c (new_callinfo): callinfo requires kw_arg parameter.
* compile.c (compile_array_): check the last argument Hash object or
not. If Hash object and all keys are Symbol literals, they are
compiled to keyword arguments.
* insns.def (checkkeyword): add new instruction.
This instruction check the availability of corresponding keyword.
For example, a method "def foo k1: 'v1'; end" is cimpiled to the
following instructions.
0000 checkkeyword 2, 0 # check k1 is given.
0003 branchif 9 # if given, jump to address #9
0005 putstring "v1"
0007 setlocal_OP__WC__0 3 # k1 = 'v1'
0009 trace 8
0011 putnil
0012 trace 16
0014 leave
* insns.def (opt_send_simple): removed and add new instruction
"opt_send_without_block".
* parse.y (new_args_tail_gen): reorder variables.
Before this patch, a method "def foo(k1: 1, kr1:, k2: 2, **krest, &b)"
has parameter variables "k1, kr1, k2, &b, internal_id, krest",
but this patch reorders to "kr1, k1, k2, internal_id, krest, &b".
(locate a block variable at last)
* parse.y (vtable_pop): added.
This function remove latest `n' variables from vtable.
* iseq.c: catch up iseq data changes.
* proc.c: ditto.
* class.c (keyword_error): export as rb_keyword_error().
* common.mk: depend vm_args.c for vm.o.
* hash.c (rb_hash_has_key): export.
* internal.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
remove rb_binding_new_with_cfp, and use rb_vm_make_binding instead.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Remove some unnecessary VALUE/struct conversions and aggressively inline
functions used during fiber_switch. Either of these changes alone does
not yield significant performance increase, but in combination they
improve performance by ~6%.
Arguably, removal of separate VALUE/rb_fiber_t* variables also makes the
code more readable in a few places.
* vm_core.h: declare rb_fiber_t typedef
(rb_thread_t): fiber and root_fiber become rb_fiber_t * (from VALUE)
* vm.c (rb_thread_mark): use rb_fiber_mark_self
* cont.c (rb_fiber_t): prev becomes rb_fiber_t * (from VALUE)
(cont_mark, cont_free): simplify conditions
(rb_fiber_mark_self): new function
(fiber_mark): use rb_fiber_mark_self
(cont_save_thread, cont_restore_thread): inline
(cont_restore_thread): simplify
(fiber_setcontext): simplify conditions
(rb_cont_call): remove dereference
(fiber_t_alloc): update for rb_fiber_t->prev type change
(rb_fiber_start): ditto
(fiber_current): extract from rb_fiber_current
(return_fiber): move, simplify type checks
(rb_fiber_current): use fiber_current
(fiber_store): simplify type checks
(fiber_switch): ditto, simplify call to fiber_setcontext,
use fiber_current
(rb_fiber_transfer): update for type changes
(rb_fiber_terminate): move, use fiber_switch
(rb_fiber_resume): update for type changes
(rb_fiber_reset_root_local_storage): ditto
(rb_fiber_yield): use rb_fiber_switch instead of rb_fiber_transfer
(rb_fiber_m_transfer): ditto
[ruby-core:65518] [Feature #10341]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc.c (rb_proc_alloc): inline and move to vm.c
(rb_proc_wrap): new wrapper function used by rb_proc_alloc
(proc_dup): simplify alloc + copy + wrap operation
[ruby-core:64994]
* vm.c (rb_proc_alloc): new inline function
(rb_vm_make_proc): call rb_proc_alloc
* vm_core.h: remove rb_proc_alloc, add rb_proc_wrap
* benchmark/bm_vm2_newlambda.rb: short test to show difference
First we allocate and populate an rb_proc_t struct inline to avoid
unnecessary zeroing of the large struct. Inlining speeds up callers as
this takes many parameters to ensure correctness. We then call the new
rb_proc_wrap function to create the object.
rb_proc_wrap - wraps a rb_proc_t pointer as a Ruby object, but
we only use it inside rb_proc_alloc. We must call this before
the compiler may clobber VALUE parameters passed to rb_proc_alloc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
We may tag the running_thread pointer to avoid making the "once" struct
bigger than "struct iseq_inline_cache_entry".
This only saves a small amount with "valgrind ruby -e exit"
before:
total heap usage: 48,122 allocs, 19,248 frees, 8,110,149 bytes allocated
after:
total heap usage: 48,122 allocs, 19,253 frees, 8,099,197 bytes allocated
* insns.def (once): define and use fake RUNNING_THREAD_ONCE_DONE
pointer to indicate is->once.running_thread is done.
* vm_core.h (iseq_inline_storage_entry): remove done field,
allowing the union to be reduced from 24=>16 bytes on 64-bit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
make and register special exceptions.
* vm.c (rb_vm_mark): do not need to mark special exceptions
because they are registerd by rb_gc_register_mark_object().
* eval.c (Init_eval): use rb_vm_register_special_exception().
* gc.c (Init_GC): ditto.
* proc.c (Init_Proc): ditto.
* thread.c (Init_Thread): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This keeps ci->flag and ci->aux.index consistent across 32-bit
and 64-bit platforms.
ci->flag: VM_CALL_* flags only use 9 bits, currently
ci->aux.index: 2 billion ivars per class should be enough for anybody
This saves around 50K allocations on "valgrind ruby -e exit" on x86-64
before:
total heap usage: 48,122 allocs, 19,253 frees, 8,099,197 bytes allocated
after:
total heap usage: 48,069 allocs, 19,214 frees, 8,047,266 bytes allocated
* vm_core.h (rb_call_info_t): ci->flag becomes 32-bit unsigned int
ci->index becomes a 32-bit signed int (from signed long).
Reorder for better packing on 64-bit, giving an 8 byte reduction
from 104 to 96 bytes for each ci.
* compile.c (new_callinfo, setup_args, iseq_compile_each,
iseq_build_from_ary_body): adjust for type changes
* vm_insnhelper.c (vm_getivar): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Nearly all current uses of iseq->location.first_lineno are as a
VALUE, not a size_t. The only exception was the experimental
(and currently unused) rb_iseq_build_for_ruby2cext function.
* vm_core.h (rb_iseq_location_t): change first_lineno type to VALUE
* iseq.c (rb_iseq_build_for_ruby2cext): update based on argument
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
iseq_size and line_info_size may be 32-bit.
4GB instruction sequences should be big enough for anyone.
Other existing line info counters are 32-bit, and nobody
should need all that.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_proc_t): reduce to 64 bytes from 72 on 64-bit
This allows rb_proc_t to fit inside a single cache line on x86-64
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* enum.c (enum_any): optimize object allocations for Array and
Hash when `each` is not redefined, always false if empty and the
case without a block. [fix GH-617]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
because all calculations related to stack_max in compile.c
(iseq_set_sequence) and vm_insnhelper.c (vm_push_frame) are
conducted by using int. This partly reverts r23945.
* vm_insnhelper.c (vm_push_frame): ditto. This reverts r42401.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_vm_t::trap_list_cmds (an array) and
rb_vm_t::trap_list_safes[RUBY_NSIG]
(separate to two different array).
This modification reduce root objects.
* signal.c: ditto.
* vm.c (rb_vm_mark): remove marking code for rb_vm_t::trap_list.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (struct rb_iseq_struct): reduce to 288 bytes on 64-bit
(found with pahole, from the dwarves package)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Most iseq do not have a catch_table, so avoid needlessly adding
4-8 bytes to the struct for the common case.
Changes from v2:
- iseq_catch_table_size removed, use if (...) for (;...;)
Changes from v1:
- renamed iseq->_catch_table to iseq->catch_table
- iseq_catch_table_bytes: made a static inline function
- iseq_catch_table_size: new function replaces the
iseq_catch_table_each iterator macro
* iseq.h (struct iseq_catch_table): new flexible array struct
(iseq_catch_table_bytes): allocated size function
* vm_core.h (struct rb_iseq_struct): uupdate catch_table member
* compile.c (iseq_set_exception_table): update for struct changes
* iseq.c (iseq_free): ditto
* iseq.c (iseq_memsize): ditto
* iseq.c (rb_iseq_disasm): ditto
* iseq.c (iseq_data_to_ary): ditto
* iseq.c (rb_iseq_build_for_ruby2cext): ditto (untested)
* vm.c (vm_exec): ditto
* vm_core.h (struct rb_iseq_struct): ditto
* vm_insnhelper.c (vm_throw): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (struct rb_call_info_struct): improve packing
On x86-64, it goes from 112 to 104 bytes. This results in
~20K of savings from just "./ruby -e exit"
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (struct rb_iseq_struct): stack_max is uint32_t
No program will ever need more than a few megabytes of stack,
so there's no sense in using a 64-bit counter for stack
accounting. Packing this with the 32-bit type enum reduces
rb_iseq_struct from 312 to 304 bytes on 64-bit systems.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c (rb_vm_env_local_variables): returns array of local
variable name symbols in the environment by envval.
* proc.c (bind_local_variables): use rb_vm_env_local_variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.in (rb_cv_scalar_pthread_t): pthread_t is not required
to be a scalar type.
* thread.c (fill_thread_id_string, thread_id_str): dump pthread_t
in hexadecimal form if it is not a scalar type, assume it can be
represented in a pointer form otherwise. based on the patch by
Rei Odaira at [ruby-core:62867]. [ruby-core:62857] [Bug #9884]
* thread_pthread.c (Init_native_thread, thread_start_func_1),
(native_thread_create): set thread_id_str if needed.
* vm_core.h (rb_thread_t): add thread_id_string if needed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c (rb_bug_context): new function to report bug with
context.
* vm_dump.c (rb_vm_bugreport): accepts `ucontext_t` argument to
dump machine regisiters. based on [GH-584].
* signal.c (sigbus, sigsegv): dump machine regisiters if available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
A doubly-linked list for tracking living threads guarantees
constant-time insert/delete performance with no corner cases of a
hash table. I chose this ccan implementation of doubly-linked
lists over the BSD sys/queue.h implementation since:
1) insertion and removal are both branchless
2) locality is improved if a struct may be a member of multiple lists
(0002 patch in Feature 9632 will introduce a secondary list
for waiting FDs)
This also increases cache locality during iteration: improving
performance in a new IO#close benchmark with many sleeping threads
while still scanning the same number of threads.
vm_thread_close 1.762
* vm_core.h (rb_vm_t): list_head and counter for living_threads
(rb_thread_t): vmlt_node for living_threads linkage
(rb_vm_living_threads_init): new function wrapper
(rb_vm_living_threads_insert): ditto
(rb_vm_living_threads_remove): ditto
* vm.c (rb_vm_living_threads_foreach): new function wrapper
* thread.c (terminate_i, thread_start_func_2, thread_create_core,
thread_fd_close_i, thread_fd_close): update to use new APIs
* vm.c (vm_mark_each_thread_func, rb_vm_mark, ruby_vm_destruct,
vm_memsize, vm_init2, Init_VM): ditto
* vm_trace.c (clear_trace_func_i, rb_clear_trace_func): ditto
* benchmark/bm_vm_thread_close.rb: added to show improvement
* ccan/build_assert/build_assert.h: added as a dependency of list.h
* ccan/check_type/check_type.h: ditto
* ccan/container_of/container_of.h: ditto
* ccan/licenses/BSD-MIT: ditto
* ccan/licenses/CC0: ditto
* ccan/str/str.h: ditto (stripped of unused macros)
* ccan/list/list.h: ditto
* common.mk: add CCAN_LIST_INCLUDES
[ruby-core:61871][Feature 9632 (part 1)]
Apologies for the size of this commit, but I think a good
doubly-linked list will be useful for future features, too.
This may be used to add ordering to a container_of-based hash
table to preserve compatibility if required (e.g. feature 9614).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
it is bmethod frame.
* vm.c (vm_exec): invoke RUBY_EVENT_RETURN event if rollbacked frame
is VM_FRAME_FLAG_BMETHOD.
[Bug #9759]
* test/ruby/test_settracefunc.rb: add a test for TracePoint/set_trace_func.
* vm_core.h: renmae rb_thread_t::passed_me to
rb_thread_t::passed_bmethod_me to clarify the usage.
* vm_insnhelper.c (vm_call_bmethod_body): use renamed member.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_thread_struct): aggregate cpu stuff into a struct,
so that a debugger can show its content at once.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Rename method_serial
to global_method_state and constant_serial to global_constant_state
after discussion with ko1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
PC is cached into local stack and cfp->pc is incorrent at next of
branch or jump.
* vm_exec.h (DEBUG_ENTER_INSN): catch up this change.
* vm_core.h: update signature of rb_vmdebug_debug_print_pre.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
ic_serial. This is possible because these fields are only ever used
exclusively with each other.
* insns.def: ditto
* vm_core.h: ditto
* vm_insnhelper.c: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
* vm.c, vm_core.h (rb_vm_add_root_module): added to register as a
defined root module or class.
This guard helps mark miss from defined classes/modules they are
only refered from C's global variables in C-exts.
Basically, it is extension's bug.
Register to hash object VM has.
Marking a hash objects allows generational GC supports.
* gc.c (RGENGC_PRINT_TICK): disable (revert).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Pre-allocate MAX_POSTPONED_JOB (1024) sized buffer
and use it.
If rb_postponed_job_register() cause overflow, simply it
fails and returns 0.
And maybe rb_postponed_job_register() is signal safe.
* vm_core.h: change data structure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* VALUE rb_iseq_path(VALUE iseqval);
* VALUE rb_iseq_absolute_path(VALUE iseqval);
* VALUE rb_iseq_label(VALUE iseqval);
* VALUE rb_iseq_base_label(VALUE iseqval);
* VALUE rb_iseq_first_lineno(VALUE iseqval);
And new (temporary) function:
* VALUE rb_iseq_klass(VALUE iseqval);
* iseq.c. vm_core.h (int rb_iseq_first_lineno): remove
function `int rb_iseq_first_lineno(const rb_iseq_t *iseq)'.
Use `VALUE rb_iseq_first_lineno(VALUE iseqval)' instead.
* proc.c. vm_insnhelper.c, vm_method.c: catch up this change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
clang says "Note that marketing version numbers should not be used
to check for language features, as different vendors use different
numbering schemes. Instead, use the Feature Checking Macros."
http://clang.llvm.org/docs/LanguageExtensions.html
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
4.0+ instead of just on 4.2. Clang has supported the unused attribute
since before version 4, so this should be safe.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to access local variables which a binding contains.
Most part of implementation by nobu.
* test/ruby/test_proc.rb: add a tests for above.
* vm.c, vm_core.h (rb_binding_add_dynavars): add a new function
to add a new environment to create space for new local variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (Process.argv0): New method to return the original value
of $0. [Feature #8696]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Stack overflow check should be done *after* pushing a stack frame.
However, some stack overflow checking codes checked *before*
pushing a stack frame with iseq->stack_max.
To solve this problem, add a new parameter `stack_max' to specify
a possible consuming stack size.
* vm_core.h (CHECK_VM_STACK_OVERFLOW0): add to share the stack overflow
checking code.
* insns.def: catch up this change.
* vm.c, vm_eval.c: ditto.
* test/ruby/test_exception.rb: add a stack overflow test.
This code is reported by nobu.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Move native thread related lines from vm_core.h.
And declare several functions "rb_nativethread_lock_*",
manipulate locking.
* common.mk: add thread_native.h.
* thread.c: add functions "rb_nativethread_lock_*".
* thraed.c, thread_[pthread,win32].[ch]: rename rb_thread_lock_t
to rb_nativethread_lock_t to make it clear that this lock is for
native thraeds, not for ruby threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_data_type_struct::flags. Now, this flags is passed
at T_DATA object creation. You can specify FL_WB_PROTECTED
on this flag.
* iseq.c: making non-shady iseq objects.
* class.c, compile.c, proc.c, vm.c: add WB for iseq objects.
* vm_core.h, iseq.h: constify fields to detect WB insertion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Postponed jobs are registered with this API. Registered jobs
are invoked at `ruby-running-safe-point' as soon as possible.
This timing is completely same as finalizer timing.
There are two APIs:
* rb_postponed_job_register(flags, func, data): register a
postponed job with data. flags are reserved.
* rb_postponed_job_register_one(flags, func, data): same as
`rb_postponed_job_register', but only one `func' job is
registered (skip if `func' is already registered).
This change is mostly written by Aman Gupta (tmm1).
https://bugs.ruby-lang.org/issues/8107#note-15
[Feature #8107]
* gc.c: use postponed job API for finalizer.
* common.mk: add dependency from vm_trace.c to debug.h.
* ext/-test-/postponed_job/extconf.rb, postponed_job.c,
test/-ext-/postponed_job/test_postponed_job.rb: add a test.
* thread.c: implement postponed API.
* vm_core.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_vm_tag): move jmpbuf between tag and prev so ensure to
be accessible.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h: revert r39861 because RB_UNUSED_VAR() is used
for array variables in extension libraries.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c (ruby_kill): helper function of kill().
* signal.c (rb_f_kill): use ruby_kill() instead of kill().
* signal.c (rb_f_kill): call rb_thread_execute_interrupts()
to ensure that make SignalException if sent a signal
to myself. [Bug #7951] [ruby-core:52864]
* vm_core.h (typedef struct rb_thread_struct): added
th->interrupt_cond.
* thread.c (rb_threadptr_interrupt_common): added to
initialization of th->interrupt_cond.
* thread.c (thread_create_core): ditto.
* test/ruby/test_signal.rb (TestSignal#test_hup_me): test for
the above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
of IFUNC frame.
When `rb_binding_new_with_cfp()' is called, VM finds out the first
normal (has iseq) frame and create a binding object of this frame
and create Env objects. `ep's of related frames are updated
(`ep's point Env object managed spaces).
However, `ep' of skipped IFUNC frame was not updated and
old invalid `ep' was remained. It causes serious problems.
To solve this issue, permit IFUNC to create binding.
(Maybe there is no problem on it)
[ruby-dev:46908] [ruby-trunk - Bug #7774]
* test/ruby/test_settracefunc.rb: add a test.
* vm.c (rb_vm_get_binding_creatable_next_cfp), vm_core.h: added.
* vm_trace.c: fix to use `rb_vm_get_binding_creatable_next_cfp()'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
The order of making binding should be stack (frame) top to bottom.
[Bug #7635]
And also fix issue of collecting klass. Collecting klass is same
as TracePoint#defined_class.
(previous version, it returns T_ICLASS (internal objects).
* test/-ext-/debug/test_debug.rb: add a test.
* ext/-test-/debug/extconf.rb, init.c, inspector.c: ditto.
* vm_backtrace.c: remove magic number and add enum CALLER_BINDING_*.
* vm_backtrace.c, include/ruby/debug.h: add new C api (experimental)
rb_debug_inspector_frame_self_get().
* vm.c, vm_core.h, vm_trace.c: move decl. of
rb_vm_control_frame_id_and_class() and constify first parameter.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This flag specifies checking BP consistency on each frame popping.
Now, we don't have any trouble on it, so I remove it.
If you feel any bugs about VM execution, then set it to 1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_core.h (rb_iseq_t): move flip_cnt from struct iseq_compile_data,
because it has same life span as enclosing iseq. [Bug #7671]
[ruby-core:51296]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
pop a frame before JUMP_TAG() if exception occurred.
This change fix bug of Ruby 1.9.
[ruby-core:51128] [ruby-trunk - Bug #7624]
* vm_core.h (EXEC_EVENT_HOOK_AND_POP_FRAME): add to use
`rb_threadptr_exec_event_hooks_and_pop_frame()'.
* vm.c (vm_exec): use EXEC_EVENT_HOOK_AND_POP_FRAME() while
exception handling. While exception hadnling, if an exception
is raised in hooks, need to pop current frame and raise this
raised exception by hook.
* test/ruby/test_settracefunc.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
CHECK_STACK_OVERFLOW() to vm_core.h and rename to
CHECK_VM_STACK_OVERFLOW().
This change is only move and rename.
* tool/instruction.rb: catch up above changes.
* vm.c, vm_insnhelper.c: ditto.
* vm_insnhelper.c (vm_stackoverflow): add a function to unify
raising vm stackoverflow exception.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
VM stack size (128 KB or 256 KB -> 512 KB or 1024 KB).
This re-sizing corrects smaller value introduced at r38478.
Newer value is same VM stack size of Ruby 1.9.
[ruby-dev:46797] [ruby-trunk - Bug #7603]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
from Thread.async_interrupt_timing to Thread.handle_interrupt,
from Thread.async_interrupted? to Thread.pending_interrupt?.
Also rename option from `defer' to `never'.
[ruby-core:51074] [ruby-trunk - Feature #6762]
* vm_core.c, thread.c: rename functions and data structure
`async_errinfo' to `pending_interrupt'.
* thread.c: add global variables sym_immediate, sym_on_blocking and
sym_never.
* cont.c, process.c, vm.c, signal.c: ditto.
* lib/sync.rb, lib/thread.rb: catch up this renaming.
* test/ruby/test_thread.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Move `trace_arg' from rb_tp_t::trace_arg to rb_thread_t::trace_arg.
`trace_arg' may changed by multiple threads.
rb_thread_t::trace_arg can represent rb_thread_t::trace_running
(null or non-null) and rb_thread_t::trace_running is removed.
After that, `rb_tp_t' is not needed to check tracing or not
(A running thread knows tracing or not). This is why I remove
tp_attr_check_active() and make new function get_trace_arg().
And this modification disable to work the following code:
TracePoint.trace{|tp|
Thread.new{p tp.event} # access `tp' from other threads.
}
I believe nobody mix threads at trace procedure.
This is current limitation.
* cont.c (fiber_switch, rb_cont_call): use rb_thread_t::trace_arg
instead of rb_thread_t::trace_running.
* test/ruby/test_settracefunc.rb: add a multi-threading test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
compile.c (iseq_compile_each), insns.def (defineclass): change the
meaning of the third operand of defineclass as follows:
lower 3bits: the type of the defineclass
0 = class, 1 = singleton class, 2 = module
4th bit: a flag represents whether the defineclass is scoped
0 = not scoped (e.g., class Foo)
1 = scoped (e.g., class Bar::Baz)
5th bit: a flag represents whether the superclass is specified
0 = not specified (e.g., class Foo)
1 = specified (e.g., class Bar < Foo)
If the superclass is specified and is not a class, a TypeError
should be raised. [ruby-dev:46747] [Bug #7572]
* test/ruby/test_class.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Specified by the following environment variaables:
- RUBY_THREAD_VM_STACK_SIZE: vm stack size used at thread creation.
default: 128KB (32bit CPU) or 256KB (64bit CPU).
- RUBY_THREAD_MACHINE_STACK_SIZE: machine stack size used at thread
creation. default: 512KB or 1024KB.
- RUBY_FIBER_VM_STACK_SIZE: vm stack size used at fiber creation.
default: 64KB or 128KB.
- RUBY_FIBER_MACHINE_STACK_SIZE: machine stack size used at fiber
creation. default: 256KB or 256KB.
This values are specified at launched timing. You can not change
these values at running time.
Environ variables are only *hints* because:
- They are aligned to 4KB.
- They have minimum values (depend on OSs).
- Machine stack settings are ignored by some OSs.
Default values especially fiber stack sizes are increased.
This change affect Fiber's behavior:
(1) You can run more complex program on a Fiber.
(2) You can not make many (thousands) Fibers because of
lack of address space (on 32bit CPU).
If (2) bothers you,
(a) Use 64bit CPU with big memory, or
(b) Specify RUBY_FIBER_(VM|MACHINE)_STACK_SIZE correctly.
You need to choose correct stack size carefully. These values
are completely rely on systems (OS/compiler and so on).
* vm_core.h (rb_vm_t::default_params): add to record above settings.
* vm.c (RubyVM::DEFAULT_PARAMS): add new constant to see
above setting.
* thread_pthread.c: support RUBY_THREAD_MACHINE_STACK_SIZE.
* cont.c: support RUBY_FIBER_(VM|MACHINE)_STACK_SIZE.
* test/ruby/test_fiber.rb: add tests for above.
* test/ruby/test_thread.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
sigsegv handler. enlarge value when x86 or x86_64 on Linux.
Linux has very small MINSIGSTKSZ size (2048 bytes) and
our sigsegv routine need 5KiB at least. [Bug #7141]
* internal.h: add declaration of rb_sigaltstack_size().
* vm_core.h: remove ALT_STACK_SIZE definition.
* signal.c (rb_register_sigaltstack): replace ALT_STACK_SIZE with
rb_sigaltstack_size();
* gc.c (Init_heap): ditto.
* vm.c (th_init): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e