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

1464 Коммитов

Автор SHA1 Сообщение Дата
git aec93417f0 * expand tabs. 2019-08-13 09:50:34 +09:00
Nobuyoshi Nakada 0c2d81dada
Renamed ruby_finalize_{0,1}
And pass rb_execution_context_t as an argument.
2019-08-13 09:47:08 +09:00
Jeremy Evans c1ad6321b0 Adjust documentation for Kernel#raise [ci skip]
Mention how each of the arguments are retrievable from the generated
Exception object.

Fixes [Bug #10110]
2019-07-22 14:02:39 -07:00
Koichi Sasada 1feda1c2b0 constify again.
Same as last commit, make some fields `const`.

include/ruby/ruby.h:
* Rasic::klass
* RArray::heap::aux::shared_root
* RRegexp::src
internal.h:
* rb_classext_struct::origin_, redefined_class
* vm_svar::cref_or_me, lastline, backref, others
* vm_throw_data::throw_obj
* vm_ifunc::data
* MEMO::v1, v2, u3::value

While modifying this patch, I found write-barrier miss on
rb_classext_struct::redefined_class.

Also vm_throw_data::throw_state is only `int` so change the type.
2019-07-22 17:53:10 +09:00
git 9987296b8b * expand tabs. 2019-07-14 17:16:35 +09:00
Yusuke Endoh 934e6b2aeb Prefer `rb_error_arity` to `rb_check_arity` when it can be used 2019-07-14 17:16:19 +09:00
Jeremy Evans f1f04caf60 Include inspect value of object in FrozenError messages
FrozenError#receiver was added recently for getting the related
object programmatically.  However, there are cases where FrozenError
is raised and not handled, and in those cases the resulting error
messages lack detail, which makes debugging the error more difficult,
especially in cases where the error is not easily reproducible.
This includes the inspect value of the frozen object in FrozenError
messages, which should make debugging simpler.
2019-06-04 19:25:03 -07:00
git 5a6c77bbe8 * expand tabs. 2019-05-27 03:10:15 +09:00
Jeremy Evans 39eadca76b Add FrozenError#receiver
Similar to NameError#receiver, this returns the object on which
the modification was attempted.  This is useful as it can pinpoint
exactly what is frozen.  In many cases when a FrozenError is
raised, you cannot determine from the context which object is
frozen that you attempted to modify.

Users of the current rb_error_frozen C function will have to switch
to using rb_error_frozen_object or the new rb_frozen_error_raise
in order to set the receiver of the FrozenError.

To allow the receiver to be set from Ruby, support an optional
second argument to FrozenError#initialize.

Implements [Feature #15751]
2019-05-26 11:09:21 -07:00
ktsj 9738f96fcf Introduce pattern matching [EXPERIMENTAL]
[ruby-core:87945] [Feature #14912]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-17 06:48:03 +00:00
nobu 56557ec28a [DOC] fix markups [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-22 11:04:59 +00:00
nobu ffec546b0e eval.c: clear internal errinfo
* eval.c (ruby_cleanup): clear internal error info when invoking
  end procs.  [ruby-core:91731] [Bug #15650]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-10 06:46:28 +00:00
k0kubun 56bf732aaf mjit.c: use boolean type for boolean variables
and functions to clarify the intention and make sure it's not used in a
surprising way (like using 2, 3, ... other than 0, 1 even while it seems
to be a boolean).

This is a retry of r66775. It included some typos...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10 14:31:18 +00:00
k0kubun efd99b5331 Revert "mjit.c: use boolean type for boolean variables"
This reverts commit bb1a1aeab0.

We hit something on ci.rvm.jp, reverting until investigation is done.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10 13:29:29 +00:00
k0kubun bb1a1aeab0 mjit.c: use boolean type for boolean variables
and functions to clarify the intention and make sure it's not used in a
surprising way (like using 2, 3, ... other than 0, 1 even while it seems
to be a boolean).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10 13:21:58 +00:00
knu e69dbc0961 Document the "cause" keyword argument for raise
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-24 08:11:49 +00:00
nobu d397c89f88 Prohibit circular causes [Bug #15447]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-23 11:11:36 +00:00
nobu c20a1946a6 Restrict cause to an exception object [Bug #15447]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-23 05:49:43 +00:00
k0kubun 98a2b053f8 process.c: avoid dlclose before exec
because JIT-ed code may still be on stack at this time, unlike
in ruby_cleanup().

This hopes to fix: (take 2)
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/1480207

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-26 15:12:31 +00:00
svn cc508b544d * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-05 23:06:58 +00:00
naruse fdcc9c9e43 Don't set throw data as cause [Bug #15282]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-05 23:06:50 +00:00
mame d574683c40 iseq.c: add a map from encoded insn to insn data
This enhances rb_vm_insn_addr2insn which retrieves a decoded insn number
from encoded insn.
The insn data table include not only decoded insn number, but also its
len, trace and non-trace version of encoded insn.
This table can be used to simplify trace instrumentation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-23 08:32:30 +00:00
mame ffb09d8e87 eval.c: rename "rb_frozen_class_p" to "rb_class_modify_check"
Just refactoring.  Despite its name, the function does NOT return a
boolean but raises an exception when the class given is frozen.
I don't think the new name "rb_class_modify_check" is the best, but
it follows the precedeint "rb_ary_modify_check", and is definitely
better than "*_p".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-27 13:57:14 +00:00
nobu 97e05dad7f UNREACHABLE_RETURN
* include/ruby/ruby.h (UNREACHABLE_RETURN): UNREACHABLE at the end
  of non-void functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-24 05:38:07 +00:00
normal 609939f8c6 rb_vm_insn_addr2insn: use st to perform addr2insn mapping
The current VM_INSTRUCTION_SIZE is 198, so the linear search
painful during a major GC phase.

I noticed rb_vm_insn_addr2insn2 showing up at the top of some
profiles while working on some malloc-related stuff, so I
decided to attack it.

Most notably, the benchmark/bm_vm3_gc.rb improves by over 40%:

  https://80x24.org/spew/20180602220554.GA9991@whir/raw

[ruby-core:87361] [Feature #14814]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-06 20:57:48 +00:00
nobu 02c1358be5 share :cause variable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-15 07:45:24 +00:00
normal acbbf8b0ca eval.c (ruby_setup): disable THP on Linux
Transparent Huge Pages (THP) decrease the effectiveness of
CoW-friendly GC because it decreases page granularity.  That is,
a forked process dirtying one bit of CoW-shared memory can
trigger a copy of a huge page (2MB on x86-64) instead of a smaller,
standard page (4K).

* eval.c (ruby_setup): disable THP on Linux
  [ruby-core:86651] [Feature #14705]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-24 20:31:59 +00:00
nobu 49f52937bd vm.c: disable dtrace in jit source
* vm.c: include dummy dtrace probes header in jit header.

* vm_insnhelper.c: probes headers are included by vm.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-20 03:15:33 +00:00
k0kubun fd44a5777f mjit.c: merge MJIT infrastructure
that allows to JIT-compile Ruby methods by generating C code and
using C compiler.  See the first comment of mjit.c to know what this
file does.

mjit.c is authored by Vladimir Makarov <vmakarov@redhat.com>.
After he invented great method JIT infrastructure for MRI as MJIT,
Lars Kanis <lars@greiz-reinsdorf.de> sent the patch to support MinGW
in MJIT. In addition to merging it, I ported pthread to Windows native
threads. Now this MJIT infrastructure can be compiled on Visual Studio.

This commit simplifies mjit.c to decrease code at initial merge. For
example, this commit does not provide multiple JIT threads support.
We can resurrect them later if we really want them, but I wanted to minimize
diff to make it easier to review this patch.

`/tmp/_mjitXXX` file is renamed to `/tmp/_ruby_mjitXXX` because non-Ruby
developers may not know the name "mjit" and the file name should make
sure it's from Ruby and not from some harmful programs.  TODO: it may be
better to store this to some temporary directory which Ruby is already using
by Tempfile, if it's not bad for performance.

mjit.h: New. It has `mjit_exec` interface similar to `vm_exec`, which is
for triggering MJIT. This drops interface for AOT compared to the original
MJIT.

Makefile.in: define macros to let MJIT know the path of MJIT header.
Probably we can refactor this to reduce the number of macros (TODO).
win32/Makefile.sub: ditto.

common.mk: compile mjit.o and mjit_compile.o. Unlike original MJIT, this
commit separates MJIT infrastructure and JIT compiler code as independent
object files. As initial patch is NOT going to have ultra-fast JIT compiler,
it's likely to replace JIT compiler, e.g. original MJIT's compiler or some
future JIT impelementations which are not public now.

inits.c: define MJIT module. This is added because `MJIT.enabled?` was
necessary for testing.
test/lib/zombie_hunter.rb: skip if `MJIT.enabled?`. Obviously this
wouldn't work with current code when JIT is enabled.
test/ruby/test_io.rb: skip this too. This would make no sense with MJIT.

ruby.c: define MJIT CLI options. As major difference from original MJIT,
"-j:l"/"--jit:llvm" are renamed to "--jit-cc" because I want to support
not only gcc/clang but also cl.exe (Visual Studio) in the future. But it
takes only "--jit-cc=gcc", "--jit-cc=clang" for now. And only long "--jit"
options are allowed since some Ruby committers preferred it at Ruby
developers Meeting on January, and some of options are renamed.
This file also triggers to initialize MJIT thread and variables.
eval.c: finalize MJIT worker thread and variables.
test/ruby/test_rubyoptions.rb: fix number of CLI options for --jit.

thread_pthread.c: change for pthread abstraction in MJIT. Prefix rb_ for
functions which are used by other files.
thread_win32.c: ditto, for Windows.  Those pthread porting is one of major
works that YARV-MJIT created, which is my fork of MJIT, in Feature 14235.
thread.c: follow rb_ prefix changes

vm.c: trigger MJIT call on VM invocation. Also trigger `mjit_mark` to avoid
SEGV by race between JIT and GC of ISeq. The improvement was provided by
wanabe <s.wanabe@gmail.com>.
In JIT compiler I created and am going to add in my next commit, I found
that having `mjit_exec` after `vm_loop_start:` is harmful because the
JIT-ed function doesn't proceed other ISeqs on RESTORE_REGS of leave insn.
Executing non-FINISH frame is unexpected for my JIT compiler and
`exception_handler` triggers executions of such ISeqs. So `mjit_exec`
here should be executed only when it directly comes from `vm_exec` call.
`RubyVM::MJIT` module and `.enabled?` method is added so that we can skip
some tests which don't expect JIT threads or compiler file descriptors.

vm_insnhelper.h: trigger MJIT on method calls during VM execution.

vm_core.h: add fields required for mjit.c. `bp` must be `cfp[6]` because
rb_control_frame_struct is likely to be casted to another struct. The
last position is the safest place to add the new field.
vm_insnhelper.c: save initial value of cfp->ep as cfp->bp. This is an
optimization which are done in both MJIT and YARV-MJIT. So this change
is added in this commit. Calculating bp from ep is a little heavy work,
so bp is kind of cache for it.

iseq.c: notify ISeq GC to MJIT. We should know which iseq in MJIT queue
is GCed to avoid SEGV.  TODO: unload some GCed units in some safe way.

gc.c: add hooks so that MJIT can wait GC, and vice versa. Simultaneous
JIT and GC executions may cause SEGV and so we should synchronize them.

cont.c: save continuation information in MJIT worker. As MJIT shouldn't
unload JIT-ed code which is being used, MJIT wants to know full list of
saved execution contexts for continuation and detect ISeqs in use.

mjit_compile.c: added empty JIT compiler so that you can reuse this commit
to build your own JIT compiler. This commit tries to compile ISeqs but
all of them are considered as not supported in this commit. So you can't
use JIT compiler in this commit yet while we added --jit option now.

Patch author: Vladimir Makarov <vmakarov@redhat.com>.

Contributors:
Takashi Kokubun <takashikkbn@gmail.com>.
wanabe <s.wanabe@gmail.com>.
Lars Kanis <lars@greiz-reinsdorf.de>.

Part of Feature 12589 and 14235.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04 06:58:09 +00:00
nobu da01eb93e4 eval.c: get rid of format-zero-length warning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-02 23:25:42 +00:00
nobu 800a5e86cf eval.c: unnecessary argument
* eval.c (rb_interrupt): removed unnecessary convertsion specifier
  and an empty string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-02 15:16:22 +00:00
shyouhei 449cceb8b1 merge extern declarations into internal.h
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-18 09:44:36 +00:00
ko1 c39bdb798d `$SAFE` as a process global state. [Feature #14250]
* vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to
  `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state.

* vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc`
  objects don't need to keep `$SAFE` at the creation.
  Also make `is_from_method` and `is_lambda` as 1 bit fields.

* cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation.

* eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access
  `vm->safe_level_` directly.

* eval_jump.c: End procs `END{}` doesn't keep `$SAFE`.

* proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c.

* safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes.

* safe.c (safe_setter): use `rb_set_safe_level()`.

* thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`.
  It should be obsolete.

* transcode.c (load_transcoder_entry): `rb_safe_level()` only returns
  0 or 1 so that this check is not needed.

* vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc.

* vm.c (rb_proc_create): renamed to `proc_create`.

* vm.c (rb_proc_dup): moved from proc.c.

* vm.c (vm_invoke_proc): do not need to set and restore `$SAFE`
  for `Proc#call`.

* vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer
  meaning.

* lib/drb/drb.rb: restore `$SAFE`.

* lib/erb.rb: restore `$SAFE`, too.

* test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests.

* test/rubygems/test_gem.rb: do not set `$SAFE = 1`.

* bootstraptest/test_proc.rb: catch up this change.

* spec/ruby/optional/capi/string_spec.rb: ditto.

* test/bigdecimal/test_bigdecimal.rb: ditto.

* test/fiddle/test_func.rb: ditto.

* test/fiddle/test_handle.rb: ditto.

* test/net/imap/test_imap_response_parser.rb: ditto.

* test/pathname/test_pathname.rb: ditto.

* test/readline/test_readline.rb: ditto.

* test/ruby/test_file.rb: ditto.

* test/ruby/test_optimization.rb: ditto.

* test/ruby/test_proc.rb: ditto.

* test/ruby/test_require.rb: ditto.

* test/ruby/test_thread.rb: ditto.

* test/rubygems/test_gem_specification.rb: ditto.

* test/test_tempfile.rb: ditto.

* test/test_tmpdir.rb: ditto.

* test/win32ole/test_win32ole.rb: ditto.

* test/win32ole/test_win32ole_event.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 20:09:24 +00:00
ko1 0e34638f79 remove `PUSH_TAG`/`EXEC_AG`/`POP_TAG`/`JUMO_TAG`.
* eval_intern.h: remove non-`EC_` prefix *_TAG() macros.
  Use `EC_` prefix macros explicitly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-06 03:16:08 +00:00
shugo 99d7138743 The superclass of a refinement should have BasicObject as its ancestor.
Otherwise, VM_ASSERT(callable_method_entry_p(cme)) in
prepare_callable_method_entry() fails if VM_CHECK_MODE is 2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-03 00:39:26 +00:00
shugo b2a4cea3b9 Modules should not have subclasses.
When refining a module, the module was set to the superclass of its refinement,
and a segmentation fault occurred.
The superclass of the refinement should be an iclass of the module.
[ruby-core:83617] [Bug #14070]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-02 10:54:39 +00:00
ko1 ea4b535579 remove an unused function.
* eval.c (rb_iterator_p): removed because nobody use it
  and not exposed by headers.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 09:24:48 +00:00
ko1 360b78e4dc `rb_source_loc` -> `rb_source_location_cstr`
* vm.c (rb_source_loc): rename to rb_source_location_cstr()
  to make behavior clear compare with rb_source_location().

* error.c (warning_string): use rb_source_location_cstr() directly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16 05:52:19 +00:00
ko1 f6c102e6a5 th->ec: rb_threadptr_setup_exception
* eval.c (rb_threadptr_setup_exception): renamed to rb_ec_setup_exception().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 06:09:47 +00:00
ko1 48ce4cb414 * eval_intern.h: rename macros rb_thread_raised_* to
rb_ec_raised_*.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 05:22:09 +00:00
ko1 ee189904f0 rename to rb_ec_set_raised().
* thread.c (rb_threadptr_set_raised): rename to rb_ec_set_raised
  and accepts `ec`


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 05:12:39 +00:00
ko1 b6ecdf5fc8 th->ec: rb_threadptr_reset_raised()
* thread.c (rb_threadptr_reset_raised): rename to `rb_ec_reset_raised`
  and accepts `ec`.

* vm_trace.c: the following functions accept `ec` instead of `th`
  * exec_hooks_body
  * exec_hooks_precheck
  * exec_hooks_unprotected
  * exec_hooks_protected


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 04:01:13 +00:00
ko1 5dfdaa9299 move rb_thread_t::interrupt_flag and mask
to rb_execution_context_t.

* vm_core.h (rb_thread_t): move
  `rb_thread_t::interrupt_flag` and
  `rb_thread_t::interrupt_mask` to rb_execution_context_t.

  RUBY_VM_CHECK_INTS() accepts `ec` instead of `th`.

* cont.c (rb_fiber_terminate): to propagate interrupt information,
  add new parameter `need_interrupt`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-06 07:44:28 +00:00
ko1 ac13e92e49 use `GET_EC()`.
* eval.c (rb_block_given_p): use `GET_EC()` directly.

* eval.c (rb_ensure): ditto.

* eval.c (rb_errinfo): ditto.

* eval.c (previous_frame): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 15:13:49 +00:00
ko1 a93c650312 `rb_ec_error_print()`.
* eval_error.c (rb_threadptr_error_print): renamed to
  rb_ec_error_print() and it accepts `ec`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 14:06:58 +00:00
ko1 a288b87c4c EXEC_EVENT_HOOK(ec, ...)
* vm_core.h (EXEC_EVENT_HOOK): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-29 13:19:14 +00:00
ko1 ad1b64d35d `th` -> `ec` for backtrace functions.
* vm_backtrace.c: accept `ec` and rename `threadptr` to `ec`.
  * rb_threadptr_backtrace_object -> rb_ec_backtrace_object
  * rb_threadptr_backtrace_str_ary -> rb_ec_backtrace_str_ar
  * rb_threadptr_backtrace_location_ary -> rb_ec_backtrace_location_ary
  * threadptr_backtrace_to_ary -> ec_backtrace_to_ary

* vm_eval.c (adjust_backtrace_in_eval): accepts `ec`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 13:22:04 +00:00
ko1 b1890fa136 `th` -> `ec` for rb_longjmp() and related functions.
* eval.c: `th` -> `ec` for the following functions:
  * rb_longjmp
  * exc_setup_message
  * setup_exception
  * errinfo_place

* eval.c (get_thread_errinfo): rename to get_ec_errinfo() and accepts `ec`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 11:41:08 +00:00
ko1 9ca5088428 `th` -> `ec` for rb_vm_rewind_cfp.
* vm.c (rb_vm_rewind_cfp): accepts `ec` instead of `th`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-28 10:43:30 +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
nobu 327b22ad77 eval.c: check type
* eval.c (ignored_block): check argument type, which must be
  Module.  [ruby-dev:50270] [Bug #13956]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-30 12:26:23 +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
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 5ba4d948ff eval.c: suppress warnings
* eval.c (exc_setup_message): setup exception message as an
  exception instance, and a cause from a previous exception.
  split from setup_exception to suppress a warning when
  RUBY_USE_SETJMPEX is enabled.

* eval.c (setup_exception): make state volatile to suppress a
  warning too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-02 02:40:29 +00:00
nobu a2fcfba534 eval.c: fix state type
* eval.c (setup_exception): state is a raised thread flag, not for
  EXEC_TAG.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-02 00:54:13 +00:00
kazu 79ee23f01a Fix typos [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-26 00:01:26 +00:00
svn 151c170472 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-22 12:26:20 +00:00
yugui b44a588ea8 Add Doxygen comments
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-22 12:26:19 +00:00
yugui 515ac69f95 Remove dead code
* eval.c (errinfo_setter): dead for 10 years since r13091.
  (rb_rubylevel_errinfo): not used and not exported.
  usually removed or hidden by linker.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-20 11:00:39 +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 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
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
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
nobu d9ea26de88 eval.c: fix exit inside TAG
* eval.c (setup_exception): do not exit by goto inside
  PUSH_TAG/POP_TAG.  it causes an infinite loop.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-18 08:34:40 +00:00
nobu 61ea519dc0 eval.c: copy before cause setup
* eval.c (setup_exception): copy frozen exception before setting
  up a cause not only a backtrace.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-17 02:41:00 +00:00
nobu e601e77590 eval.c: copy special exceptions before raise
* eval.c (setup_exception): consider if the exception is frozen,
  but not one of special exception objects.

* gc.c (rb_memerror): copy minimum objects.

* thread.c (rb_threadptr_execute_interrupts): prepare special
  exception queued by another thread to be raised.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-17 02:31:35 +00:00
nobu 269421084e vm_backtrace.c: backtrace functions per threads
* vm_backtrace.c (rb_threadptr_backtrace_object): rename and
  extern.

* vm_backtrace.c (rb_threadptr_backtrace_str_ary): rename as
  threadptr since the parameter is rb_thread_t*.

* vm_backtrace.c (rb_threadptr_backtrace_location_ary): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-17 01:23:50 +00:00
nobu a0219e2f51 eval.c: share rb_longjmp
* eval.c (rb_longjmp, rb_raise_jump): parameterize thread, and
  share rb_longjmp.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-17 00:25:48 +00:00
nobu 2aaca10505 eval.c: hide internal objects
* eval.c (rb_ensure): veil internal exception objects not to leak
  in ensure functions.  [ruby-core:79371] [Bug #13176]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-03 06:23:34 +00:00
nobu 54fa9f9e13 eval.c: copy special exception
* eval.c (setup_exception): make unfrozen copy of special
  exception before setting up a cause.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-24 14:52:07 +00:00
nobu 1729243bba eval.c: fix circular cause
* eval.c (exc_setup_cause): always set cause of cause to get rid
  of circular references.  [ruby-core:78688] [Bug #13043]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-21 11:12:39 +00:00
shugo 472959f9c2 Add clang volatile fixes from FreeBSD and NetBSD.
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
2016-12-07 23:27:51 +00:00
nobu 7ab8dcebbf error.c: redefined backtrace
* error.c (rb_get_backtrace): honor redefined Exception#backtrace
  method.  [ruby-core:78097] [Bug #12925]

* eval.c (setup_exception): rescue exceptions during backtrace
  setup.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-13 05:25:54 +00:00
nobu d432839cbd error.c: rb_get_backtrace
* error.c (rb_get_backtrace): move from eval_error.c to call
  exc_backtrace directly.  [ruby-core:78097] [Bug #12925]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-13 05:25:53 +00:00
nobu d2101310db include and prepend check no args
* eval.c (rb_mod_include, rb_mod_prepend): check if arguments are
  given, as well as Kernel#extend.  [ruby-dev:49854] [Bug #12887]
  [Fix GH-1470]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-06 05:42:53 +00:00
ktsj 9cbd6ee097 * vm_trace.c (tracepoint_attr_callee_id, rb_tracearg_callee_id):
add TracePoint#callee_id. [ruby-core:77241] [Feature #12747]

* cont.c, eval.c, gc.c, include/ruby/intern.h, insns.def, thread.c,
  vm.c, vm_backtrace.c, vm_core.h, vm_eval.c, vm_insnhelper.c, vm_trace.c: ditto.

* test/ruby/test_settracefunc.rb: tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 13:15:27 +00:00
ktsj 8004ad33bc * eval.c, method.h, proc.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c:
TracePoint#method_id should return method_id, not callee_id.
  [ruby-core:77241] [Feature #12747]

* test/ruby/test_settracefunc.rb: change accordingly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 13:15:26 +00:00
shugo a463ab1f05 * eval.c (rb_mod_refine): refine modules as well.
[ruby-core:76199] [Feature #12534]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-23 11:46:33 +00:00
nobu 646c53895f thread.c: set cause by Thread#raise
* thread.c (rb_threadptr_raise): set cause from the called thread,
  but not from the thread to be interrupted.
  [ruby-core:77222] [Bug #12741]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-09 08:59:48 +00:00
shugo 5fac45dc30 * eval.c (rb_mod_s_used_modules): rename Module.used_refinements to
Module.used_modules.  [Feature #7418] [ruby-core:49805]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08 07:49:02 +00:00
shugo 4a660c72a3 * eval.c (rb_mod_s_used_refinements): new method
Module.used_refinements.  based on the patch by Charlie
  Somerville.  [Feature #7418] [ruby-core:49805]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 16:15:45 +00:00
ko1 03cad83593 * vm_core.h: introduce VM_FRAME_RUBYFRAME_P()
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
2016-08-03 01:50:50 +00:00
nobu c463366dfd rb_funcallv
* *.c: rename rb_funcall2 to rb_funcallv, except for extensions
  which are/will be/may be gems.  [Fix GH-1406]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-29 11:57:14 +00:00
ko1 9f60791a04 * vm_core.h: revisit the structure of frame, block and env.
[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
2016-07-28 11:02:30 +00:00
ko1 be5564a178 * vm_insnhelper.c: introduce rb_vm_pop_frame() and use it
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
2016-07-26 10:28:21 +00:00
nobu 84f94652b0 use TH_JUMP_TAG
* vm_eval.c (rb_eval_cmd, rb_catch_obj): use TH_JUMP_TAG with the
  same rb_thread_t used for TH_PUSH_TAG, instead of JUMP_TAG with
  the current thread global variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-05 03:22:20 +00:00
nobu e0a0c2b802 eval.c: constify
* eval.c (extract_raise_opts): constify argv.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-03 01:22:18 +00:00
nobu e496dfe6db eval.c: reuse VM tag
* eval.c (ruby_cleanup): reuse same VM tag by managing steps.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23 03:23:51 +00:00
nobu 53d5f865e6 eval_error.c: reuse threadptr
* eval_error.c (error_print, error_handle): reuse same threadptr
  by passing as an argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23 03:23:28 +00:00
nobu 7504be10ef remove rb_thread_t::base_block
* 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
2016-03-28 21:40:55 +00:00
nobu 37d6a4dd99 eval_error.c: remove warn_printf
* eval_error.c (warn_printf): remove.

* eval_error.c (error_pos_str): return error position string,
  split from error_pos.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-25 12:36:24 +00:00
nobu e294f4cfdf not overwrite cause
* eval.c (setup_exception): set the cause only if it is explicitly
  given or not set yet.  [Bug #12068]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-14 07:19:23 +00:00
nobu b6b1038c6b eval.c: warn block for using
* eval.c (ignored_block): warn if a block is given to `using`,
  which is probably for `Module.new`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 08:54:18 +00:00
ko1 c267d24ef0 * vm.c (rb_vm_cref_replace_with_duplicated_cref): added.
CREFs should not be shared by methods between `using'.
  [Bug #11247]

* vm_insnhelper.c (vm_cref_replace_with_duplicated_cref): ditto.

* vm.c (vm_cref_dup): should copy refinements correctly.

* eval.c: use rb_vm_cref_replace_with_duplicated_cref().

* eval_intern.h: add a decl. of
  rb_vm_cref_replace_with_duplicated_cref().

* vm_eval.c (eval_string_with_cref): do not need to pass
  scope's CREF because VM can find out CREF from stack frames.

* test/ruby/test_refinement.rb: add a test.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-20 00:17:25 +00:00