Skip to content

Commit

Permalink
Merge commits from ruby/master into yjit_backend_ir (#406)
Browse files Browse the repository at this point in the history
* Only allow procs created by Symbol#to_proc to call public methods

Fixes [Bug #18826]

Co-authored-by: Nobuyoshi Nakada <[email protected]>

* Revert "Add {Method,UnboundMethod}#{public?,private?,protected?}"

This reverts commit 2727815 and
58dc8bf.

Visibility is an attribute of the method entry in a class, not an
attribute of the Method object.

Fixes [#18729]
Fixes [#18751]
Fixes [#18435]

* [ruby/rdoc] Treat text markup (italic, bold, monofont) as blocks (ruby/rdoc#911)

ruby/rdoc@dc88f1b425

* Add `--enable-devel` configure option

Since `RUBY_DEVEL` in cppflags has no effect in the configure script
and makefiles.

* Fix paths of exts.mk to clean

exts.mk files are one level under the top of extension directories.

* The "gems" build directory was rename as ".bundle"

* Fix race conditions when cleaning extensions

Clean built directories by `make distclean`, and then clean leftover
makefiles for skipped extensions.

* Fix Array#[] with ArithmeticSequence with negative steps (ruby#5739)

* Fix Array#[] with ArithmeticSequence with negative steps

Previously, Array#[] when called with an ArithmeticSequence
with a negative step did not handle all cases correctly,
especially cases involving infinite ranges, inverted ranges,
and/or exclusive ends.

Fixes [Bug #18247]

* Add Array#slice tests for ArithmeticSequence with negative step to test_array

Add tests of rb_arithmetic_sequence_beg_len_step C-API function.

* Fix ext/-test-/arith_seq/beg_len_step/depend

* Rename local variables

* Fix a variable name

Co-authored-by: Kenta Murata <[email protected]>

* [ruby/rdoc] [DOC] Make example formats explicit and consistent (ruby/rdoc#913)

ruby/rdoc@7e6ef6c855

* Fix inspect for unicode codepoint 0x85

This is an inelegant hack, by manually checking for this specific
code point in rb_str_inspect.  Some testing indicates that this is
the only code point affected.

It's possible a better fix would be inside of lower-level encoding
code, such that rb_enc_isprint would return false and not true for
codepoint 0x85.

Fixes [Bug #16842]

* * 2022-08-12 [ci skip]

* [ruby/rdoc] Improvements to Text Markup examples (ruby/rdoc#915)

ruby/rdoc@d00ddfe57c

* [ruby/rdoc] Mods to section Text Markup (ruby/rdoc#916)

ruby/rdoc@5506d4d67e

* [ruby/error_highlight] Add a note about the current limitation of ErrorHighlight.spot

ruby/error_highlight@489ce80a62

* All extensions in bundled gems are built by build-ext now

`RbInstall::GemInstaller#build_extensions` has nothing to do.

* No bundled gems to be installed from gem now

* [DOC] Use `true`/`false` for `@retval`s which are `bool`

* Add missing `rb_enc_iscntrl`

* Stop defining `RUBY_ABI_VERSION` if released versions

As commented in include/ruby/internal/abi.h, since teeny versions of
Ruby should guarantee ABI compatibility, `RUBY_ABI_VERSION` has no role
in released versions of Ruby.

* Add Numeric#ceildiv and Integer#ceildiv

* Remove Numeric#ceildiv

* Improve performance of Integer#ceildiv

This patch is suggested by nobu.

Benchmark result:

```
require 'benchmark'

n = 10 ** 7

Benchmark.bm do |x|
  x.report("Fixnum/Fixnum") { a, b = 5, 2; n.times { a.ceildiv(b) } }
  x.report("Bignum/Bignum") { a, b = 10**100, 10**99 - 1; n.times { a.ceildiv(b) } }
  x.report("Bignum/Fixnum") { a, b = 10**100, 3; n.times { a.ceildiv(b) } }
end
```

Original:

```
       user     system      total        real
Fixnum/Fixnum  3.340009   0.043029   3.383038 (  3.384022)
Bignum/Bignum  8.229500   0.118543   8.348043 (  8.349574)
Bignum/Fixnum  8.328971   0.097842   8.426813 (  8.426952)
```

Improved:

```
       user     system      total        real
Fixnum/Fixnum  0.699140   0.000961   0.700101 (  0.700199)
Bignum/Bignum  5.076165   0.083160   5.159325 (  5.159360)
Bignum/Fixnum  5.548684   0.115372   5.664056 (  5.666735)
```

* [Bug #18962] Do not read again once reached EOF

`Ripper::Lexer#parse` re-parses the source code with syntax errors
when `raise_errors: false`.

Co-Authored-By: tompng <[email protected]>

* Short-circuit `Process._fork`

* Introduce with_warn_vsprintf macro

* Bundle unreleased debug

* Preserve each column positions in gems/bundled_gems

* Adjust columns in gems/bundled_gems [ci skip]

* [ruby/rdoc] [DOC] Enhances text about escapes (ruby/rdoc#917)

ruby/rdoc@c40bac829c

* * 2022-08-13 [ci skip]

* Add a NEWS entry about Integer#ceildiv [ci skip]

* [DOC] Add the link to [Feature #18809]

* Silent configure does not output cached configurations

* * 2022-08-14 [ci skip]

* Update dependencies

* [ruby/rinda] Handle situations where IPv4 multicast is not available

Fixes [Bug #13864]

ruby/rinda@3cd620f38c

* * 2022-08-15 [ci skip]

* [rubygems/rubygems] Fix Ruby platform incorrectly removed on `bundle update`

rubygems/rubygems@0d321c9e3a

* [ruby/date] [DOC] Enhanced intro for Date (ruby/date#72)

ruby/date@59a6673221

* Add test for GC thrashing of young object creation

This test will prevent performance regressions like [Bug #18929].

* Simplify around `USE_YJIT` macro (ruby#6240)

* Simplify around `USE_YJIT` macro

- Use `USE_YJIT` macro only instead of `YJIT_BUILD`.
- An intermediate macro `YJIT_SUPPORTED_P` is no longer used.

* Bail out if YJIT is enabled on unsupported platforms

* * 2022-08-16 [ci skip]

* [ruby/rdoc] [DOC] Remove duplicated line in RDoc::MarkupReference

ruby/rdoc@488f89aee4

* Allow aarch64 to build YJIT

Co-authored-by: Jeremy Evans <[email protected]>
Co-authored-by: Nobuyoshi Nakada <[email protected]>
Co-authored-by: Burdette Lamar <[email protected]>
Co-authored-by: Kenta Murata <[email protected]>
Co-authored-by: git <[email protected]>
Co-authored-by: Yusuke Endoh <[email protected]>
Co-authored-by: Kouhei Yanagita <[email protected]>
Co-authored-by: tompng <[email protected]>
Co-authored-by: S-H-GAMELINKS <[email protected]>
Co-authored-by: David Rodríguez <[email protected]>
Co-authored-by: Peter Zhu <[email protected]>
Co-authored-by: Takashi Kokubun <[email protected]>
  • Loading branch information
13 people authored Aug 16, 2022
1 parent efeb5a8 commit fcda66f
Show file tree
Hide file tree
Showing 32 changed files with 505 additions and 373 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ Note: We're only listing outstanding class updates.
empty, instead of returning the default value or
calling the default proc. [[Bug #16908]]
* Integer
* Integer#ceildiv has been added. [[Feature #18809]]
* Kernel
* Kernel#binding raises RuntimeError if called from a non-Ruby frame
(such as a method defined in C). [[Bug #18487]]
Expand Down Expand Up @@ -276,3 +279,4 @@ The following deprecated APIs are removed.
[Feature #18685]: https://bugs.ruby-lang.org/issues/18685
[Bug #18782]: https://bugs.ruby-lang.org/issues/18782
[Feature #18788]: https://bugs.ruby-lang.org/issues/18788
[Feature #18809]: https://bugs.ruby-lang.org/issues/18809
9 changes: 3 additions & 6 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13822,7 +13822,6 @@ signal.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
signal.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
signal.$(OBJEXT): $(CCAN_DIR)/list/list.h
signal.$(OBJEXT): $(CCAN_DIR)/str/str.h
signal.$(OBJEXT): $(hdrdir)/ruby.h
signal.$(OBJEXT): $(hdrdir)/ruby/ruby.h
signal.$(OBJEXT): $(top_srcdir)/internal/array.h
signal.$(OBJEXT): $(top_srcdir)/internal/compilers.h
Expand Down Expand Up @@ -14008,7 +14007,6 @@ signal.$(OBJEXT): {$(VPATH)}internal/warning_push.h
signal.$(OBJEXT): {$(VPATH)}internal/xmalloc.h
signal.$(OBJEXT): {$(VPATH)}method.h
signal.$(OBJEXT): {$(VPATH)}missing.h
signal.$(OBJEXT): {$(VPATH)}mjit.h
signal.$(OBJEXT): {$(VPATH)}node.h
signal.$(OBJEXT): {$(VPATH)}onigmo.h
signal.$(OBJEXT): {$(VPATH)}oniguruma.h
Expand All @@ -14024,7 +14022,6 @@ signal.$(OBJEXT): {$(VPATH)}thread_native.h
signal.$(OBJEXT): {$(VPATH)}vm_core.h
signal.$(OBJEXT): {$(VPATH)}vm_debug.h
signal.$(OBJEXT): {$(VPATH)}vm_opts.h
signal.$(OBJEXT): {$(VPATH)}yjit.h
sprintf.$(OBJEXT): $(hdrdir)/ruby/ruby.h
sprintf.$(OBJEXT): $(top_srcdir)/internal/bignum.h
sprintf.$(OBJEXT): $(top_srcdir)/internal/bits.h
Expand Down Expand Up @@ -17593,16 +17590,14 @@ yjit.$(OBJEXT): $(top_srcdir)/internal/array.h
yjit.$(OBJEXT): $(top_srcdir)/internal/class.h
yjit.$(OBJEXT): $(top_srcdir)/internal/compile.h
yjit.$(OBJEXT): $(top_srcdir)/internal/compilers.h
yjit.$(OBJEXT): $(top_srcdir)/internal/fixnum.h
yjit.$(OBJEXT): $(top_srcdir)/internal/gc.h
yjit.$(OBJEXT): $(top_srcdir)/internal/hash.h
yjit.$(OBJEXT): $(top_srcdir)/internal/imemo.h
yjit.$(OBJEXT): $(top_srcdir)/internal/object.h
yjit.$(OBJEXT): $(top_srcdir)/internal/re.h
yjit.$(OBJEXT): $(top_srcdir)/internal/sanitizers.h
yjit.$(OBJEXT): $(top_srcdir)/internal/serial.h
yjit.$(OBJEXT): $(top_srcdir)/internal/static_assert.h
yjit.$(OBJEXT): $(top_srcdir)/internal/string.h
yjit.$(OBJEXT): $(top_srcdir)/internal/struct.h
yjit.$(OBJEXT): $(top_srcdir)/internal/variable.h
yjit.$(OBJEXT): $(top_srcdir)/internal/vm.h
yjit.$(OBJEXT): $(top_srcdir)/internal/warnings.h
Expand All @@ -17620,6 +17615,7 @@ yjit.$(OBJEXT): {$(VPATH)}backward/2/stdarg.h
yjit.$(OBJEXT): {$(VPATH)}builtin.h
yjit.$(OBJEXT): {$(VPATH)}config.h
yjit.$(OBJEXT): {$(VPATH)}constant.h
yjit.$(OBJEXT): {$(VPATH)}debug.h
yjit.$(OBJEXT): {$(VPATH)}debug_counter.h
yjit.$(OBJEXT): {$(VPATH)}defines.h
yjit.$(OBJEXT): {$(VPATH)}encoding.h
Expand Down Expand Up @@ -17798,6 +17794,7 @@ yjit.$(OBJEXT): {$(VPATH)}thread_native.h
yjit.$(OBJEXT): {$(VPATH)}vm_callinfo.h
yjit.$(OBJEXT): {$(VPATH)}vm_core.h
yjit.$(OBJEXT): {$(VPATH)}vm_debug.h
yjit.$(OBJEXT): {$(VPATH)}vm_insnhelper.h
yjit.$(OBJEXT): {$(VPATH)}vm_opts.h
yjit.$(OBJEXT): {$(VPATH)}vm_sync.h
yjit.$(OBJEXT): {$(VPATH)}yjit.c
Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ AC_SUBST(GIT)
AC_SUBST(HAVE_GIT)

eval `sed -n -e ['s/^@%:@define RUBY_[A-Z_]*VERSION_\([A-Z][A-Z][A-Z_0-9]*\) \([0-9][0-9]*\)$/\1=\2/p'] \
-e ['s/^@%:@define \(RUBY_ABI_VERSION\) \([0-9][0-9]*\).*/\1=\2/p'] \
-e ['s/^@%:@define \(RUBY_PATCHLEVEL\) \(.*\)/\1=\2/p'] \
$srcdir/include/ruby/internal/abi.h \
$srcdir/include/ruby/version.h $srcdir/version.h`
for v in MAJOR MINOR TEENY; do
AS_IF([eval "test \"\$$v\" = ''"], [
Expand All @@ -100,6 +102,9 @@ AC_SUBST(MINOR)
AC_SUBST(TEENY)
AC_SUBST(RUBY_API_VERSION, '$(MAJOR).$(MINOR)')
AC_SUBST(RUBY_PROGRAM_VERSION, '$(MAJOR).$(MINOR).$(TEENY)')
AS_CASE([$RUBY_PATCHLEVEL], [-*], [
AC_DEFINE_UNQUOTED(RUBY_ABI_VERSION, [${RUBY_ABI_VERSION}])
], [RUBY_ABI_VERSION=])

AS_IF([test "$program_prefix" = NONE], [
program_prefix=
Expand Down Expand Up @@ -4118,6 +4123,7 @@ AS_CASE(["$ruby_version"],
AS_IF([test ${RUBY_LIB_VERSION_STYLE+set}], [
{
echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE"
echo '@%:@include "confdefs.h"'
echo '#define STRINGIZE(x) x'
test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0'
echo '#include "version.h"'
Expand Down
145 changes: 103 additions & 42 deletions doc/rdoc/markup_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
# - {Directive}[rdoc-ref:RDoc::MarkupReference@Directives]:
# various special directions for the rendering.
# - {Text Markup}[rdoc-ref:RDoc:MarkupReference@Text+Markup]:
# text to be rendered in italic, bold, or monofont.
# text to be rendered in a special way.
#
# About the blocks:
#
Expand Down Expand Up @@ -632,18 +632,24 @@
#
# ==== Text Markup
#
# Text markup is metatext that marks text as:
# Text markup is metatext that affects HTML rendering:
#
# - Italic.
# - Bold.
# - Monofont.
# - Typeface: italic, bold, monofont.
# - Character conversions: copyright, trademark, certain punctuation.
# - Links.
# - Escapes: marking text as "not markup."
#
# Text markup may contain only one type of nested block:
# ===== Typeface Markup
#
# - More text markup:
# Typeface markup can specify that text is to be rendered
# as italic, bold, or monofont.
#
# Typeface markup may contain only one type of nested block:
#
# - More typeface markup:
# italic, bold, monofont.
#
# ===== Italic
# ====== Italic
#
# Text may be marked as italic via HTML tag <tt><i></tt> or <tt><em></tt>.
#
Expand Down Expand Up @@ -698,7 +704,7 @@
#
# ====== _Italic_ in a Heading
#
# ===== Bold
# ====== Bold
#
# Text may be marked as bold via HTML tag <tt><b></tt>.
#
Expand Down Expand Up @@ -755,7 +761,7 @@
#
# ===== *Bold* in a Heading
#
# ===== Monofont
# ====== Monofont
#
# Text may be marked as monofont
# -- sometimes called 'typewriter font' --
Expand Down Expand Up @@ -814,37 +820,6 @@
#
# ====== +Monofont+ in a Heading
#
# ==== Escaping Text Markup
#
# Text markup can be escaped with a backslash, as in \<tt>, which was obtained
# with <tt>\\<tt></tt>. Except in verbatim sections and between \<tt> tags,
# to produce a backslash you have to double it unless it is followed by a
# space, tab or newline. Otherwise, the HTML formatter will discard it, as it
# is used to escape potential links:
#
# * The \ must be doubled if not followed by white space: \\.
# * But not in \<tt> tags: in a Regexp, <tt>\S</tt> matches non-space.
# * This is a link to {ruby-lang}[https://www.ruby-lang.org].
# * This is not a link, however: \{ruby-lang.org}[https://www.ruby-lang.org].
# * This will not be linked to \RDoc::RDoc#document
#
# generates:
#
# * The \ must be doubled if not followed by white space: \\.
# * But not in \<tt> tags: in a Regexp, <tt>\S</tt> matches non-space.
# * This is a link to {ruby-lang}[https://www.ruby-lang.org]
# * This is not a link, however: \{ruby-lang.org}[https://www.ruby-lang.org]
# * This will not be linked to \RDoc::RDoc#document
#
# Inside \<tt> tags, more precisely, leading backslashes are removed only if
# followed by a markup character (<tt><*_+</tt>), a backslash, or a known link
# reference (a known class or method). So in the example above, the backslash
# of <tt>\S</tt> would be removed if there was a class or module named +S+ in
# the current context.
#
# This behavior is inherited from RDoc version 1, and has been kept for
# compatibility with existing RDoc documentation.
#
# ==== Character Conversions
#
# Certain combinations of characters may be converted to special characters;
Expand Down Expand Up @@ -891,7 +866,6 @@
#
# - On-page: <tt>::dummy_singleton_method</tt> links to ::dummy_singleton_method.
# - Off-page<tt>RDoc::TokenStream::to_html</tt> links to RDoc::TokenStream::to_html.
# to \RDoc::TokenStream::to_html.
#
# Note: Occasionally \RDoc is not linked to a method whose name
# has only special characters. Check whether the links you were expecting
Expand Down Expand Up @@ -1068,6 +1042,93 @@
#
# {rdoc-image:https://www.ruby-lang.org/images/[email protected]}[./Alias.html]
#
# === Escaping Text
#
# Text that would otherwise be interpreted as markup
# can be "escaped," so that it is not interpreted as markup;
# the escape character is the backslash (<tt>'\\'</tt>).
#
# In a verbatim text block or a code block,
# the escape character is always preserved:
#
# Example input:
#
# This is not verbatim text.
#
# This is verbatim text, with an escape character \.
#
# This is not a code block.
#
# def foo
# 'String with an escape character.'
# end
#
# Rendered HTML:
#
# >>>
# This is not verbatim text.
#
# This is verbatim text, with an escape character \.
#
# This is not a code block.
#
# def foo
# 'This is a code block with an escape character \.'
# end
#
# In typeface markup (italic, bold, or monofont),
# an escape character is preserved unless it is immediately
# followed by nested typeface markup.
#
# Example input:
#
# This list is about escapes; it contains:
#
# - <tt>Monofont text with unescaped nested _italic_</tt>.
# - <tt>Monofont text with escaped nested \_italic_</tt>.
# - <tt>Monofont text with an escape character \</tt>.
#
# Rendered HTML:
#
# >>>
# This list is about escapes; it contains:
#
# - <tt>Monofont text with unescaped nested _italic_</tt>.
# - <tt>Monofont text with escaped nested \_italic_</tt>.
# - <tt>Monofont text with an escape character \ </tt>.
#
# In other text-bearing blocks
# (paragraphs, block quotes, list items, headings):
#
# - A single escape character immediately followed by markup
# escapes the markup.
# - A single escape character followed by whitespace is preserved.
# - A single escape character anywhere else is ignored.
# - A double escape character is rendered as a single backslash.
#
# Example input:
#
# This list is about escapes; it contains:
#
# - An unescaped class name, RDoc, that will become a link.
# - An escaped class name, \RDoc, that will not become a link.
# - An escape character followed by whitespace \ .
# - An escape character \that is ignored.
# - A double escape character \\ that is rendered
# as a single backslash.
#
# Rendered HTML:
#
# >>>
# This list is about escapes; it contains:
#
# - An unescaped class name, RDoc, that will become a link.
# - An escaped class name, \RDoc, that will not become a link.
# - An escape character followed by whitespace \ .
# - An escape character \that is ignored.
# - A double escape character \\ that is rendered
# as a single backslash.
#
# == Documentation Derived from Ruby Code
#
# [Class]
Expand Down
49 changes: 22 additions & 27 deletions error.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,47 +357,42 @@ warn_vsprintf(rb_encoding *enc, const char *file, int line, const char *fmt, va_
return rb_str_cat2(str, "\n");
}

#define with_warn_vsprintf(file, line, fmt) \
VALUE str; \
va_list args; \
va_start(args, fmt); \
str = warn_vsprintf(NULL, file, line, fmt, args); \
va_end(args);

void
rb_compile_warn(const char *file, int line, const char *fmt, ...)
{
VALUE str;
va_list args;

if (NIL_P(ruby_verbose)) return;

va_start(args, fmt);
str = warn_vsprintf(NULL, file, line, fmt, args);
va_end(args);
rb_write_warning_str(str);
if (!NIL_P(ruby_verbose)) {
with_warn_vsprintf(file, line, fmt) {
rb_write_warning_str(str);
}
}
}

/* rb_compile_warning() reports only in verbose mode */
void
rb_compile_warning(const char *file, int line, const char *fmt, ...)
{
VALUE str;
va_list args;

if (!RTEST(ruby_verbose)) return;

va_start(args, fmt);
str = warn_vsprintf(NULL, file, line, fmt, args);
va_end(args);
rb_write_warning_str(str);
if (RTEST(ruby_verbose)) {
with_warn_vsprintf(file, line, fmt) {
rb_write_warning_str(str);
}
}
}

void
rb_category_compile_warn(rb_warning_category_t category, const char *file, int line, const char *fmt, ...)
{
VALUE str;
va_list args;

if (NIL_P(ruby_verbose)) return;

va_start(args, fmt);
str = warn_vsprintf(NULL, file, line, fmt, args);
va_end(args);
rb_warn_category(str, rb_warning_category_to_name(category));
if (!NIL_P(ruby_verbose)) {
with_warn_vsprintf(file, line, fmt) {
rb_warn_category(str, rb_warning_category_to_name(category));
}
}
}

RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 2, 0)
Expand Down
1 change: 1 addition & 0 deletions ext/-test-/abi/extconf.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: false
return unless RUBY_PATCHLEVEL < 0
require_relative "../auto_ext.rb"
auto_ext(inc: true)
Loading

0 comments on commit fcda66f

Please sign in to comment.