backport r46942 from ruby/ruby trunk.
backport r46943 from ruby/ruby trunk.
backport r46945 from ruby/ruby trunk.
backport r46946 from ruby/ruby trunk.
backport r46947 from ruby/ruby trunk.
backport r46948 from ruby/ruby trunk.