Граф коммитов

481 Коммитов

Автор SHA1 Сообщение Дата
nobu fd14454688 compile.c, iseq.c: consitfied NODE pointers
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-27 12:00:38 +00:00
ko1 88910e94a8 `th` -> `ec` for block related functions.
* vm.c: the following functions accept `ec` instead of `th`.
  * invoke_block
  * invoke_bmethod
  * invoke_iseq_block_from_c
  * invoke_block_from_c_bh
  * check_block_handler
  * vm_yield_with_cref
  * vm_yield
  * vm_yield_with_block
  * vm_yield_force_blockarg
  * invoke_block_from_c_proc
  * vm_invoke_proc
  * vm_invoke_bmethod
  * rb_vm_invoke_proc

* vm_insnhelper.c: ditto.
  * vm_yield_with_cfunc
  * vm_yield_with_symbol
  * vm_callee_setup_block_arg
  * vm_yield_setup_args
  * vm_invoke_iseq_block
  * vm_invoke_symbol_block
  * vm_invoke_ifunc_block
  * vm_invoke_block


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-27 06:06:31 +00:00
ko1 c96f809729 `vm_call_handler` and related functions accept `ec` instead of `th`.
* vm_core.h (vm_call_handler): fix to accept `ec` instead of `th`.

* vm_args.c: the following functions accept `ec` instead of `th`.
  * raise_argument_error
  * argument_arity_error
  * argument_kw_error
  * setup_parameters_complex

* vm_eval.c: ditto.
  * vm_call0
  * vm_call0_cfunc_with_frame
  * vm_call0_cfunc
  * vm_call0_body

* vm_insnhelper.c: ditto
  * vm_call_iseq_setup_tailcall_0start
  * vm_call_iseq_setup_normal_0start
  * vm_callee_setup_arg
  * vm_call_iseq_setup
  * vm_call_iseq_setup_2
  * vm_call_iseq_setup_normal
  * vm_call_iseq_setup_tailcall
  * vm_cfp_consistent_p
  * vm_call_cfunc_with_frame
  * vm_call_cfunc
  * vm_call_ivar
  * vm_call_attrset
  * vm_call_bmethod_body
  * vm_call_bmethod
  * vm_call_opt_send
  * vm_call_opt_call
  * vm_call_method_missing
  * vm_call_zsuper
  * current_method_entry
  * vm_call_method_each_type
  * vm_call_method_nome
  * vm_call_method
  * vm_call_general
  * vm_call_super_method

