* enumerator.c (lazy_grep_v): add Enumerator::Lazy#grep_v as well
as Enumerable, to enumerate lazily.
[ruby-core:71845] [Feature #11773]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c (name_err_local_variables): new method
NameError#local_variables for internal use only.
[Feature #11777]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[#11776]
* hash.c: ditto
* struct.c: ditto
* test_hash.rb: Add basic test for user defined `dig`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/io/console/test_io_console.rb (test_getpass): separate
master side and slave side in each threads. r52937 deadlocked
on OS X. [Bug #11780] [ruby-dev:49412]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This reverts r16587
("compile.c (iseq_build_body): remove side effect from
VM::InstructionSequence.load."
as that change was obsoleted by r48705 ("mostly fix rb_iseq_load")
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
should be tested. Narrow ensure block. This reverts r52911.
[Bug #11780] [ruby-dev:49412]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52937 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
* ext/date/date_core.c (d_lite_lshift): should check the argument
before negation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
The missing check for Float#=== redefinition was noticed while
working on enhancing optimized case dispatch for nil/true/false
in [ruby-core:71818] https://bugs.ruby-lang.org/issues/11769
So no, I don't normally redefine core classes like this :P
* insns.def (opt_case_dispatch): check Float#=== redefinition
* test/ruby/test_optimization.rb (test_opt_case_dispatch): new
[ruby-core:71920] [Bug #11784]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
If you enable this checker (remove `#' in test/runner.rb),
you can see comparison results between an original iseq disassembed
result and dumped and loaded iseq disassembed result.
There are several bugs around there, because of inexact stack depth
calculation. Now, I leave these bugs because they are not critical
and difficult to solve completely.
* test/runner.rb: require test/lib/iseq_loader_checker.rb but
disabled at default (commented out).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This existing API seems doomed performance-wise, and writing
things in Ruby is nicer anyways. So discourage folks from
using it.
[Feature #11339]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
because apply it multiple times change the sequence.
(iseq != peephole_optimize(load(iseq.to_a)))
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/socket/unixsocket.c (unix_send_io): document args
(unix_recv_io): ditto
* test/socket/test_unix.rb (test_fd_passing_class_mode): added
I was working on these when I encountered the problem in
with BasicSocket.for_fd not handling mode args:
https://bugs.ruby-lang.org/issues/11778
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
call RubyVM::InstructionSequence.translate(iseq) if this method
is defined. If the return value is also an object of
RubyVM::InstructionSequence, then use it instead of created one.
For example, this method is useful to test iseq dumper/loader
such as RubyVM::InstructionSequence#to_a and rb_iseq_load().
Because this method is for such internal experimental usage,
the interface is not matured. For example, this interface has
no extensibility. Two or more translaters can not run
simultaneously.
So that we don't guarantee future compatibility of this method.
Basically, do not use this method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_autoload_str may be safer by preventing premature GC. It
can also be more efficient by passing a pre-frozen string that
can be deduped using rb_fstring. Common autoload callers (e.g.
rubygems, rdoc) already use string literals as the file
argument.
There seems to be no reason to expose rb_autoload_str to the
public C API since autoload is not performance-critical.
Applications may declare autoloads in Ruby code or via
rb_funcall; so merely deprecate rb_autoload without exposing
rb_autoload_str to new users.
Running: valgrind -v ruby -rrdoc -rubygems -e exit
shows a minor memory reduction (32-bit userspace)
before:
in use at exit: 1,600,621 bytes in 28,819 blocks
total heap usage: 55,786 allocs, 26,967 frees, 6,693,790 bytes allocated
after:
in use at exit: 1,599,778 bytes in 28,789 blocks
total heap usage: 55,739 allocs, 26,950 frees, 6,692,973 bytes allocated
* include/ruby/intern.h (rb_autoload): deprecate
* internal.h (rb_autoload_str): declare
* load.c (rb_mod_autoload): use rb_autoload_str
* variable.c (rb_autoload): become compatibility wrapper
(rb_autoload_str): hoisted out from old rb_autoload
[ruby-core:71369] [Feature #11664]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
of binary path info test on Windows because the test had passed
occasionally as the comment said.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/io/console/console.c (console_getpass): print prompt to
stderr when reading from stdin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tool/fake.rb: Fix cross build when srcdir is an absolute path.
* Makefile.in: PREP dependency is needed when cross build too, not
"-r$(arch)-fake" to be used before created. [Fix GH-1125]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/lib/test/unit/assertions.rb (message): fallback when
outputs from different encoding commands mixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (env_str_new, env_path_str_new): make default string
UTF-8 for the case conversion is not possible. [Bug #8822]
* hash.c (get_env_cstr): convert non-ASCII string to UTF-8 string.
* hash.c (ruby_setenv): use wide char version to put environment
variable to deal with non-ASCII value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby_atomic.h (ATOMIC_CAS): old value to be swapped should be
same as the destination. immediate value may need type
promotion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby_atomic.h (ATOMIC_SIZE_CAS): fix the argument order of
InterlockedCompareExchange64. new value and then old value is
the last.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e