Граф коммитов

81501 Коммитов

Автор SHA1 Сообщение Дата
Kasumi Hanazuki e3b485213d [ruby/resolv] Implement dohpath SvcParam
(https://github.com/ruby/resolv/pull/33)

* Implement dohpath SvcParam [RFC 9461]

This patch implements "dohpath" SvcParam proposed in
[draft-ietf-add-svcb-dns-08]. This parameter specifies a URI template
for the :path used in DNS-over-HTTPS requests.

"dohpath" is employed by [DDR], also a to-be-published Proposed Standard
that specifies how to upgrade DNS transport to a more secure one, i.d.,
DNS-over-TLS or DNS-over-HTTPS. DDR is deployed in the public DNS
resolvers including Cloudflare DNS, Google Public DNS, and Quad9.

[RFC 9461]: https://datatracker.ietf.org/doc/rfc9461/
[DDR]: https://datatracker.ietf.org/doc/draft-ietf-add-ddr/

https://github.com/ruby/resolv/commit/da9c023539

Co-authored-by: Sorah Fukumori <her@sorah.jp>
2023-11-24 01:42:08 +00:00
Kasumi Hanazuki 608a518b42 [ruby/resolv] Implement SVCB and HTTPS RRs
(https://github.com/ruby/resolv/pull/32)

* Add MessageDecoder#get_list

This method repeats yielding until all the data upto the current limit
is consumed, and then returns an Array containig the block results.

* Implement SVCB and HTTPS RRs [RFC 9460]

> This patch implements SVCB and HTTPS resource record types defined in
> [RFC 9460].
>
> The RR types are now supported by many server implementations including
> BIND, unbound, PowerDNS, and Knot DNS. Major browsers such as Chrome,
> Edge, and Safari have started to query HTTPS records, with the records
> gradually adopted by websites. Also, SVCB is actually deployed in the
> public DNS resolvers such as Cloudflare DNS and Google Public DNS for
> [DDR].
>
> With such wide adoption, we have plenty of real-world use cases, and
> it is unlikely the wire format will change further in an incompatible
> way. It is time to implement them in the client libraries!
>
> # Rationale for proposed API
>
> ## `Resolv::DNS::Resource::IN::ServiceBinding`
>
> This is an abstract class for SVCB-compatible RR types.
> SVCB-compatible RR types, as defined in the Draft, shares the wire
> format and the semantics of their RDATA fields with SVCB to allow
> implementations to share the processing of these RR types. So we do
> so.
>
> The interface of this class is straightforward: It has three
> attributes `priority`, `target`, and `params`, which correspond the
> RDATA fields SvcPriority, TargetName, and SvcParams, resp.
>
> SVCB RR type is defined specifically within IN class. Thus, this
> class is placed in the `Resolv::DNS::Resource::IN` namespace.
>
> ## `Resolv::DNS::Resource::IN::SVCB`, `Resolv::DNS::Resource::IN::HTTPS`
>
> Just inherits ServiceBinding class.
>
> ## `Resolv::DNS::SvcParam`
>
> This class represents a pair of a SvcParamKey and a SvcParamValue.
> Aligned with the design of `Resolv::DNS::Resource`, each SvcParamKey
> has its own subclass of `Resolv::DNS::SvcParam`.
>
> ## `Resolv::DNS::SvcParam::Generic`
>
> This is an abstract class representing a SvcParamKey that is unknown
> to this library. `Generic.create(key)` dynamically defines its
> subclass for specific `key`. E.g., `Generic.create(667)` will define
> `Generic::Key667`.
>
> This class holds SvcParamValue in its wire format.
>
> SvcParam with an unknown SvcParamKey will be decoded as a subclass of
> this class. Also, users of this library can generate a non-supported
> SvcParam if they know its wire format.
>
> ## `Resolv::DNS::SvcParams`
>
> This is conceptually a set of `SvcParam`s, whose elements have the
> unique SvcParamKeys. It behaves like a set, and for convenience
> provides indexing by SvcParamKey.
>
> - `#initialize(params)` takes an Enumerable of `SvcParam`s as the
>   initial content. If it contains `SvcParam`s with the duplicate key,
>   the one that appears last takes precedence.
> - `#[](key)` fetches the `SvcParam` with the given key. The key can be
>   specified by its name (e.g., `:alpn`) or number (e.g., `1`).
> - `#add(param)` adds a `SvcParam` to the set. If the set already has a
>   `SvcParam` with the same key, it will be replaced.
> - `#delete(key)` deletes a `SvcParam` by its key and returns it. The key
>   can be specified by its name or number.

* Update comments referring to draft-ietf-dnsop-svcb-https-12

Published as RFC 9460. https://datatracker.ietf.org/doc/rfc9460/

[draft-ietf-dnsop-svcb-https-12]: https://datatracker.ietf.org/doc/draft-ietf-dnsop-svcb-https/12/
[RFC 9460]: https://datatracker.ietf.org/doc/rfc9460/
[DDR]: https://datatracker.ietf.org/doc/draft-ietf-add-ddr/

https://github.com/ruby/resolv/commit/b3ced7f039
2023-11-24 01:35:33 +00:00
Alan Wu 1ffaff884e Allow ivars movement in too_complex RCLASSes to fix crash
Previously, because gc_update_object_references() did not update the
VALUEs in the too_complex ivar st_table for T_CLASS and T_MODULE
objects, GC compaction could finish with corrupted objects.

 - start with `klass`, not too_complex
 - GC incremental step marks `klass` and its ivars
 - ruby code makes `klass` too_complex
 - GC compaction runs and move `klass` ivars, but because `klass` is
   too_complex, its ivars are not updated by gc_update_object_references(),
   leaving T_NONE or T_MOVED objects in the ivar table.

Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2023-11-23 20:30:18 -05:00
Alan Wu 22de08811e Avoid marking IDs in too_complex tables and rename gc_update_tbl_refs()
Marking both keys and values versus marking just values is an important
distinction, but previously, gc_update_tbl_refs() and gc_update_table_refs()
had names that were too similar.

The st_table storing ivars for too_complex T_OBJECTs have IDs as keys,
but we were marking the IDs unnecessary previously, maybe due to the
confusing naming.
2023-11-23 20:30:18 -05:00
Maxime Chevalier-Boisvert f05d586cc9
YJIT: record `num_send_cfunc` stat (#9022)
* YJIT: record num_send_cfunc stat

Also report num_send_known_cfunc as percentage of num_send_cfunc

* Rename num_send_known_cfunc => num_send_cfunc_inline

Name seems more descriptive of what we do with out custom codegen
2023-11-23 15:33:43 -05:00
Peter Zhu 315240e73b Implement Write Barriers on Enumerator 2023-11-23 13:23:29 -05:00
Eric Mueller 055a4f09ca [rubygems/rubygems] Don't require 'json' unless it's actually needed
https://github.com/rubygems/rubygems/commit/97ee203fd5
2023-11-23 18:03:17 +00:00
Eric Mueller c424d15cb9 [rubygems/rubygems] Add --json bundle-outdated flag to produce json-parseable output
https://github.com/rubygems/rubygems/commit/65efa44bc0
2023-11-23 18:03:17 +00:00
Eric Mueller a54c98a29f [rubygems/rubygems] Factor group-filtering to a private method to reduce repetition
We're about to expand the repeated bit of code, so drying it up a little
is warranted.

https://github.com/rubygems/rubygems/commit/e69c658be6
2023-11-23 18:03:16 +00:00
tomoya ishida 11d7c75fb3 [ruby/irb] Handle handle_exception's exception
(https://github.com/ruby/irb/pull/780)

https://github.com/ruby/irb/commit/d42138c477
2023-11-23 17:33:13 +00:00
Alan Wu ecdb112881 Fix `rp(too_complex_t_object)` tripping assert
Previously, it tripped the assert about too_complex in
ROBJECT_IV_CAPACITY(). This fixes double faults for some crashes and
helps with use during development.
2023-11-23 12:16:57 -05:00
Takashi Kokubun 440b59db10
YJIT: Apply patches ignoring page_end_reserve (#9015) 2023-11-23 10:53:12 -05:00
Takashi Kokubun 95369ac0a3
YJIT: Fix jmp_ptr_bytes on x86_64 (#9016) 2023-11-23 10:50:42 -05:00
Kevin Newton 285a41d793 [ruby/prism] Remove blank line
https://github.com/ruby/prism/commit/6e5258938a
2023-11-23 14:39:30 +00:00
TSUYUSATO Kitsune 7b20dd9f91 [ruby/prism] Fix LocalVariableTargetNode depth in patterns
Fix https://github.com/ruby/prism/pull/1821

https://github.com/ruby/prism/commit/7d023a26b4
2023-11-23 14:39:30 +00:00
Peter Zhu a31cdc6ee9 Add tests for compaction during evacuation of ivars
Extracted from PR #8932.

Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
2023-11-23 09:11:24 -05:00
Peter Zhu 7f7613c2c7 Fix compacting during evacuation of generic ivars
When evacuating generic instance variables, the instance variables exist
in both the array and the ST table. We need to ensure it has switched
to the ST table before performing any operations that can trigger GC
compaction.
2023-11-23 09:11:24 -05:00
Jean Boussier f1c32c0ee0 vm_setivar_slowpath: only optimize T_OBJECT
We've seen occasional CI failures on i686 in this codepath:

```
[BUG] vm_setivar_slowpath: didn't find ivar @verify_depth in shape
```

Generic ivars are very complex to get right, but also quite rare.
I don't see a good reason to take the risk to give them an optimized
path here, when the much more common T_CLASS/T_MODULE don't have one.

Having an optimization here means duplicating the fairly brittle
logic, which is a recipe for bugs, and I don't think it's worth
it in such case.
2023-11-23 11:19:12 +01:00
Pierrick Bouvier 784fdecc4c
windows-arm64 support (#8995)
* [win32] fix compilation for windows-arm64

Credits to MSYS2 Ruby package using this patch.

* [win32] nm use full options

Fix compilation error when using MSYS2 environment.
Credits to MSYS2 Ruby package using this patch.

* [win32] detect llvm-windres (used for windows-arm64)

When adding preprocessor option for llvm-windres (using clang as
parameter), it fails. Thus, do not add this.

It's needed to be able to compile windows-arm64 version, because MSYS2
toolchain is LLVM based (instead of GCC/binutils).

* [win32] pioinfo detection for windows-arm64

This fixes "unexpected ucrtbase.dll" for native windows-arm64 ruby
binary. It does not solve issue with x64 version emulated on this
platform.

Value of pioinfo pointer can be found in ucrtbase.dll at latest adrp/add
sequence before return of _isatty function. This works for both release
and debug ucrt.

Due to the nature of aarch64 ISA (vs x86 or x64), it's needed to
disassemble instructions to retrieve offset value, which is a bit more
complicated than matching specific string patterns.

Details about adrp/add usage can be found in this blog post:
https://devblogs.microsoft.com/oldnewthing/20220809-00/?p=106955
For instruction decoding, the Arm documentation was used as a reference.
2023-11-23 17:17:28 +09:00
Stan Lo e8b9058964 [ruby/irb] Hint debugger command in irb:rdbg session
(https://github.com/ruby/irb/pull/768)

When user enters irb:rdbg session, they don't get the same hint that the
`debug` gem provides, like

```
(rdbg) n    # next command
```

This means that users may accidentally execute commands when they want to
retrieve the value of a variable.

So this commit adds a Reline output modifier to add a simiar hint:

```
irb:rdbg(main):002> n # debug command
```

It is not exactly the same as `debug`'s because in this case the importance
is to help users distinguish between value evaluation and debugger command
execution.

https://github.com/ruby/irb/commit/fdf24de851
2023-11-23 07:29:12 +00:00
hogelog e2078ccd5a [ruby/irb] Fix failure of more command with -R option
(https://github.com/ruby/irb/pull/781)

https://github.com/ruby/irb/commit/7d6849e44e
2023-11-23 07:24:35 +00:00
Takashi Kokubun 926bfc3bc0
YJIT: Avoid a register spill on arm64 (#9014) 2023-11-22 15:13:32 -08:00
Peter Zhu 5672fb63d2 Implement TracePoint on VWA 2023-11-22 16:01:00 -05:00
tomoya ishida 8d6175bf64 [ruby/irb] Require prism >= 0.18.0 (MatchWriteNode#targets and
CaseMatchNode)
(https://github.com/ruby/irb/pull/778)

https://github.com/ruby/irb/commit/943c14b12e
2023-11-22 20:29:51 +00:00
Maxime Chevalier-Boisvert 7a93bee4f8
YJIT: add an extra btest for shape too complex (#9013)
Following Jean Boussier's comment that some shape bugs were not
caught by our tests, I'm trying to improve our test coverage a
tiny bit.
2023-11-22 19:06:37 +00:00
Yuta Saito 3720d4c39a [wasm] Upload install directory as artifact to GitHub Actions 2023-11-23 03:16:20 +09:00
Yuta Saito 7e9f00f34f [wasm] Build baseruby from the same revision for cross-compiling
> Note that on cross compiling BASERUBY should be the same version of the building ruby.
> https://github.com/ruby/ruby/wiki/Developer-How-To#prerequisite
2023-11-23 03:16:20 +09:00
Yuta Saito 55cad1835e [wasm] Update binaryen to version 113 2023-11-23 02:47:11 +09:00
Yuta Saito 29c2c63d6c [wasm] Update wasmtime to version 15 2023-11-23 02:47:11 +09:00
Yuta Saito 3ecedebee1 [wasm] Update wasi-sdk to version 20 2023-11-23 02:47:11 +09:00
Jean Boussier c8d99fa662 Embed ThreadGroup object
These are rare but embedding them is trivial and make them fit
in a 40B slot.
2023-11-22 18:42:04 +01:00
Yuta Saito 295d648f76 [wasm] Use xmalloc/xfree for jmpbuf allocation to trigger GC properly
`rb_vm_tag_jmpbuf_{init,deinit}` are safe to raise exception since the
given tag is not yet pushed to `ec->tag` or already popped from it at
the time, so `ec->tag` is always valid and it's safe to raise exception
when xmalloc fails.
2023-11-23 02:18:53 +09:00
Alan Wu 341321f115 Fix off-by-one with RubyVM::Shape.exhaust_shapes
Previously, the method left one shape available (MAX_SHAPE_ID) when
called without arguments.
2023-11-22 12:17:58 -05:00
Yuta Saito 0e59d91eed [wasm] Avoid malloc during longjmp
`longjmp` can be called to raise `NoMemoryError` or to trigger GC when
`malloc` fails to allocate memory in `ruby_xmalloc` family. In such
case, `malloc` call in `longjmp` will fail again, and Asyncify unwinding
operation corrupts the memory space by using the failed pointer as
Asyncify buffer. This commit uses statically allocated buffer to avoid
such situation.
2023-11-23 02:15:42 +09:00
Yuta Saito c1fc1a00ea
[wasm] Fix Asyncify loop exit condition for normal return (#9007)
[wasm] Fix Asyncify loop exit condition for normal return

Stop calling `asyncify_stop_unwind` when the main function returns
without any unwinding. In the era when Asyncify buffers were allocated
on the stack, the `top` and `end` fields were remained in the stack
space even after the main function returned, so buffer-overflow check in
the `asyncify_stop_unwind` function passed. But now, the `top` and `end`
fields are part of the jump buffer allocated on the heap and they are
deallocated with `free` when the corresponding VM tag is popped. So, the
buffer-overflow check in the `asyncify_stop_unwind` function failed when
the main fuction returned without any unwinding, and we have to break
the asyncify loop before calling `asyncify_stop_unwind`.

Related commit: bc46b12b12
2023-11-22 16:59:54 +00:00
Jun Aruga 94144801eb .travis.yml: Drop s390x temporarily.
The builds are not starting.

You can check the Travis status on the ticket,
<https://bugs.ruby-lang.org/issues/20013>.
2023-11-22 17:16:58 +01:00
Jean Boussier 9691532428 Get rid of flatten_memo_data_type
We can use an hidden Hash instead, it's simpler, triggers
write barriers, handle compaction, etc.
2023-11-22 17:10:03 +01:00
TSUYUSATO Kitsune 6968b289e7 [ruby/prism] Check void values in singleton class (`class <<`)
Follow up the ruby/ruby#8917 change.

https://github.com/ruby/prism/commit/f6bac4d3bf
2023-11-22 15:45:33 +00:00
Kevin Newton 1f06d168ba [ruby/prism] Add new doc to gemspec
https://github.com/ruby/prism/commit/99dfca6c1d
2023-11-22 15:15:07 +00:00
Kevin Newton 8f707e8030 [ruby/prism] Join range checks into the main parse_expression switch
https://github.com/ruby/prism/commit/ed4523464b
2023-11-22 14:53:29 +00:00
TSUYUSATO Kitsune 8794836bf2 [ruby/prism] Fix associativity of binary range with begin-less range
Fix https://github.com/ruby/prism/pull/1828

https://github.com/ruby/prism/commit/22c0640e48
2023-11-22 14:53:28 +00:00
Kevin Newton 2aefbbaab9 [ruby/prism] Combine expression checks into a single switch
https://github.com/ruby/prism/commit/825d5d7bd4
2023-11-22 14:53:28 +00:00
TSUYUSATO Kitsune cdd07781b0 [ruby/prism] Remove TODO
https://github.com/ruby/prism/commit/d6d718487d
2023-11-22 14:53:27 +00:00
TSUYUSATO Kitsune 76f9abced7 [ruby/prism] Reject statements at non-statement posisions
Fix https://github.com/ruby/prism/pull/1547

https://github.com/ruby/prism/commit/cdb643aeab
2023-11-22 14:53:27 +00:00
TSUYUSATO Kitsune cc7a5dcd06 [ruby/prism] Add and use pm_parser_local_depth_constant_id
https://github.com/ruby/prism/pull/1877#discussion_r1398974248

https://github.com/ruby/prism/commit/0f545fe636
2023-11-22 14:53:27 +00:00
TSUYUSATO Kitsune 154b2d666d [ruby/prism] Allow `&` forwarding in a method having `...` parameter
Fix https://github.com/ruby/prism/pull/1839

https://github.com/ruby/prism/commit/5784ab749f
2023-11-22 14:53:26 +00:00
Peter Zhu b040c529a0 Implement dir on VWA 2023-11-22 09:36:54 -05:00
Kevin Newton b45442f8a8 [prism] Add cp949 targets to common.mk 2023-11-22 09:12:35 -05:00
heyogrady e3ef05a434 [ruby/prism] Add `CP949` encoding
https://github.com/ruby/prism/commit/9e78dfdf69
2023-11-22 09:12:35 -05:00
Jean Boussier 4f031a745d Embed File::Stat objects
They are very short lived and fit in a 160B slot.
2023-11-22 14:52:32 +01:00