* tool/mk_call_iseq_optimized.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-27 02:49:30 +00:00
ko1 a399badeeb move decl.
* proc.c: move declaration of rb_vm_bh_to_procval() to vm_core.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-27 00:31:59 +00:00
ko1 f56288d7a8 replace `GET_THREAD()->ec` to `GET_EC()`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 14:44:09 +00:00
ko1 4552f74715 introduce EC_*_TAG() instead of TH_*_TAG()
* eval_intern.h:
  introduce EC_*_TAG() macros instead of TH_*_TAG() macros.
  * TH_PUSH_TAG() -> EC_PUSH_TAG()
  * TH_POP_TAG() -> EC_POP_TAG()
  * TH_TMPPOP_TAG() -> EC_TMPPOP_TAG()
  * TH_REPUSH_TAG() -> EC_REPUSH_TAG()
  * TH_EXEC_TAG() -> EC_EXEC_TAG()
  * TH_JUMP_TAG() -> EC_JUMP_TAG()

  rb_threadptr_tag_state() , rb_ec_tag_jump() also accept `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 11:02:13 +00:00
ko1 284d4c08d6 vm_pop_frame() accepts `ec` instead of `th`.
* vm_insnhelper.c (vm_pop_frame): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 10:55:24 +00:00
ko1 e95de48f1d some functions accept `ec` instead of `th`.
* vm.c (vm_make_env_object): accepts `ec`.

* vm.c (rb_vm_get_ruby_level_next_cfp): ditto.

* vm.c (rb_vm_make_proc): ditto.

* vm.c (rb_vm_make_proc_lambda): ditto.

* vm_core.h: some macros accept ec instead of th
  (and make them inline functions):
  * RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW
  * RUBY_VM_END_CONTROL_FRAME
  * RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P

* eval.c (frame_func_id): constify for the first parameter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 08:41:34 +00:00
ko1 837fd5e494 Use rb_execution_context_t instead of rb_thread_t
to represent execution context [Feature #14038]

* vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer.
  There are many code using `th` to represent execution context
  (such as cfp, VM stack and so on). To access `ec`, they need to
  use `th->ec->...` (adding one indirection) so that we need to
  replace them by passing `ec` instead of `th`.

* vm_core.h (GET_EC()): introduced to access current ec. Also
  remove `ruby_current_thread` global variable.

* cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of
  rb_context_t::thread_value.

* cont.c (ec_set_vm_stack): added to update vm_stack explicitly.

* cont.c (ec_switch): added to switch ec explicitly.

* cont.c (rb_fiber_close): added to terminate fibers explicitly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-26 08:32:49 +00:00
ko1 5ee9513a71 Lazy Proc allocation for block parameters
[Feature #14045]

* insns.def (getblockparam, setblockparam): add special access
  instructions for block parameters.
  getblockparam checks VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM and
  if it is not set this instruction creates a Proc object from
  a given blcok and set VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM.
  setblockparam is similar to setlocal, but set
  VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM.

* compile.c: use get/setblockparm instead get/setlocal instructions.
  Note that they are used for method local block parameters (def m(&b)),
  not for block local method parameters (iter{|&b|).

* proc.c (get_local_variable_ptr): creates Proc object for
  Binding#local_variable_get/set.

* safe.c (safe_setter): we need to create Proc objects for postponed
  block parameters when $SAFE is changed.

* vm_args.c (args_setup_block_parameter): used only for block local blcok
  parameters.

* vm_args.c (vm_caller_setup_arg_block): if called with
  VM_CALL_ARGS_BLOCKARG_BLOCKPARAM flag then passed block values should be
  a block handler.

* test/ruby/test_optimization.rb: add tests.

* benchmark/bm_vm1_blockparam*: added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-24 11:13:49 +00:00
hsbt 0e2d2e6a79 Drop to support NaCl platform.
Because NaCl and PNaCl are already sunset status.
  see https://bugs.chromium.org/p/chromium/issues/detail?id=239656#c160

  configure.ac: Patch for this file was provided by @nobu.

  [Feature #14041][ruby-core:83497][fix GH-1726]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-23 05:56:25 +00:00
k0kubun e6484a1530 vm_core.h: export symbols of shared variables
vm_insnhelper.h: ditto.

All changes are for reducing changes required to introduce JIT compiler.
Unlike functions that can be inlined by header, those variables should
be shared with JIT-ed code. This will help reducing cost of rebase
against upstream.

[close GH-1720]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 06:22:43 +00:00
naruse 23b9093f38 suppress unused argument warning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-11 08:50:07 +00:00
ko1 b53b37758d store ec instead of thread in rb_context_t.
* cont.c (rb_context_t): introduce saved_ec instaad of saved_thread.
  We only need to transfer ec data (not all of thread data).

  Introduce `thread_value` field to point creation thread.
  To acccess this field, `cont_thread_value()` is introduced.

* vm.c (rb_execution_context_mark): remove `static` and use it
  from cont.c (use this function instead of `rb_thread_mark`).

* vm_insnhelper.c (rb_vm_push_frame): accept ec instead of th.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-10 19:00:08 +00:00
ko1 4f0c9a5cc4 move th->machine to ec->machine.
* vm_core.h: move rb_thread_t::machine to rb_execution_context_t::machine.

* vm_core.h, gc.c (rb_gc_mark_machine_stack): accept ec instead of th.
  it enables to call this func from rb_execution_context_mark() in vm.c.

* cont.c (fiber_setcontext): catch up this fix.
  fiber_restore_thread() restores machine stack information too.

* gc.c: catch up structure layout changes.

* thread.c: ditto.

* thread_pthread.c: ditto.

* thread_win32.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-10 15:49:45 +00:00
ko1 8e03791373 move th->fiber to ec->fiber.
* vm_core.h (rb_thread_t::fiber): move fiber field to
  rb_execution_context_t::fiber.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-08 06:21:30 +00:00
ko1 b95d9e664d thread_context -> execution_context
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-06 02:51:34 +00:00
mame cd6df5fb3c Refactor the internal data format for coverage measurement
To prepare new measuring targets: branch and method coverages.
So far, iseq->coverage was an array of counts executed for line coverage.
Now, it is a three-element array for each measuring target,
whose first element is an array for line coverage.
The second element is planned for branch coverage, and the third will be
for method coverage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-03 14:26:06 +00:00
nobu b54f535506 vm_core.h: ruby_error_stackfatal
* vm_core.h (ruby_special_exceptions): rename sysstack_gc as
  stackfatal.

* eval.c (Init_eval): modified the message for stackfatal error as
  "critical region".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-21 06:46:46 +00:00
nobu a7bccb20f8 vm_insnhelper.c: raise ruby_error_sysstack_gc
* vm_insnhelper.c (rb_threadptr_stack_overflow): rb_fatal is not
  available during GC.  raise the preallocated fatal error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-18 12:17:59 +00:00
nobu 1f5bf61c6e vm_core.h: unreachable VM_UNREACHABLE
* vm_core.h (VM_UNREACHABLE): tell unreachable if possible.
  suppress an invalid-noreturn warning at rb_fiber_start.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-10 11:40:49 +00:00
ko1 6881279149 rename rb_execution_context_t::stack(_size) to vm_stack(_size).
* vm_core.h: Ruby processes run with two stacks, a machine stack and a
  VM stack. To make it clear, this fix renames
  rb_execution_context_t::stack(_size) to vm_stack(_size).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-10 04:55:12 +00:00
nobu 26aed9c577 splat keyword hash
* compile.c (compile_array_keyword_arg): set keyword splat flag if
  explicitly splatted.  [ruby-core:68124] [Bug #10856]

* vm_args.c (setup_parameters_complex): try keyword hash splat if
  given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-05 06:58:44 +00:00
nobu d11dfab569 vm_core.h: vm_call_flag_bits
* vm_core.h (vm_call_flag_bits): define VM_CALL flags by using
  enum constants.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-05 06:51:08 +00:00
nobu 083a25f903 vm_core.h: shrink trap_list size
* vm_core.h (rb_vm_struct): separate trap_list cmd and safe to
  each arrays, to shrink the size.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-27 12:17:56 +00:00
normal 0493b1ce3a revert r59359, r59356, r59355, r59354
These caused numerous CI failures I haven't been able to
reproduce [ruby-core:82102]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-19 01:35:04 +00:00
normal d04c085b3c hash: keep fstrings of tainted strings for string keys
The same hash keys may be loaded from tainted data sources
frequently (e.g. parsing headers from socket or loading
YAML data from a file).  If a non-tainted fstring already
exists (because the application expects the hash key),
cache and deduplicate the tainted version in the new
tainted_frozen_strings table.

For non-embedded strings, this also allows sharing with the
underlying malloc-ed data.

* vm_core.h (rb_vm_struct): add tainted_frozen_strings
* vm.c (ruby_vm_destruct): free tainted_frozen_strings
  (Init_vm_objects): initialize tainted_frozen_strings
  (rb_vm_tfstring_table): accessor for tainted_frozen_strings
* internal.h: declare rb_fstring_existing, rb_vm_tfstring_table
* hash.c (fstring_existing_str): remove (moved to string.c)
  (hash_aset_str): use rb_fstring_existing
* string.c (rb_fstring_existing): new, based on fstring_existing_str
  (tainted_fstr_update): new
  (rb_fstring_existing0): new, based on fstring_existing_str
  (rb_tainted_fstring_existing): new, special case for tainted strings
  (rb_str_free): delete from tainted_frozen_strings table
* test/ruby/test_optimization.rb (test_hash_reuse_fstring): new test
  [ruby-core:82012] [Bug #13737]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-18 02:29:59 +00:00
kazu b25b9d4531 Fix indent [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-12 15:02:09 +00:00
ko1 8dd9c12c58 move fields to ec.
* vm_core.h (rb_thread.h): move errinfo and trace_arg to
  rb_execution_context_t.

* cont.c (fiber_switch, rb_cont_call): do not restore "trace_arg" here.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 14:27:49 +00:00
ko1 957d1ccdf9 move fields to ec.
* vm_core.h (rb_thread_t): move root_lep, root_svar and ensure_list
  to rb_execution_context_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 06:09:06 +00:00
ko1 3462dd3609 fix to check thread type
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 04:57:02 +00:00
ko1 249790802d introduce rb_thread_ptr() to replace GetThreadPtr().
* vm_core.h (rb_thread_ptr): added to replace GetThreadPtr() macro.

* thread.c (in some functions: use "target_th" instead of "th" to make clear
  that it is not a current thread.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 04:49:30 +00:00
ko1 d98afe3ae2 move storages to ec.
* vm_core.h (rb_thread_t): move storages to rb_execution_context_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 02:50:56 +00:00
ko1 1939d097e6 move several fields from rb_thread_t to rb_execution_context_t.
* vm_core.h (rb_thread_t): move several fields which are copied at cont.c
  to rb_execution_context_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-26 07:56:44 +00:00
nobu f61e8084bb vm_core.h: sandwich jmpbuf
* vm_core.h (rb_vm_tag): move jmpbuf which should be stored at the
  last in TH_PUSH_TAG, between tag and state so ensure to be
  accessible.  reapplied r40806.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 11:15:26 +00:00
ko1 4a4627fb0d move "state" to rb_vm_tag.
* vm_core.h (rb_thread_t::tag_state): move to "rb_vm_tag::state".
  Lifetime of "state" should be same as current tag.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 09:43:52 +00:00
ko1 a64801c1e9 rename th->state to th->tag_state.
* vm_core.h (rb_thread_t): rename rb_thread_t::state to tag_state
  to make it clear.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 08:48:41 +00:00
ko1 a90c696b8b rb_catch_protect() accepts enum ruby_tag_type *.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 08:24:54 +00:00
ko1 2108e55c0b use "enum ruby_tag_type" and TAG_NONE.
Return value of EXEC_TAG() is saved by "int state".
Instead of "int", use "enum ruby_tag_type". First EXEC_TAG()
value should be 0, so that define TAG_NONE (= 0) and use it.

Some code used "status" instead of "state". To make them clear,
rename them to state.

We can change variable name from "state" to "tag_state", but this
ticket doesn't contain it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 07:25:52 +00:00
ko1 d7e7f051e4 remove OPT_CALL_CFUNC_WITHOUT_FRAME.
* vm_core.h (OPT_CALL_CFUNC_WITHOUT_FRAME): removed because nobody use it.
  This optimization tries to call C-methods without pushing VM frames,
  however no big improvements compare with this complexity.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-14 02:26:18 +00:00
ko1 6c3f1461cd remove ruby_kill() introduced for [Bug #7951].
* thread.c (rbuy_kill): removed. This function is used
  with SIGSEGV, SIGBUS, SIGKILL, SIGILL, SIGFPE and SIGSTOP
  and these signals are affect immediately. So that `kill(2)'
  is enough for them.

