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-2
  • Loading branch information
rm155 committed Nov 28, 2023
2 parents 6a4460a + 0164da6 commit 33eebdc
Show file tree
Hide file tree
Showing 178 changed files with 3,898 additions and 1,566 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ jobs:
input: sarif-results/${{ matrix.language }}.sarif
output: sarif-results/${{ matrix.language }}.sarif
if: ${{ matrix.language == 'ruby' }}
continue-on-error: true

- name: Upload SARIF
uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
with:
sarif_file: sarif-results/${{ matrix.language }}.sarif
continue-on-error: true
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ matrix:
include:
- <<: *arm64-linux
- <<: *ppc64le-linux
# The s390x builds are not starting.
# - <<: *s390x-linux
- <<: *s390x-linux
# FIXME: lib/rubygems/util.rb:104 glob_files_in_dir -
# <internal:dir>:411:in glob: File name too long - (Errno::ENAMETOOLONG)
# https://github.com/rubygems/rubygems/issues/7132
Expand All @@ -114,7 +113,7 @@ matrix:
# Allow failures for the unstable jobs.
# - name: arm64-linux
# - name: ppc64le-linux
- name: s390x-linux
# - name: s390x-linux
# The 2nd arm64 pipeline may be unstable.
# - name: arm32-linux
fast_finish: true
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ The following default gems are updated.
* securerandom 0.3.0
* shellwords 0.2.0
* singleton 0.2.0
* stringio 3.1.0
* stringio 3.1.1
* strscan 3.0.8
* syntax_suggest 1.1.0
* tempfile 0.2.0
Expand Down
5 changes: 4 additions & 1 deletion array.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,10 @@ ary_make_partial(VALUE ary, VALUE klass, long offset, long len)
else {
VALUE shared = ary_make_shared(ary);

assert(!ARY_EMBED_P(result));
/* The ary_make_shared call may allocate, which can trigger a GC
* compaction. This can cause the array to be embedded because it has
* a length of 0. */
FL_UNSET_EMBED(result);

ARY_SET_PTR(result, RARRAY_CONST_PTR(ary));
ARY_SET_LEN(result, RARRAY_LEN(ary));
Expand Down
8 changes: 6 additions & 2 deletions compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -12865,8 +12865,12 @@ ibf_load_object_bignum(const struct ibf_load *load, const struct ibf_object_head
const struct ibf_object_bignum *bignum = IBF_OBJBODY(struct ibf_object_bignum, offset);
int sign = bignum->slen > 0;
ssize_t len = sign > 0 ? bignum->slen : -1 * bignum->slen;
VALUE obj = rb_integer_unpack(bignum->digits, len * 2, 2, 0,
INTEGER_PACK_LITTLE_ENDIAN | (sign == 0 ? INTEGER_PACK_NEGATIVE : 0));
const int big_unpack_flags = /* c.f. rb_big_unpack() */
INTEGER_PACK_LSWORD_FIRST |
INTEGER_PACK_NATIVE_BYTE_ORDER;
VALUE obj = rb_integer_unpack(bignum->digits, len, sizeof(BDIGIT), 0,
big_unpack_flags |
(sign == 0 ? INTEGER_PACK_NEGATIVE : 0));
if (header->internal) rb_obj_hide(obj);
if (header->frozen) rb_obj_freeze(obj);
return obj;
Expand Down
5 changes: 1 addition & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -506,13 +506,10 @@ AS_CASE(["$target_os"],
])
rb_cv_binary_elf=no
: ${enable_shared=yes}
AS_IF([$WINDRES --version | grep LLVM > /dev/null], [USE_LLVM_WINDRES=yes], [USE_LLVM_WINDRES=no])
],
[hiuxmpp*], [AC_DEFINE(__HIUX_MPP__)]) # by TOYODA Eizi <toyoda@npd.kishou.go.jp>

USE_LLVM_WINDRES=no
windres_version=`windres --version | grep LLVM`
test -z "$windres_version" || USE_LLVM_WINDRES=yes

AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_INSTALL
Expand Down
30 changes: 30 additions & 0 deletions doc/contributing/documentation_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,36 @@ will be autolinked:
If not, or if you suppress autolinking, consider forcing
[monofont](rdoc-ref:RDoc::MarkupReference@Monofont).
### Explicit Links
When writing an explicit link, follow these guidelines.
#### +rdoc-ref+ Scheme
Use the +rdoc-ref+ scheme for:
- A link in core documentation to other core documentation.
- A link in core documentation to documentation in a standard library package.
- A link in a standard library package to other documentation in that same
standard library package.
See section "+rdoc-ref+ Scheme" in {Links}[rdoc-ref:RDoc::MarkupReference@Links].
#### URL-Based Link
Use a full URL-based link for:
- A link in standard library documentation to documentation in the core.
- A link in standard library documentation to documentation in a different
standard library package.
Doing so ensures that the link will valid even when the package documentation
is built independently (separately from the core documentation).
The link should lead to a target in https://docs.ruby-lang.org/en/master/.
Also use a full URL-based link for a link to an off-site document.
### Variable Names
The name of a variable (as specified in its call-seq) should be marked up as
Expand Down
14 changes: 7 additions & 7 deletions doc/extension.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -779,26 +779,26 @@ approach to marking and reference updating is provided, by declaring offset
references to the VALUES in your struct.

Doing this allows the Ruby GC to support marking these references and GC
compaction without the need to define the `dmark` and `dcompact` callbacks.
compaction without the need to define the +dmark+ and +dcompact+ callbacks.

You must define a static list of VALUE pointers to the offsets within your
struct where the references are located, and set the "data" member to point to
this reference list. The reference list must end with `END_REFS`
this reference list. The reference list must end with +RUBY_END_REFS+.

Some Macros have been provided to make edge referencing easier:

* <code>RUBY_TYPED_DECL_MARKING</code> =A flag that can be set on the `ruby_data_type_t` to indicate that references are being declared as edges.
* <code>RUBY_TYPED_DECL_MARKING</code> =A flag that can be set on the +ruby_data_type_t+ to indicate that references are being declared as edges.

* <code>RUBY_REFERENCES_START(ref_list_name)</code> - Define `ref_list_name` as a list of references
* <code>RUBY_REFERENCES_START(ref_list_name)</code> - Define _ref_list_name_ as a list of references

* <code>RUBY_REFERENCES_END</code> - Mark the end of the references list. This will take care of terminating the list correctly

* <code>RUBY_REF_EDGE\(struct, member\)</code> - Declare `member` as a VALUE edge from `struct`. Use this after `RUBY_REFERENCES_START`
* <code>RUBY_REF_EDGE(struct, member)</code> - Declare _member_ as a VALUE edge from _struct_. Use this after +RUBY_REFERENCES_START+

* +REFS_LIST_PTR+ - Coerce the reference list into a format that can be
accepted by the existing `dmark` interface.
accepted by the existing +dmark+ interface.

The example below is from `Dir` (defined in `dir.c`)
The example below is from Dir (defined in +dir.c+)

// The struct being wrapped. Notice this contains 3 members of which the second
// is a VALUE reference to another ruby object.
Expand Down
31 changes: 30 additions & 1 deletion doc/timezones.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The value given with any of these must be one of the following
- {Single-letter offset}[rdoc-ref:timezones.rdoc@Single-Letter+Offsets].
- {Integer offset}[rdoc-ref:timezones.rdoc@Integer+Offsets].
- {Timezone object}[rdoc-ref:timezones.rdoc@Timezone+Objects].
- {Timezone name}[rdoc-ref:timezones.rdoc@Timezone+Names].

=== Hours/Minutes Offsets

Expand Down Expand Up @@ -57,7 +58,9 @@ in the range <tt>-86399..86399</tt>:

=== Timezone Objects

