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

77002 Коммитов

Автор SHA1 Сообщение Дата
Takashi Kokubun d07d1c7162 RJIT: Upgrade Ubuntu on CI
to upgrade libcapstone on CI
2023-03-18 22:03:45 -07:00
Takashi Kokubun 71bcab4519 RJIT: Implement setclassvariable 2023-03-18 21:49:46 -07:00
Takashi Kokubun 8510f33cc1 RJIT: Implement intern 2023-03-18 21:42:20 -07:00
Takashi Kokubun 4a8de3fa88 RJIT: Fix toregexp 2023-03-18 21:39:24 -07:00
Takashi Kokubun 9c2792c3d3 RJIT: Implement toregexp 2023-03-18 21:37:49 -07:00
Takashi Kokubun d189f8d870 RJIT: Prefix rjit_options with rb_ 2023-03-18 21:28:55 -07:00
Takashi Kokubun 4e440d6990 RJIT: Install libcapstone-dev on CI
for test_assembler.rb to work
2023-03-18 21:26:09 -07:00
Takashi Kokubun 2eefd71e0f RJIT: Implement newrange 2023-03-18 21:24:31 -07:00
Takashi Kokubun 81e19b7d99 RJIT: Implement getglobal 2023-03-18 21:20:58 -07:00
Takashi Kokubun 9f8e914943 RJIT: Implement checkkeyword 2023-03-18 21:15:22 -07:00
Nobuyoshi Nakada 67dd52d59c
[Bug #19539] Match heredoc identifier from end of line
Not to ignore leading spaces in indented heredoc identifier.
2023-03-19 01:35:21 +09:00
tomoya ishida e8e7ff1333 [ruby/reline] Fix: line longer than terminal width breaks rendering
(https://github.com/ruby/reline/pull/516)

https://github.com/ruby/reline/commit/ae5f9b87ab
2023-03-18 14:37:10 +00:00
Peter Zhu cb22d78354 Fix frozen status loss when moving objects
[Bug #19536]

When objects are moved between size pools, their frozen status is lost
in the shape. This will cause the frozen check to be bypassed when there
is an inline cache. For example, the following script should raise a
FrozenError, but doesn't on Ruby 3.2 and master.

    class A
      def add_ivars
        @a = @b = @c = @d = 1
      end

      def set_a
        @a = 10
      end
    end

    a = A.new
    a.add_ivars
    a.freeze

    b = A.new
    b.add_ivars
    b.set_a # Set the inline cache in set_a

    GC.verify_compaction_references(expand_heap: true, toward: :empty)

    a.set_a
2023-03-18 09:07:05 -04:00
Takashi Kokubun dc28ccbb6d RJIT: Implement getspecial insn 2023-03-18 00:00:18 -07:00
Takashi Kokubun 93e05aaa74 RJIT: Implement putspecialobject insn 2023-03-17 23:46:56 -07:00
Josef Haider 2c8f2871a8
Fix handling of 6-byte codepoints in left_adjust_char_head in CESU-8 encoding 2023-03-18 15:43:54 +09:00
Takashi Kokubun 45a17013aa RJIT: Implement throw insn 2023-03-17 23:27:16 -07:00
Takashi Kokubun 39cd74d2a0 RJIT: Use RJIT_STATS on --enable-rjit=dev
RUBY_DEBUG is too slow.
2023-03-17 23:17:26 -07:00
Takashi Kokubun 644c998525 RJIT: Support --rjit-stats on release build as well 2023-03-17 22:31:41 -07:00
Alan Wu b9f411b3a8 YJIT: Simplify using the BITS associated constant
All the integer types have it.
2023-03-17 17:32:06 -04:00
Maxime Chevalier-Boisvert 6ba07df490
YJIT: make type info more specific in gen_fixnum_cmp and gen_opt_mod (#7555) 2023-03-17 16:16:34 -04:00
Alan Wu 7fc796f92a
YJIT: Delete --yjit-global-constant-state (#7559)
It was useful for evaluating 6068da8937
but I think we should remove it now to make the logic around
invalidation more straight forward.
2023-03-17 16:16:17 -04:00
Alan Wu 2a26a5e677 YJIT: Add and use Branch::assert_layout()
This assert would've caught a bug I wrote while developing
ruby/ruby#7443 so I figured it would be good to commit it
as it could be helpful in the future.
2023-03-17 16:15:58 -04:00
Jimmy Miller 5d0a1ffafa
YJIT: Rest and block_arg support (#7557)
* YJIT: Rest and block_arg support

* Update bootstraptest/test_yjit.rb

---------

Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
2023-03-17 16:11:30 -04:00
git 2d97f87407 * remove trailing spaces. [ci skip] 2023-03-17 20:04:58 +00:00
Matt Valentine-House c7862c68eb [ci skip] Move rp helper to new LLDB format
For now, the old function still exists as `old_rp`, in order to debug
issues with this command.
2023-03-17 20:04:43 +00:00
git cc68d692f8 * remove trailing spaces. [ci skip] 2023-03-17 19:20:53 +00:00
Matt Valentine-House 5897a6f686 Update Makefile dependencies 2023-03-17 19:20:40 +00:00
Matt Valentine-House 4f5e29f930 Document the declarative marking api 2023-03-17 19:20:40 +00:00
Matt Valentine-House 22b349294b Implement declarative references for enumerator 2023-03-17 19:20:40 +00:00
Matt Valentine-House 405966e239 Implement declarative references for dir_data_type 2023-03-17 19:20:40 +00:00
Matt Valentine-House 7142328a94 [Feature #19406] Allow declarative definition of references
When using rb_data_type_struct to wrap a C struct, that C struct can
contain VALUE references to other Ruby objects.

If this is the case then one must also define dmark and optionally
dcompact callbacks in order to allow these objects to be correctly
handled by the GC. This is suboptimal as it requires GC related logic to
be implemented by extension developers. This can be a cause of subtle
bugs when references are not marked of updated correctly inside these
callbacks.

This commit provides an alternative approach, useful in the simple case
where the C struct contains VALUE members (ie. there isn't any
conditional logic, or data structure manipulation required to traverse
these references).

In this case references can be defined using a declarative syntax
as a list of edges (or, pointers to references).

A flag can be set on the rb_data_type_struct to notify the GC that
declarative references are being used, and a list of those references
can be assigned to the dmark pointer instead of a function callback, on
the rb_data_type_struct.

Macros are also provided for simple declaration of the reference list,
and building edges.

To avoid having to also find space in the struct to define a length for
the references list, I've chosed to always terminate the references list
with RUBY_REF_END - defined as UINTPTR_MAX. My assumption is that no
single struct will ever be large enough that UINTPTR_MAX is actually a
valid reference.
2023-03-17 19:20:40 +00:00
Takashi Kokubun 9fd94d6a0c
YJIT: Support entry for multiple PCs per ISEQ (GH-7535) 2023-03-17 11:53:17 -07:00
Jean Boussier 3592b24cdc ObjectSpace::WeakMap: clean inverse reference when an entry is re-assigned
[Bug #19531]

```ruby
wmap[1] = "A"
wmap[1] = "B"
```

In the example above, we need to remove the `"A" => 1` inverse reference
so that when `"A"` is GCed the `1` key isn't deleted.
2023-03-17 17:50:08 +00:00
Nobuyoshi Nakada ccd2dbc4c1 core_assertions.rb: Relax `assert_linear_performance`
* Use an `Enumerable` as factors, instead of three arguments.

* Include `assert_operator` time in rehearsal time.

* Round up max expected time.
2023-03-18 02:41:02 +09:00
Alan Wu 10e4fa3a0f YJIT: Use raw pointers and shared references over `Rc<RefCell<_>>`
`Rc` and `RefCell` both incur runtime space costs.
In addition, `RefCell` has given us some headaches with the
non obvious borrow panics it likes to throw out. The latest
one started with 7fd53eeb46
and is yet to be resolved.

Since we already rely on the GC to properly reclaim memory for `Block`
and `Branch`, we might as well stop paying the overhead of `Rc` and
`RefCell`. The `RefCell` panics go away with this change, too.

On 25 iterations of `railsbench` with a stats build I got
`yjit_alloc_size: 8,386,129 => 7,348,637`, with the new memory size 87.6%
of the status quo. This makes the metadata and machine code size roughly
line up one-to-one.

The general idea here is to use `&` shared references with
[interior mutability][1] with `Cell`, which doesn't take any extra
space. The `noalias` requirement that `&mut` imposes is way too hard to
meet and verify. Imagine replacing places where we would've gotten
`BorrowError` from `RefCell` with Rust/LLVM miscompiling us due to aliasing
violations. With shared references, we don't have to think about subtle
cases like the GC _sometimes_ calling the mark callback while codegen
has an aliasing reference in a stack frame below. We mostly only need to
worry about liveness, with which the GC already helps.

There is now a clean split between blocks and branches that are not yet
fully constructed and ones that are "in-service", so to speak. Working
with `PendingBranch` and `JITState` don't really involve `unsafe` stuff.
This change allows `Branch` and `Block` to not have as many optional
fields as many of them are only optional during compilation. Fields that
change post-compilation are wrapped in `Cell` to facilitate mutation
through shared references.

I do some `unsafe` dances here. I've included just a couple tests to run
with Miri (`cargo +nightly miri test miri`). We can add more Miri tests
if desired.

[1]: https://doc.rust-lang.org/std/cell/struct.UnsafeCell.html
2023-03-17 09:30:24 -07:00
Takashi Kokubun c62cf60d18 Skip a flaky test that might not work 2023-03-17 09:06:52 -07:00
lukeg 418cf344fb [ruby/irb] Fix 2 minor issues in test suite
* undefine Kernel#irb_original_require in without_rdoc method
* Don't rescue all LoadErrors/NameErrors in test_rendering.rb, just
the one for require 'yamatanooroti'

https://github.com/ruby/irb/commit/52b79806ea
2023-03-17 15:19:40 +00:00
Peter Zhu a206ee6709 Assume that FL_FINALIZE is in finalizer_table
If the flag FL_FINALIZE is set, then it's guaranteed to be in the
finalizer_table, so we can directly assume that without checking.
2023-03-17 11:12:45 -04:00
Mau Magnaguagno 11f299fab7
YJIT: skip intermediate arrays in print_sorted_exit_counts (#7547)
Early total_exits condition.
Replace Array#sort_by/first(how_many) with Array#max_by(how_many).
Replace Array#map/max with Array#max_by, match print_counters style for longest_name_length.
2023-03-17 10:29:42 -04:00
David Rodríguez c65d7b4bea When running `bundle lock --update <name>`, checkout locked revision of unrelated git sources directly
Since Bundler 2.4, we will try to checkout any branch specified in the
Gemfile, while until Bundler 2.3 we would directly checkout the locked
revision.

This should not make any difference in most situations, but in some edge
cases, like if the branch specified in the `Gemfile` has been renamed,
but the locked revision still exist, it causes an error now while before
it would update the lockfile without issues.

I debated which behavior was best, since I was not sure. But my
conclusion is that if the situation does not require expiring the
lockfile source in favor of the Gemfile source, we should use the locked
revision directly and proceed happily. So I restored Bundler 2.3
behavior.

I think this is consistent with how yanked gems are handled, for example.

Of course, if explicitly updating the git source itself, or all gems, we
will still get any errors like missing branches related to the git source.
2023-03-17 18:50:55 +09:00
David Rodríguez 0b9e51c429 Don´t consider platform specific candidates when `force_ruby_platform` set
This was working fine for direct dependencies using
`force_ruby_platform` explicitly through Gemfile, but not for indirect
dependencies. In general, indirect dependencies do not have this
property set, but in truffleruby this is different and the default value
is to have it set.
2023-03-17 18:50:55 +09:00
David Rodríguez 12f0be14e2 Don't ignore pre-releases when there's only one candidate
This should be a very rare edge case, however, it does happen when using
a .dev version of Bundler because in that case, that's the only version
that the resolver considers, and it should not be ignored.

We could've special cased this specifically for Bundler, but I think it
does make sense for every gem.
2023-03-17 18:50:55 +09:00
David Rodríguez ddc4fd5644 Normalize git sources
Just like gem sources, a "style-only" change, like adding a trailing
slash, should not expire them.
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 7800d4eeb5 util/rubocop -A --only Style/MultipleComparison 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA f8fe151ca9 util/rubocop -A --only Style/TernaryParentheses 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 31c572f4fa util/rubocop -A --only Style/SymbolArray 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 1ca67f13cd util/rubocop -A --only Style/RedundantSelf 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 5211900d37 util/rubocop -A --only Style/SymbolProc 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA b304cf324a util/rubocop -A --only Layout/ParameterAlignment 2023-03-17 18:50:55 +09:00