* signal.c (rb_f_kill): ditto.

* vm_core.h (rb_thread_t::interrupt_cond): removed because
  only `ruby_kill()' uses this field.

* test/ruby/test_signal.rb: Without this patch sending SIGSTOP to own
  process wait another interrupt even if another process sends SIGCONT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-12 04:52:25 +00:00
ko1 269b795556 vm_block_handler_verify() should not return any value.
* vm_core.h (vm_block_handler_verify): this function only checks
  the given block handler with VM_ASSERT(). No need to return any value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-08 05:22:49 +00:00
ko1 e9c440815e revert r59023 because it contans unrelated developping code
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 07:10:19 +00:00
ko1 b0c9215f72 revert r59020 because it may fail some tests sometimes on some environment (http://ci.rvm.jp/). This revert is to check the reason of failures.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 06:58:54 +00:00
ko1 26864584d2 * vm_core.h: remove VM_FRAME_MAGIC_LAMBDA and introduce
VM_FRAME_FLAG_LAMBDA. So that lambda block frame is
  VM_FRAME_MAGIC_BLOCK | VM_FRAME_FLAG_LAMBDA.

* vm_core.h: remvoe VM_FRAME_MAGIC_PROC because nobody uses it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 10:07:44 +00:00
ko1 9301ef5d0e make Binding object WB protected.
* proc.c (ruby_binding_data_type): set RUBY_TYPED_WB_PROTECTED.
  Insert write barriers (WBs) to all of writes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 15:12:14 +00:00
ko1 478003f6df rename absolute_path to realpath internally and introduce pathobj.
* vm_core.h: rename absolute_path to realpath because it is expected name.
  external APIs (#absolute_path methods) are remained.

* vm_core.h: remove rb_iseq_location_struct::path and
  rb_iseq_location_struct::absolute_path and introduce pathobj.
  if given path equals to given absolute_path (and most of case
  it is true), pathobj is simply given path String. If it is not same,
  pathobj is Array and pathobj[0] is path and pathobj[1] is realpath.

  This size optimization reduce 8 bytes and
  sizeof(struct rb_iseq_constant_body) is 200 bytes -> 192 bytes
  on 64bit CPU.

  To support this change, the following functions are introduced:
    * pathobj_path() (defined in vm_core.h)
    * pathobj_realpath() (ditto)
    * rb_iseq_path() (decl. in vm_core.h)
    * rb_iseq_realpath() (ditto)
    * rb_iseq_pathobj_new() (ditto)
    * rb_iseq_pathobj_set() (ditto)

* vm_core.h (rb_binding_t): use pathobj instead of path. If binding
  is given at eval methods, realpath (absolute_path) was caller's
  realpath. However, they should use binding's realpath.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 00:05:33 +00:00
ko1 492c88dc3b add parameter names.
* vm_core.h: add parameter names for rb_iseq_new*.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 07:05:58 +00:00
normal 508091d9cc speed up IO#close with many threads
Today, it increases IO#close performance with many threads:

  Execution time (sec)
  name            trunk   after
  vm_thread_close 4.276   3.018

  Speedup ratio: compare with the result of `trunk' (greater is better)
  name            after
  vm_thread_close 1.417

This speedup comes because rb_notify_fd_close only scans threads
inside rb_thread_io_blocking_region, not all threads in the VM.

In the future, this type data structure may allow us to notify
waiters of multiple FDs on a single thread (when using
Fibers).

* thread.c (struct waiting_fd): declare
  (rb_thread_io_blocking_region): use on-stack list waiter
  (rb_notify_fd_close): walk vm->waiting_fds instead
  (call_without_gvl): remove old field setting
  (th_init): ditto
* vm_core.h (typedef struct rb_vm_struct): add waiting_fds list
* (typedef struct rb_thread_struct): remove waiting_fd field
  (rb_vm_living_threads_init): initialize waiting_fds list

I am now kicking myself for not thinking about this 3 years ago
when I introduced ccan/list in [Feature #9632] to optimize this
same function :<

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 09:47:14 +00:00
normal 9d09240d9e rb_execution_context_t: move stack, stack_size and cfp from rb_thread_t
The goal is to reduce rb_context_t and rb_fiber_t size
by removing the need to store the entire rb_thread_t in
there.

[ruby-core:81045] Work-in-progress: soon, we will move more fields here.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-09 05:06:41 +00:00