Commit graph

80555 commits

Author SHA1 Message Date
Jemma Issroff
ee8299864f
Remove erroneous test_code.rb file 2023-10-24 16:35:07 -03:00
Jemma Issroff
10756f3dea [ruby/prism] Add PostExecutionNode to pm_scope_node_init
88fe6213af
2023-10-24 18:34:36 +00:00
Aaron Patterson
e71f343a99 Addressing feedback 2023-10-24 10:52:06 -07:00
Aaron Patterson
884c3195d9 Update benchmark/vm_ivar_ic_miss.yml
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-10-24 10:52:06 -07:00
Aaron Patterson
dc81432482 updating bindgen 2023-10-24 10:52:06 -07:00
Aaron Patterson
54230dea1b Don't cache on platforms without mmap
We're only going to create a redblack tree on platforms that have mmap
2023-10-24 10:52:06 -07:00
Aaron Patterson
a3f66e09f6 geniv objects can become too complex 2023-10-24 10:52:06 -07:00
Aaron Patterson
caf6a72348 remove IV limit / support complex shapes on classes 2023-10-24 10:52:06 -07:00
Aaron Patterson
27c7531939 increase the maximum number of ivs 2023-10-24 10:52:06 -07:00
Aaron Patterson
84e4453436 Use a functional red-black tree for indexing the shapes
This is an experimental commit that uses a functional red-black tree to
create an index of the ancestor shapes.  It uses an Okasaki style
functional red black tree:

  https://www.cs.tufts.edu/comp/150FP/archive/chris-okasaki/redblack99.pdf

This tree is advantageous because:

* It offers O(n log n) insertions and O(n log n) lookups.
* It shares memory with previous "versions" of the tree

When we insert a node in the tree, only the parts of the tree that need
to be rebalanced are newly allocated.  Parts of the tree that don't need
to be rebalanced are not reallocated, so "new trees" are able to share
memory with old trees.  This is in contrast to a sorted set where we
would have to duplicate the set, and also resort the set on each
insertion.

