Age | Commit message (Collapse) | Author |
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4913
|
|
`RubyVM.keep_script_lines` enables to keep script lines
for each ISeq and AST. This feature is for debugger/REPL
support.
```ruby
RubyVM.keep_script_lines = true
RubyVM::keep_script_lines = true
eval("def foo = nil\ndef bar = nil")
pp RubyVM::InstructionSequence.of(method(:foo)).script_lines
```
Notes:
Merged: https://github.com/ruby/ruby/pull/4913
|
|
Most of these are vestiges of our old setup where we hack into the
interpreter loop.
|
|
This change fixes some cases where YJIT fails to fire tracing events.
Most of the situations YJIT did not handle correctly involves enabling
tracing while running inside generated code.
A new operation to invalidate all generated code is added, which uses
patching to make generated code exit at the next VM instruction
boundary. A new routine called `jit_prepare_routine_call()` is
introduced to facilitate this and should be used when generating code
that could allocate, or could otherwise use `RB_VM_LOCK_ENTER()`.
The `c_return` event is fired in the middle of an instruction as opposed
to at an instruction boundary, so it requires special handling. C method
call return points are patched to go to a fucntion which does everything
the interpreter does, including firing the `c_return` event. The
generated code for C method calls normally does not fire the event.
Invalided code should not change after patching so the exits are not
clobbered. A new variable is introduced to track the region of code that
should not change.
|
|
Clear out any JIT code on iseqs when tracepoints get enabled. We can't
handle tracepoints right now, so we'll just try to recompile later.
|
|
Renaming uJIT to YJIT. AKA s/ujit/yjit/g.
|
|
|
|
* Tie lifetime of uJIT blocks to iseqs
Blocks weren't being freed when iseqs are collected.
* Add rb_dary. Use it for method dependency table
* Keep track of blocks per iseq
Remove global version_tbl
* Block version bookkeeping fix
* dary -> darray
* free ujit_blocks
* comment about size of ujit_blocks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Insert generated addresses into st_table for mapping native code
addresses back to info about VM instructions. Export `encoded_insn_data`
to do this. Also some style fixes.
|
|
|
|
|
|
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4925
Merged-By: nobu <nobu@ruby-lang.org>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4791
|
|
In vm_call_method_each_type, check for c_call and c_return events before
dispatching to vm_call_ivar and vm_call_attrset. With this approach, the
call cache will still dispatch directly to those functions, so this
change will only decrease performance for the first (uncached) call, and
even then, the performance decrease is very minimal.
This approach requires that we clear the call caches when tracing is
enabled or disabled. The approach currently switches all vm_call_ivar
and vm_call_attrset call caches to vm_call_general any time tracing is
enabled or disabled. So it could theoretically result in a slowdown for
code that constantly enables or disables tracing.
This approach does not handle targeted tracepoints, but from my testing,
c_call and c_return events are not supported for targeted tracepoints,
so that shouldn't matter.
This includes a benchmark showing the performance decrease is minimal
if detectable at all.
Fixes [Bug #16383]
Fixes [Bug #10470]
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Notes:
Merged: https://github.com/ruby/ruby/pull/4767
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4705
|
|
This changes Thread::Location::Backtrace#absolute_path to return
nil for methods/procs defined in eval. If the realpath of an iseq
is nil, that indicates it was defined in eval, in which case you
cannot use RubyVM::AbstractSyntaxTree.of.
Fixes [Bug #16983]
Co-authored-by: Koichi Sasada <ko1@atdot.net>
Notes:
Merged: https://github.com/ruby/ruby/pull/4519
|
|
This broke coverage CI
```
1) Failure:
TestRequire#test_load_syntax_error [/home/runner/work/actions/actions/ruby/test/ruby/test_require.rb:228]:
Exception(SyntaxError) with message matches to /unexpected/.
[SyntaxError] exception expected, not #<TypeError: no implicit conversion of false into Integer>.
```
https://github.com/ruby/actions/runs/2914743968?check_suite_focus=true
|
|
... which is formally called EXPERIMENTAL_ISEQ_NODE_ID.
See also ff69ef27b06eed1ba750e7d9cab8322f351ed245.
https://bugs.ruby-lang.org/issues/17930
Notes:
Merged: https://github.com/ruby/ruby/pull/4558
|
|
RubyVM::AST.of(Thread::Backtrace::Location) returns a node that
corresponds to the location. Typically, the node is a method call, but
not always.
This change also includes iseq's dump/load support of node_ids for each
instructions.
Notes:
Merged: https://github.com/ruby/ruby/pull/4558
|
|
by merging `rb_ast_body_t#line_count` and `#script_lines`.
Fortunately `line_count == RARRAY_LEN(script_lines)` was always
satisfied. When script_lines is saved, it has an array of lines, and
when not saved, it has a Fixnum that represents the old line_count.
Notes:
Merged: https://github.com/ruby/ruby/pull/4581
|
|
It's been a way too much amount of ifdefs.
|
|
... then, new_insn_core extracts nd_line(node).
Also, if a macro "EXPERIMENTAL_ISEQ_NODE_ID" is defined, this changeset
keeps nd_node_id(node) for each instruction. This is intended for
TypeProf to identify what AST::Node corresponds to each instruction.
This patch is originally authored by @yui-knk for showing which column a
NoMethodError occurred.
https://github.com/ruby/ruby/compare/master...yui-knk:feature/node_id
Co-Authored-By: Yuichiro Kaneko <yui-knk@ruby-lang.org>
Notes:
Merged: https://github.com/ruby/ruby/pull/4470
|
|
We can take advantage of fstrings to de-duplicate the defined strings.
This means we don't need to keep the list of defined strings on the VM
(or register them as mark objects)
Notes:
Merged: https://github.com/ruby/ruby/pull/4279
|
|
We can know the string used for "defined" calls at compile time, then
store the string in the instruction sequences
Notes:
Merged: https://github.com/ruby/ruby/pull/4279
|
|
if cc is invalidated, cc should be released from iseq.
Notes:
Merged: https://github.com/ruby/ruby/pull/4030
|
|
constant cache `IC` is accessed by non-atomic manner and there are
thread-safety issues, so Ruby 3.0 disables to use const cache on
non-main ractors.
This patch enables it by introducing `imemo_constcache` and allocates
it by every re-fill of const cache like `imemo_callcache`.
[Bug #17510]
Now `IC` only has one entry `IC::entry` and it points to
`iseq_inline_constant_cache_entry`, managed by T_IMEMO object.
`IC` is atomic data structure so `rb_mjit_before_vm_ic_update()` and
`rb_mjit_after_vm_ic_update()` is not needed.
Notes:
Merged: https://github.com/ruby/ruby/pull/4022
|
|
This switches the internal function from rb_parser_compile_file_path
to rb_parser_load_file, which is the same internal method that
Kernel#load uses.
Fixes [Bug #17308]
Notes:
Merged: https://github.com/ruby/ruby/pull/3788
|
|
If two or more tracepoints enabled with the same target and with
different target lines, the only last line is activated.
This patch fixes this issue by remaining existing trace instructions.
[Bug #17302]
Notes:
Merged: https://github.com/ruby/ruby/pull/3770
|
|
|
|
Isolated Proc prohibit to access outer local variables, but it was
violated by binding and so on, so they should be error.
Notes:
Merged: https://github.com/ruby/ruby/pull/3721
|
|
|
|
iv_index_tbl manages instance variable indexes (ID -> index).
This data structure should be synchronized with other ractors
so introduce some VM locks.
This patch also introduced atomic ivar cache used by
set/getinlinecache instructions. To make updating ivar cache (IVC),
we changed iv_index_tbl data structure to manage (ID -> entry)
and an entry points serial and index. IVC points to this entry so
that cache update becomes atomically.
Notes:
Merged: https://github.com/ruby/ruby/pull/3662
|
|
This was introduced in 191ce5344ec42c91571f8f47c85be9138262b1c7
and has been unused since beae6cbf0fd8b6619e5212552de98022d4c4d4d4
Notes:
Merged: https://github.com/ruby/ruby/pull/3353
|
|
Use ID instead of GENTRY for gvars.
Global variables are compiled into GENTRY (a pointer to struct
rb_global_entry). This patch replace this GENTRY to ID and
make the code simple.
We need to search GENTRY from ID every time (st_lookup), so
additional overhead will be introduced.
However, the performance of accessing global variables is not
important now a day and this simplicity helps Ractor development.
Notes:
Merged-By: ko1 <ko1@atdot.net>
|
|
If :return event is specified for a opt_invokebuiltin_delegate_leave
and leave combination, the instructions should be
opt_invokebuiltin_delegate
trace_return
instructions. To make it, opt_invokebuiltin_delegate_leave
instruction will be changed to opt_invokebuiltin_delegate even if
it is not an event target instruction.
Notes:
Merged-By: ko1 <ko1@atdot.net>
|
|
|
|
|
|
using opt_invokebuiltin_delegate_leave insn.
Since Ruby 2.7, :return of methods using builtin have not been traced properly.
|
|
|
|
CIs are created on-the-fly, which increases GC pressure. However they
include no references to other objects, and those on-the-fly CIs tend to
be short lived. Why not skip allocation of them. In doing so we need
to add a flag denotes the CI object does not reside inside of objspace.
Notes:
Merged: https://github.com/ruby/ruby/pull/3179
|