The zone value may be an object responding to certain timezone methods.
The zone value may be an object responding to certain timezone methods, an
instance of {Timezone}[https://github.com/panthomakos/timezone] and
{TZInfo}[https://tzinfo.github.io] for example.

The timezone methods are:

Expand Down Expand Up @@ -100,3 +103,29 @@ which will be called if defined:
- Called when <tt>Marshal.dump(t)</tt> is invoked
- Argument: none.
- Returns: the string name of the timezone.

=== Timezone Names

If the class (the receiver of class methods, or the class of the receiver
of instance methods) has +find_timezone+ singleton method, this method is
called to achieve the corresponding timezone object from a timezone name.

For example, using {Timezone}[https://github.com/panthomakos/timezone]:
class TimeWithTimezone < Time
require 'timezone'
def self.find_timezone(z) = Timezone[z]
end

TimeWithTimezone.now(in: "America/New_York") #=> 2023-12-25 00:00:00 -0500
TimeWithTimezone.new("2023-12-25 America/New_York") #=> 2023-12-25 00:00:00 -0500

Or, using {TZInfo}[https://tzinfo.github.io]:
class TimeWithTZInfo < Time
require 'tzinfo'
def self.find_timezone(z) = TZInfo::Timezone.get(z)
end

TimeWithTZInfo.now(in: "America/New_York") #=> 2023-12-25 00:00:00 -0500
TimeWithTZInfo.new("2023-12-25 America/New_York") #=> 2023-12-25 00:00:00 -0500

You can define this method per subclasses, or on the toplevel Time class.
18 changes: 9 additions & 9 deletions enumerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ static const rb_data_type_t yielder_data_type = {
NULL,
yielder_compact,
},
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_EMBEDDABLE
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_EMBEDDABLE
};

static struct yielder *
Expand Down Expand Up @@ -1341,7 +1341,7 @@ yielder_init(VALUE obj, VALUE proc)
rb_raise(rb_eArgError, "unallocated yielder");
}

ptr->proc = proc;
RB_OBJ_WRITE(obj, &ptr->proc, proc);

return obj;
}
Expand Down Expand Up @@ -1434,7 +1434,7 @@ static const rb_data_type_t generator_data_type = {
NULL,
generator_compact,
},
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_EMBEDDABLE
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_EMBEDDABLE
};

static struct generator *
Expand Down Expand Up @@ -1474,7 +1474,7 @@ generator_init(VALUE obj, VALUE proc)
rb_raise(rb_eArgError, "unallocated generator");
}

ptr->proc = proc;
RB_OBJ_WRITE(obj, &ptr->proc, proc);

return obj;
}
Expand Down Expand Up @@ -1522,7 +1522,7 @@ generator_init_copy(VALUE obj, VALUE orig)
rb_raise(rb_eArgError, "unallocated generator");
}

ptr1->proc = ptr0->proc;
RB_OBJ_WRITE(obj, &ptr1->proc, ptr0->proc);

return obj;
}
Expand Down Expand Up @@ -1689,7 +1689,7 @@ lazy_generator_init(VALUE enumerator, VALUE procs)
lazy_init_block, rb_ary_new3(2, obj, procs));

gen_ptr = generator_ptr(generator);
gen_ptr->obj = obj;
RB_OBJ_WRITE(generator, &gen_ptr->obj, obj);

return generator;
}
Expand Down Expand Up @@ -2945,7 +2945,7 @@ static const rb_data_type_t producer_data_type = {
producer_memsize,
producer_compact,
},
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_EMBEDDABLE
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_EMBEDDABLE
};

static struct producer *
Expand Down Expand Up @@ -2985,8 +2985,8 @@ producer_init(VALUE obj, VALUE init, VALUE proc)
rb_raise(rb_eArgError, "unallocated producer");
}

ptr->init = init;
ptr->proc = proc;
RB_OBJ_WRITE(obj, &ptr->init, init);
RB_OBJ_WRITE(obj, &ptr->proc, proc);

return obj;
}
Expand Down
Loading

0 comments on commit 33eebdc

Please sign in to comment.