Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into Ractor-Local-GC-v…
Browse files Browse the repository at this point in the history
…ersion-1
  • Loading branch information
rm155 committed Nov 7, 2023
2 parents e29aa85 + 8ac6b2e commit 3a5ca28
Show file tree
Hide file tree
Showing 56 changed files with 1,125 additions and 396 deletions.
35 changes: 31 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,51 @@ The following default gem is added.
The following default gems are updated.

* RubyGems 3.5.0.dev
* benchmark 0.3.0
* bigdecimal 3.1.5
* bundler 2.5.0.dev
* csv 3.2.8
* date 3.3.4
* delegate 0.3.1
* erb 4.0.3
* etc 1.4.3.dev.1
* fiddle 1.1.2
* fileutils 1.7.1
* find 0.2.0
* getoptlong 0.2.1
* io-console 0.6.1.dev
* irb 1.8.3
* logger 1.6.0
* mutex_m 0.2.0
* net-http 0.4.0
* net-protocol 0.2.2
* nkf 0.1.3
* observer 0.1.2
* open3 0.2.0
* openssl 3.2.0
* optparse 0.4.0.pre.1
* optparse 0.4.0
* pp 0.5.0
* prettyprint 0.2.0
* pstore 0.1.3
* psych 5.1.1.1
* rdoc 6.6.0
* reline 0.3.9
* rinda 0.2.0
* securerandom 0.3.0
* shellwords 0.2.0
* singleton 0.2.0
* stringio 3.0.9
* strscan 3.0.7
* syntax_suggest 1.1.0
* time 0.2.2
* timeout 0.4.0
* uri 0.12.2
* tempfile 0.2.0
* time 0.3.0
* timeout 0.4.1
* tmpdir 0.2.0
* tsort 0.2.0
* un 0.3.0
* uri 0.13.0
* weakref 0.1.3
* yaml 0.3.0

The following bundled gem is promoted from default gems.

Expand Down Expand Up @@ -171,6 +196,7 @@ changelog for details of the default gems or bundled gems.
## Implementation improvements

