* compile.c (iseq_compile_each0): Use `opt_aref`/`opt_aset` over
`opt_aref_with`/`opt_aset_with` when frozen_string_literal: true,
not to resurrect the index string on non-Hash receiver.
[Fix GH-1957]
From: chopraanmol1 <chopraanmol1@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Revert "Removed old elisp files. New upstream repository was moved https://github.com/ruby/elisp."
This reverts commit 7eedd308b8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
See also ISO9899:1999 section 7.8.1 paragraph 3.
The #ifndef is for C compilers older than C99.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Now that we can say for sure if an instruction calls a method or
not internally, it is now possible to reroute the bugs that
forced us to revert the "move PC around" optimization.
First try: r62051
Reverted: r63763
See also: r63999
----
trunk: ruby 2.6.0dev (2018-09-13 trunk 64736) [x86_64-darwin15]
ours: ruby 2.6.0dev (2018-09-13 trunk 64736) [x86_64-darwin15]
last_commit=move ADD_PC around (take 2)
Calculating -------------------------------------
trunk ours
so_ackermann 1.884 2.278 i/s - 1.000 times in 0.530926s 0.438935s
so_array 1.178 1.157 i/s - 1.000 times in 0.848786s 0.864467s
so_binary_trees 0.176 0.177 i/s - 1.000 times in 5.683895s 5.657707s
so_concatenate 0.220 0.221 i/s - 1.000 times in 4.546896s 4.518949s
so_count_words 6.729 6.470 i/s - 1.000 times in 0.148602s 0.154561s
so_exception 3.324 3.688 i/s - 1.000 times in 0.300872s 0.271147s
so_fannkuch 0.546 0.968 i/s - 1.000 times in 1.831328s 1.033376s
so_fasta 0.541 0.547 i/s - 1.000 times in 1.849923s 1.827091s
so_k_nucleotide 0.800 0.777 i/s - 1.000 times in 1.250635s 1.286295s
so_lists 2.101 1.848 i/s - 1.000 times in 0.475954s 0.541095s
so_mandelbrot 0.435 0.408 i/s - 1.000 times in 2.299328s 2.450535s
so_matrix 1.946 1.912 i/s - 1.000 times in 0.513872s 0.523076s
so_meteor_contest 0.311 0.317 i/s - 1.000 times in 3.219297s 3.152052s
so_nbody 0.746 0.703 i/s - 1.000 times in 1.339815s 1.423441s
so_nested_loop 0.899 0.901 i/s - 1.000 times in 1.111767s 1.109555s
so_nsieve 0.559 0.579 i/s - 1.000 times in 1.787763s 1.726552s
so_nsieve_bits 0.435 0.428 i/s - 1.000 times in 2.296282s 2.333852s
so_object 1.368 1.442 i/s - 1.000 times in 0.731237s 0.693684s
so_partial_sums 0.616 0.546 i/s - 1.000 times in 1.623592s 1.833097s
so_pidigits 0.831 0.832 i/s - 1.000 times in 1.203117s 1.202334s
so_random 2.934 2.724 i/s - 1.000 times in 0.340791s 0.367150s
so_reverse_complement 0.583 0.866 i/s - 1.000 times in 1.714144s 1.154615s
so_sieve 1.829 2.081 i/s - 1.000 times in 0.546607s 0.480562s
so_spectralnorm 0.524 0.558 i/s - 1.000 times in 1.908716s 1.792382s
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
I assume we always prefix rb_ to non-static functions to avoid conflict.
These functions are not exported and safe to be renamed.
iseq.h: ditto
compile.c: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
because cc->call is NULL by default and it is not overridden by
vm_search_super_method if OPT_CALL_FASTPATH is 0. So this macro is not
just a switch for optimization but now it's mandatory.
vm_insnhelper.c: cosmetic change. Use boolean-ish `TRUE` instead of 1 to
specify `enabled` flag.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
On FreeBSD we're going to switch to the GNU-ish version of qsort_r().
POSIX is also considering standardizing that one. To prevent faulty
calls, we have a macro in place to throw a compiler error if a BSD-style
qsort_r() call is performed on a patched system. Such an approach tends
to be permitted by POSIX.
The configure check we have in Ruby would fail if qsort_r() is a
function macro. Add parentheses around it to prevent macro expansion and
force the declaration of a prototype.
[Fix GH-1954]
From: Ed Schouten <ed@nuxi.nl>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This reverts commit r64711, because EXEC_EC_CFP on JIT-ed code does not
call jit_func with the patch when catch_except_p is true. It wasn't intentional.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
../thread.c:1219:18: warning: format specifies type 'unsigned long' but the argument has type 'rb_hrtime_t'
(aka 'unsigned long long') [-Wformat]
end, now);
^~~
../thread.c:1219:23: warning: format specifies type 'unsigned long' but the argument has type 'rb_hrtime_t'
(aka 'unsigned long long') [-Wformat]
end, now);
^~~
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.h (enum node_type): removed unused macros which redefine the
same name enum values, and probably had ended the historical role.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This is mostly cosmetic. Should generate a slightly readable
vm.inc output.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Another thread may be holding th->interrupt_lock while our
current thread calls fork. Therefore we must reinitialize our
own th->interrupt_lock in the child process because the owner
of the lock is only in the parent. The original parent process
is unaffected. We cannot destroy the lock while it has an unknown
state, either, so some implementations can leak a small amount
of memory, here (NPTL won't).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Remove the remainder of ROOT_FIBER_CONTEXT use and unnecessary
differences between the root and non-root fiber. This makes
it easier to follow new root fiber at fork time.
Multiple sources of truth often leads to bugs, as in this case.
We can determinte root fiber by checking a fiber against the root_fiber
of its owner thread. The new `fiber_is_root_p' function
supports that.
Now, we can care only about free-ing/recycling/munmap-ing stacks
as appropriate.
[Bug #15050]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
We can check if the fiber we're interested in is the
th->root_fiber for the owner thread, so there is no need to use
ROOT_FIBER_CONTEXT.
Note: there is no guarantee th->ec points to
&th->root_fiber->cont.saved_ec, thus vm::thread_memsize may not
account for root fiber correctly (pre-existing bug).
[Bug #15050]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Am I missing something, here? Casting was totally unnecessary
and ugly...
[ruby-core:88929]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ec->vm_stack is always allocated with malloc, so stack cache for
root fiber (thread stack) and non-root fibers can be shared as
long as the size is the same. The purpose of this change is to
reduce dependencies on ROOT_FIBER_CONTEXT.
[Feature #15095] [Bug #15050]
v2: vm.c: fix build with USE_THREAD_DATA_RECYCLE==0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* time.c (time_utc_or_local): split into time_s_mkutc and
time_s_mktime without utc flag.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Make sure Enumerator::ArithmeticSequence#each to work well
for a complex step value.
This reverts commit ca47fb329a.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Make sure Enumerator::ArithmeticSequence#each to work well
for a complex step value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
String#freeze can be redefined to be destructive. While such
redefinition is definitely weird, it should be possible. Resurrect
the string to prepare for that sort of things.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Simply use DISPATCH_ORIGINAL_INSN instead of rb_funcall. This is,
when possible, overall performant because method dispatch results are
cached inside of CALL_CACHE. Should also be good for JIT.
----
trunk: ruby 2.6.0dev (2018-09-12 trunk 64689) [x86_64-darwin15]
ours: ruby 2.6.0dev (2018-09-12 leaf-insn 64688) [x86_64-darwin15]
last_commit=make opt_str_freeze leaf
Calculating -------------------------------------
trunk ours
vm2_freezestring 5.440M 31.411M i/s - 6.000M times in 1.102968s 0.191017s
Comparison:
vm2_freezestring
ours: 31410864.5 i/s
trunk: 5439865.4 i/s - 5.77x slower
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This instruction can be written without rb_funcall. It not only boosts
performance of case statements, but also makes room of future JIT
improvements. Because opt_case_dispatch is about optimization this
should not be a bad thing to have.
----
trunk: ruby 2.6.0dev (2018-09-05 trunk 64634) [x86_64-darwin15]
ours: ruby 2.6.0dev (2018-09-12 leaf-insn 64688) [x86_64-darwin15]
last_commit=make opt_case_dispatch leaf
Calculating -------------------------------------
trunk ours
vm2_case_lit 1.366 2.012 i/s - 1.000 times in 0.731839s 0.497008s
Comparison:
vm2_case_lit
ours: 2.0 i/s
trunk: 1.4 i/s - 1.47x slower
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
if and only if it's not moved yet, to avoid potential bugs in the future.
_mjit_compile_send.erb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to raise descriptive KeyError instead of NoMethodError in case these
attrs are accidentally removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rather than `trace_enablable_insns` which is hard to maintain.
This would make performance bad because new branches for tracepoint will
be added.
Optcarrot before:
fps: 56.885371547337655
fps: 60.02493636060194
fps: 63.051028327122076
fps: 63.78463316242535
fps: 64.20391937940403
fps: 64.55990344731123
fps: 64.56771099162921
fps: 64.95991277629723
fps: 65.15120708973232
fps: 65.90558702393933
fps: 66.29579283026303
Optcarrot after:
fps: 52.7647027470875
fps: 53.67404855529564
fps: 58.40514319229468
fps: 60.90736996487708
fps: 62.83487236283472
fps: 63.01386139447994
fps: 63.42395443471596
fps: 63.78328559878602
fps: 64.58432081229746
fps: 64.78720429848532
fps: 65.48720618907552
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
when catch_except_p is false and insn.always_leaf? is true (never makes
arbitrary method call in the insn).
On Optcarrot, unfortunately this didn't have measureable performance impact.
But still this is a good direction since it becomes much faster when
marking all insns as always leaf.
bare_instructions.rb: add `#always_leaf?` that indicates the insn can
always be considered as leaf. Using dynamic leaf for JIT would be hard
since it requires to discard outdated code somehow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
as well, to make CI succeed with VM_CHECK_MODE > 1.
vm_insnhelper.c: drop unnecessary MJIT_HEADER ifdef. This is intended to
be ignored by having `static inline`. Removing that by macro would be
helpful for minimizing compilation time, but the impact is not so big
and having many MJIT_HEADER check would be bad for maintainability.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e