I've added a new stat to RubyVM.stat so we can understand how the red
black tree increases.
2023-10-24 10:52:06 -07:00
Hiroshi SHIBATA
5c4978c11c [rubygems/rubygems] Handle empty array
7c0afdd9af
2023-10-24 16:31:43 +00:00
Nobuyoshi Nakada
c86c6a84f5 [Bug #19968] Revert RBS revision to test
This reverts the commits for the master branch of RBS:

- commit f717faac63: "Update rbs
  revision to test"

    The target revision to test is in master branch, not for 3.2.x.

- commit 9e93af5329: "Skip RBS
  `RbConfig::TOPDIR` test that is `nil` before installation"

    RbConfig_test.rb is not updated in 3.2.x branch.
2023-10-24 22:59:09 +09:00
dependabot[bot]
c44d65427e Bump ossf/scorecard-action from 2.3.0 to 2.3.1
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](483ef80eb9...0864cf1902)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-23 20:34:33 -07:00
Nobuyoshi Nakada
ccd18d0557
Clean up temporary file, wc.input [ci skip] 2023-10-24 12:30:10 +09:00
Nobuyoshi Nakada
92f29349d5
Use extquote instead of literal tabs [ci skip] 2023-10-24 12:30:09 +09:00
Yusuke Endoh
25c1204fe7 rb_getaddrinfo should return EAI_AGAIN instead of EAGAIN 2023-10-24 12:22:53 +09:00
Yusuke Endoh
c08020254e Indent critical regions with blocks
Cosmetic change per ko1's preference
2023-10-24 12:22:53 +09:00
Yusuke Endoh
acd774263c Do not use pthread on mingw 2023-10-24 12:22:53 +09:00
Yusuke Endoh
16d6a22757 Make rb_getnameinfo interruptible
Same as previous commit for rb_getnameinfo.
2023-10-24 12:22:53 +09:00
Yusuke Endoh
3dc311bdc8 Make rb_getaddrinfo interruptible
When pthread_create is available, rb_getaddrinfo creates a pthread and
executes getaddrinfo(3) in it. The caller thread waits for the pthread
to complete, but detaches it if interrupted. This allows name resolution
to be interuppted by Timeout.timeout, etc. even if it takes a long time
(for example, when the DNS server does not respond).  [Feature #19965]
2023-10-24 12:22:53 +09:00
Yusuke Endoh
efd58f19ea Expand macro branches to make them plain 2023-10-24 12:22:53 +09:00
Yusuke Endoh
25ef8d262a Refactor GETADDRINFO_IMPL instead of GETADDRINFO_EMU
This is a preparation for introducing cancellable
getaddrinfo/getnameinfo.
2023-10-24 12:22:53 +09:00
Yusuke Endoh
9ce607a8d4 refactor a call to getaddrinfo 2023-10-24 12:22:53 +09:00
Samuel Williams
30f5a2bbcd [ruby/io-nonblock] Don't define nonblock methods if they are defined by core.
5d3991859c
2023-10-23 22:53:00 +00:00
Jemma Issroff
39207b496e [PRISM] Implement compilation for PreExecutionNodes 2023-10-23 13:22:55 -07:00
Jemma Issroff
5abff9dbff [PRISM] Add PM_PUTNIL macro 2023-10-23 13:22:55 -07:00
Jemma Issroff
7c4e3ca27b [PRISM] Fix AssocSplat node
This commit emits the correct instructions for hashes which have
both AssocSplat and Assoc nodes contained within them
2023-10-23 13:15:52 -07:00
dearblue
062d6050b0 [rubygems/rubygems] Ignore non-tar format .gem files during search
Previously, `rake install` or `rake update` would fail if there was a non-tar format `.gem` file in the current working directory.

f562788f1d
2023-10-23 19:52:22 +00:00
Jemma Issroff
60196b4780 [PRISM] Fix __LINE__ to be 1-indexed by default 2023-10-23 13:59:48 -03:00
Jemma Issroff
f9e122b3d6 [PRISM] Add several tests 2023-10-23 13:59:48 -03:00
Jemma Issroff
62c674f98c [PRISM] Fix compilation for IfNode, UnlessNode
This properly implements the branch condition for FlipFlopNodes on
If / UnlessNodes, and also fixes the bug in UnlessNodes
2023-10-23 12:37:50 -03:00
Jemma Issroff
296da1a2b8
[PRISM] Add tests for BlockNode, BlockLocalVariableNode, BlockParamet… (#8725)
[PRISM] Add tests for BlockNode, BlockLocalVariableNode, BlockParametersNode
2023-10-23 12:30:38 -03:00
Mau Magnaguagno
f20e91fbf7 [ruby/prism] Avoid String#chars in DedentingHeredoc#to_a
Prefer String#[] directly.

916f991220
2023-10-23 14:56:18 +00:00
Nobuyoshi Nakada
bf93ceb26b
Set date in message to the latest gem date [ci skip] 2023-10-23 23:13:55 +09:00
Nobuyoshi Nakada
ef5717d923
Use outputs instead of outcome with continue-on-error [ci skip]
Suppress exit code annotations.
2023-10-23 23:13:55 +09:00
Benoit Daloze
f82d0ab5d1 [ruby/prism] Exclude comments when only serializing semantic fields
6f4fab362e
2023-10-23 12:50:14 +00:00
Nobuyoshi Nakada
42c2c8caa5
Adjust indent [ci skip] 2023-10-23 19:28:14 +09:00
Nobuyoshi Nakada
839b763119 Use named reference for dyna_push 2023-10-23 17:40:33 +09:00
Nobuyoshi Nakada
7e80f0b5a2 Extract p_in_kwarg to save and update lexer contexts 2023-10-23 17:40:33 +09:00
Nobuyoshi Nakada
428f9f5dc0 Move push_pvtbl and push_pktbl in nterms 2023-10-23 17:40:33 +09:00
Nobuyoshi Nakada
3b05238289 Extract p_assoc and p_in to save lexer contexts 2023-10-23 17:40:33 +09:00
Hiroshi SHIBATA
df5bf5bb59
Removed unnecessary libraries of sync_tool 2023-10-23 17:28:50 +09:00
Hiroshi SHIBATA
9844371c6f
sync_tool is unnecessary now.
We can use https://github.com/ruby/test-unit-ruby-core for testing the default gems.
2023-10-23 17:22:27 +09:00
ydah
e6fcf07a6f Use -H option instead of -h option
Follow up: https://github.com/ruby/lrama/pull/139
2023-10-23 17:04:27 +09:00
Hiroshi SHIBATA
8942c73e6a [rubygems/rubygems] Disabled Style/HashSyntax for keyword arguments
9b61b33568
2023-10-23 07:59:08 +00:00
Jean Boussier
e5364ea496 rb_shape_transition_shape_capa: use optimal sizes transitions
Previously the growth was 3(embed), 6, 12, 24, ...

With this change it's now 3(embed), 8, 16, 32, 64, ... by default.

However, since power of two isn't the best size for all allocators,
if `malloc_usable_size` is vailable, we use it to discover the best
offset.

On Linux/glibc 2.35 for instance, the growth will be 3(embed), 7, 15, 31
to avoid wasting 8B per object.

Test program:

```c

size_t test(size_t slots) {
    size_t allocated = slots * VALUE_SIZE;
    void *test_ptr = malloc(allocated);
    size_t wasted = malloc_usable_size(test_ptr) - allocated;
    free(test_ptr);
    fprintf(stderr, "slots = %lu, wasted_bytes = %lu\n", slots, wasted);
    return wasted;
}

int main(int argc, char *argv[]) {
    size_t best_padding = 0;
    size_t padding = 0;
    for (padding = 0; padding <= 2; padding++) {
        size_t wasted = test(8 - padding);
        if (wasted == 0) {
            best_padding = padding;
            break;
        }
    }

    size_t index = 0;
    fprintf(stderr, "=============== naive ================\n");

    size_t list_size = 4;
    for (index = 0; index < 10; index++) {
        test(list_size);
        list_size *= 2;
    }

    fprintf(stderr, "=============== auto-padded (-%lu) ================\n", best_padding);

    list_size = 4;
    for (index = 0; index < 10; index ++) {
        test(list_size - best_padding);
        list_size *= 2;
    }

    fprintf(stderr, "\n\n");
    return 0;
}
```

```
===== glibc ======
slots = 8, wasted_bytes = 8
slots = 7, wasted_bytes = 0
=============== naive ================
slots = 4, wasted_bytes = 8
slots = 8, wasted_bytes = 8
slots = 16, wasted_bytes = 8
slots = 32, wasted_bytes = 8
slots = 64, wasted_bytes = 8
slots = 128, wasted_bytes = 8
slots = 256, wasted_bytes = 8
slots = 512, wasted_bytes = 8
slots = 1024, wasted_bytes = 8
slots = 2048, wasted_bytes = 8
=============== auto-padded (-1) ================
slots = 3, wasted_bytes = 0
slots = 7, wasted_bytes = 0
slots = 15, wasted_bytes = 0
slots = 31, wasted_bytes = 0
slots = 63, wasted_bytes = 0
slots = 127, wasted_bytes = 0
slots = 255, wasted_bytes = 0
slots = 511, wasted_bytes = 0
slots = 1023, wasted_bytes = 0
slots = 2047, wasted_bytes = 0
```

```
==========  jemalloc =======
slots = 8, wasted_bytes = 0
=============== naive ================
slots = 4, wasted_bytes = 0
slots = 8, wasted_bytes = 0
slots = 16, wasted_bytes = 0
slots = 32, wasted_bytes = 0
slots = 64, wasted_bytes = 0
slots = 128, wasted_bytes = 0
slots = 256, wasted_bytes = 0
slots = 512, wasted_bytes = 0
slots = 1024, wasted_bytes = 0
slots = 2048, wasted_bytes = 0
=============== auto-padded (-0) ================
slots = 4, wasted_bytes = 0
slots = 8, wasted_bytes = 0
slots = 16, wasted_bytes = 0
slots = 32, wasted_bytes = 0
slots = 64, wasted_bytes = 0
slots = 128, wasted_bytes = 0
slots = 256, wasted_bytes = 0
slots = 512, wasted_bytes = 0
slots = 1024, wasted_bytes = 0
slots = 2048, wasted_bytes = 0
```
2023-10-23 09:33:15 +02:00
David Rodríguez
e7d845b1d0
[rubygems/rubygems] Restore using old way of passing Ruby version to resolver
We used `Bundler::RubyVersion.system.gem_version` for a long time, but I
changed this to `Gem.ruby_version` at
94f9643943. It's unclear why I did that
though since I believe it was unrelated to the fix in there.

Bootboot patches `Bundler::RubyVersion` to customize how Bundler works
with Ruby versions, and that change broke that.

Since it's unclear to me how to achieve what Bootboot is doing with the
current code, and there was no strong reason for the change, let's
restore it for now.

8ec36c6017
2023-10-23 13:59:01 +09:00
Martin Emde
6dcd4e90d8
[rubygems/rubygems] Handle base64 encoded checksums in lockfile for future compatibility.
Save checksums using = as separator.

a36ad7d160
2023-10-23 13:59:01 +09:00
Martin Emde
c667de72ff
[rubygems/rubygems] Improve errors and register checksums reliably
Improve error reporting for checksums, raises a new error class.

Solve for multi-source checksum errors.

Add CHECKSUMS to tool/bundler/(dev|standard|rubocop)26_gems.rb

26ceee0e76

Co-authored-by: Samuel Giddins <segiddins@segiddins.me>
2023-10-23 13:59:01 +09:00
Martin Emde
6362bfdc33
[rubygems/rubygems] rename Index#== to Index#subset?
a96a561087
2023-10-23 13:59:01 +09:00