* `defined?(@ivar)` is optimized with Object Shapes.
* Name resolution such as `Socket.getaddrinfo` can now be interrupted. [[Feature #19965]]

### YJIT

Expand Down Expand Up @@ -235,3 +261,4 @@ changelog for details of the default gems or bundled gems.
[Feature #19785]: https://bugs.ruby-lang.org/issues/19785
[Feature #19843]: https://bugs.ruby-lang.org/issues/19843
[Bug #19868]: https://bugs.ruby-lang.org/issues/19868
[Feature #19965]: https://bugs.ruby-lang.org/issues/19965
6 changes: 1 addition & 5 deletions compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5275,7 +5275,6 @@ compile_massign0(rb_iseq_t *iseq, LINK_ANCHOR *const pre, LINK_ANCHOR *const rhs

int llen = 0;
int lpos = 0;
int expand = 1;

while (lhsn_count) {
llen++;
Expand Down Expand Up @@ -5313,17 +5312,14 @@ compile_massign0(rb_iseq_t *iseq, LINK_ANCHOR *const pre, LINK_ANCHOR *const rhs
}
}


if (!state->nested) {
NO_CHECK(COMPILE(rhs, "normal masgn rhs", rhsn));
}

if (!popped) {
ADD_INSN(rhs, node, dup);
}
if (expand) {
ADD_INSN2(rhs, node, expandarray, INT2FIX(llen), INT2FIX(lhs_splat));
}
ADD_INSN2(rhs, node, expandarray, INT2FIX(llen), INT2FIX(lhs_splat));
return COMPILE_OK;
}

Expand Down
4 changes: 4 additions & 0 deletions doc/contributing/building_ruby.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@
If you are having unexplainable build errors, after saving all your work, try running `git clean -xfd` in the source root to remove all git ignored local files. If you are working from a source directory that's been updated several times, you may have temporary build artifacts from previous releases which can cause build failures.

## Building on Windows

The documentation for building on Windows can be found [here](../windows.md).

## More details

If you're interested in continuing development on Ruby, here are more details
Expand Down
108 changes: 108 additions & 0 deletions doc/reline/face.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Face

With the `Reline::Face` class, you can modify the text color and text decorations in your terminal emulator.
This is primarily used to customize the appearance of the method completion dialog in IRB.

## Usage

### ex: Change the background color of the completion dialog cyan to blue

```ruby
Reline::Face.config(:completion_dialog) do |conf|
conf.define :default, foreground: :white, background: :blue
# ^^^^^ `:cyan` by default
conf.define :enhanced, foreground: :white, background: :magenta
conf.define :scrollbar, foreground: :white, background: :blue
end
```

If you provide the above code to an IRB session in some way, you can apply the configuration.
It's generally done by writing it in `.irbrc`.

Regarding `.irbrc`, please refer to the following link: [https://docs.ruby-lang.org/en/master/IRB.html](https://docs.ruby-lang.org/en/master/IRB.html)

## Available parameters

`Reline::Face` internally creates SGR (Select Graphic Rendition) code according to the block parameter of `Reline::Face.config` method.

| Key | Value | SGR Code (numeric part following "\e[")|
|:------------|:------------------|-----:|
| :foreground | :black | 30 |
| | :red | 31 |
| | :green | 32 |
| | :yellow | 33 |
| | :blue | 34 |
| | :magenta | 35 |
| | :cyan | 36 |
| | :white | 37 |
| | :bright_black | 90 |
| | :gray | 90 |
| | :bright_red | 91 |
| | :bright_green | 92 |
| | :bright_yellow | 93 |
| | :bright_blue | 94 |
| | :bright_magenta | 95 |
| | :bright_cyan | 96 |
| | :bright_white | 97 |
| :background | :black | 40 |
| | :red | 41 |
| | :green | 42 |
| | :yellow | 43 |
| | :blue | 44 |
| | :magenta | 45 |
| | :cyan | 46 |
| | :white | 47 |
| | :bright_black | 100 |
| | :gray | 100 |
| | :bright_red | 101 |
| | :bright_green | 102 |
| | :bright_yellow | 103 |
| | :bright_blue | 104 |
| | :bright_magenta | 105 |
| | :bright_cyan | 106 |
| | :bright_white | 107 |
| :style | :reset | 0 |
| | :bold | 1 |
| | :faint | 2 |
| | :italicized | 3 |
| | :underlined | 4 |
| | :slowly_blinking | 5 |
| | :blinking | 5 |
| | :rapidly_blinking | 6 |
| | :negative | 7 |
| | :concealed | 8 |
| | :crossed_out | 9 |

- The value for `:style` can be both a Symbol and an Array
```ruby
# Single symbol
conf.define :default, style: :bold
# Array
conf.define :default, style: [:bold, :negative]
```
- The availability of specific SGR codes depends on your terminal emulator
- You can specify a hex color code to `:foreground` and `:background` color like `foreground: "#FF1020"`. Its availability also depends on your terminal emulator

## Debugging

You can see the current Face configuration by `Reline::Face.configs` method

Example:

```ruby
irb(main):001:0> Reline::Face.configs
=>
{:default=>
{:default=>{:style=>:reset, :escape_sequence=>"\e[0m"},
:enhanced=>{:style=>:reset, :escape_sequence=>"\e[0m"},
:scrollbar=>{:style=>:reset, :escape_sequence=>"\e[0m"}},
:completion_dialog=>
{:default=>{:foreground=>:white, :background=>:cyan, :escape_sequence=>"\e[0m\e[37;46m"},
:enhanced=>{:foreground=>:white, :background=>:magenta, :escape_sequence=>"\e[0m\e[37;45m"},
:scrollbar=>{:foreground=>:white, :background=>:cyan, :escape_sequence=>"\e[0m\e[37;46m"}}}
```

## Backlog

- Support for 256-color terminal emulator. Fallback hex color code such as "#FF1020" to 256 colors

2 changes: 1 addition & 1 deletion ext/date/lib/date.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'date_core'

class Date
VERSION = "3.3.3" # :nodoc:
VERSION = "3.3.4" # :nodoc:

# call-seq:
# infinite? -> false
Expand Down
2 changes: 1 addition & 1 deletion ext/socket/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def %(s) s || self end

have_func("pthread_create")
have_func("pthread_detach")
have_func("pthread_setaffinity_np")
have_func("pthread_attr_setaffinity_np")
have_func("sched_getcpu")

$VPATH << '$(topdir)' << '$(top_srcdir)'
Expand Down
49 changes: 31 additions & 18 deletions ext/socket/raddrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,23 +475,28 @@ rb_getaddrinfo(const char *hostp, const char *portp, const struct addrinfo *hint
return EAI_MEMORY;
}

pthread_t th;
if (pthread_create(&th, 0, do_getaddrinfo, arg) != 0) {
pthread_attr_t attr;
if (pthread_attr_init(&attr) != 0) {
free_getaddrinfo_arg(arg);
return EAI_AGAIN;
}

pthread_detach(th);
#if defined(__s390__) || defined(__s390x__) || defined(__zarch__) || defined(__SYSC_ZARCH__)
# define S390X
#endif
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU) && !defined(S390X)
#if defined(HAVE_PTHREAD_ATTR_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU)
cpu_set_t tmp_cpu_set;
CPU_ZERO(&tmp_cpu_set);
CPU_SET(sched_getcpu(), &tmp_cpu_set);
pthread_setaffinity_np(th, sizeof(cpu_set_t), &tmp_cpu_set);
int cpu = sched_getcpu();
if (cpu < CPU_SETSIZE) {
CPU_SET(cpu, &tmp_cpu_set);
pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &tmp_cpu_set);
}
#endif

pthread_t th;
if (pthread_create(&th, &attr, do_getaddrinfo, arg) != 0) {
free_getaddrinfo_arg(arg);
return EAI_AGAIN;
}
pthread_detach(th);

rb_thread_call_without_gvl2(wait_getaddrinfo, arg, cancel_getaddrinfo, arg);

int need_free = 0;
Expand Down Expand Up @@ -686,7 +691,7 @@ rb_getnameinfo(const struct sockaddr *sa, socklen_t salen,
char *serv, size_t servlen, int flags)
{
int retry;
struct getnameinfo_arg *arg = allocate_getnameinfo_arg(sa, salen, hostlen, servlen, flags);
struct getnameinfo_arg *arg;
int err;

start:
Expand All @@ -697,20 +702,28 @@ rb_getnameinfo(const struct sockaddr *sa, socklen_t salen,
return EAI_MEMORY;
}

pthread_t th;
if (pthread_create(&th, 0, do_getnameinfo, arg) != 0) {
pthread_attr_t attr;
if (pthread_attr_init(&attr) != 0) {
free_getnameinfo_arg(arg);
return EAI_AGAIN;
}

pthread_detach(th);
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU) && !defined(S390X)
#if defined(HAVE_PTHREAD_ATTR_SETAFFINITY_NP) && defined(HAVE_SCHED_GETCPU)
cpu_set_t tmp_cpu_set;
CPU_ZERO(&tmp_cpu_set);
CPU_SET(sched_getcpu(), &tmp_cpu_set);
pthread_setaffinity_np(th, sizeof(cpu_set_t), &tmp_cpu_set);
int cpu = sched_getcpu();
if (cpu < CPU_SETSIZE) {
CPU_SET(cpu, &tmp_cpu_set);
pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &tmp_cpu_set);
}
#endif

pthread_t th;
if (pthread_create(&th, 0, do_getnameinfo, arg) != 0) {
free_getnameinfo_arg(arg);
return EAI_AGAIN;
}
pthread_detach(th);

rb_thread_call_without_gvl2(wait_getnameinfo, arg, cancel_getnameinfo, arg);

int need_free = 0;
Expand Down
4 changes: 0 additions & 4 deletions lib/English.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
# $PROCESS_ID:: $$
# $CHILD_STATUS:: $?
# $LAST_MATCH_INFO:: $~
# $IGNORECASE:: $=
# $ARGV:: $*
# $MATCH:: $&
# $PREMATCH:: $`
Expand Down Expand Up @@ -151,9 +150,6 @@ module English end if false
# scope.
alias $LAST_MATCH_INFO $~

# This variable is no longer effective. Deprecated.
alias $IGNORECASE $=

# An array of strings containing the command-line
# options from the invocation of the program. Options
# used by the Ruby interpreter will have been
Expand Down
2 changes: 1 addition & 1 deletion lib/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@

module Benchmark

VERSION = "0.2.1"
VERSION = "0.3.0"

BENCHMARK_VERSION = "2002-04-25" # :nodoc:

Expand Down
2 changes: 1 addition & 1 deletion lib/delegate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# Be advised, RDoc will not detect delegated methods.
#
class Delegator < BasicObject
VERSION = "0.3.0"
VERSION = "0.3.1"

kernel = ::Kernel.dup
kernel.class_eval do
Expand Down
2 changes: 1 addition & 1 deletion lib/find.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#
module Find

VERSION = "0.1.1"
VERSION = "0.2.0"

#
# Calls the associated block with the name of every file and directory listed
Expand Down
2 changes: 1 addition & 1 deletion lib/getoptlong.rb
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
#
class GetoptLong
# Version.
VERSION = "0.2.0"
VERSION = "0.2.1"

#
# Orderings.
Expand Down
2 changes: 1 addition & 1 deletion lib/logger/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class Logger
VERSION = "1.5.3"
VERSION = "1.6.0"
end
2 changes: 1 addition & 1 deletion lib/mutex_m.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#
module Mutex_m

VERSION = "0.1.2"
VERSION = "0.2.0"
Ractor.make_shareable(VERSION) if defined?(Ractor)

def Mutex_m.define_aliases(cl) # :nodoc:
Expand Down
3 changes: 1 addition & 2 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,7 @@ class HTTPHeaderSyntaxError < StandardError; end
class HTTP < Protocol

# :stopdoc:
VERSION = "0.3.2"
Revision = %q$Revision$.split[1]
VERSION = "0.4.0"
HTTPVersion = '1.1'
begin
require 'zlib'
Expand Down
Loading

0 comments on commit 3a5ca28

Please sign in to comment.