[#121791] [Ruby Bug#21298] `ObjectSpace.allocation_class_path` returns inconsistent results depending on `TracePoint` state — "mame (Yusuke Endoh) via ruby-core" <ruby-core@...>

Issue #21298 has been reported by mame (Yusuke Endoh).

6 messages 2025/05/01

[#121830] [Ruby Feature#21309] Can Thread::Mutex be Ractor shareable? — "osyoyu (Daisuke Aritomo) via ruby-core" <ruby-core@...>

Issue #21309 has been reported by osyoyu (Daisuke Aritomo).

11 messages 2025/05/05

[#121837] [Ruby Feature#21311] Namespace on read (revised) — "tagomoris (Satoshi Tagomori) via ruby-core" <ruby-core@...>

Issue #21311 has been reported by tagomoris (Satoshi Tagomori).

109 messages 2025/05/06

[#121941] [Ruby Bug#21315] Finalizers violate the `rb_ractor_confirm_belonging` assertion — "byroot (Jean Boussier) via ruby-core" <ruby-core@...>

Issue #21315 has been reported by byroot (Jean Boussier).

8 messages 2025/05/09

[#121950] [Ruby Bug#21316] Namespaces leak with permanent names — "fxn (Xavier Noria) via ruby-core" <ruby-core@...>

Issue #21316 has been reported by fxn (Xavier Noria).

10 messages 2025/05/09

[#121956] [Ruby Bug#21321] Namespaces do not support extending mixins — "fxn (Xavier Noria) via ruby-core" <ruby-core@...>

Issue #21321 has been reported by fxn (Xavier Noria).

8 messages 2025/05/09

[#121973] [Ruby Bug#21322] Namespaces and builtin classes as arguments and return values — "fxn (Xavier Noria) via ruby-core" <ruby-core@...>

Issue #21322 has been reported by fxn (Xavier Noria).

8 messages 2025/05/10

[#122054] [Ruby Bug#21333] heap-use-after-free caused by rehash during update — "cyruscyliu (Qiang Liu) via ruby-core" <ruby-core@...>

Issue #21333 has been reported by cyruscyliu (Qiang Liu).

9 messages 2025/05/13

[#122086] [Ruby Bug#21337] Using `not` on the RHS of a logical operator becomes valid syntax with Prism — "koic (Koichi ITO) via ruby-core" <ruby-core@...>

Issue #21337 has been reported by koic (Koichi ITO).

7 messages 2025/05/14

[#122101] [Ruby Bug#21340] Bump autoconf version to properly handle C23 bool/stdbool defines — "christo (Chris Alberti) via ruby-core" <ruby-core@...>

Issue #21340 has been reported by christo (Chris Alberti).

12 messages 2025/05/14

[#122114] [Ruby Bug#21341] `Namespace is not a module (TypeError)` without enabling the namespace — "yahonda (Yasuo Honda) via ruby-core" <ruby-core@...>

Issue #21341 has been reported by yahonda (Yasuo Honda).

7 messages 2025/05/15

[#122121] [Ruby Bug#21342] Segfault: invalid keeping_mutexes when using Mutex in Thread then Fiber after GC — "maciej.mensfeld (Maciej Mensfeld) via ruby-core" <ruby-core@...>

Issue #21342 has been reported by maciej.mensfeld (Maciej Mensfeld).

11 messages 2025/05/15

[#122154] [Ruby Feature#21346] Introduce `String#ensure_suffix` — "matheusrich (Matheus Richard) via ruby-core" <ruby-core@...>

Issue #21346 has been reported by matheusrich (Matheus Richard).

21 messages 2025/05/16

[#122164] [Ruby Feature#21347] Add `open_timeout` as an overall timeout option for `Socket.tcp` — "shioimm (Misaki Shioi) via ruby-core" <ruby-core@...>

SXNzdWUgIzIxMzQ3IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IHNoaW9pbW0gKE1pc2FraSBTaGlvaSku

9 messages 2025/05/17

[#122184] [Ruby Misc#21350] Bundled gems lack online documentation — "osyoyu (Daisuke Aritomo) via ruby-core" <ruby-core@...>

Issue #21350 has been reported by osyoyu (Daisuke Aritomo).

8 messages 2025/05/18

[#122218] [Ruby Bug#21357] Crash in Hash#merge! with ruby-dev in rubocop-rspec test suite — "Earlopain (Earlopain _) via ruby-core" <ruby-core@...>

Issue #21357 has been reported by Earlopain (Earlopain _).

7 messages 2025/05/21

[#122228] [Ruby Feature#21359] Introduce `Exception#cause=` for Post-Initialization Assignment — "ioquatix (Samuel Williams) via ruby-core" <ruby-core@...>

SXNzdWUgIzIxMzU5IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGlvcXVhdGl4IChTYW11ZWwgV2lsbGlh

9 messages 2025/05/22

[#122242] [Ruby Feature#21365] Add `Namespace#eval` — "tenderlovemaking (Aaron Patterson) via ruby-core" <ruby-core@...>

Issue #21365 has been reported by tenderlovemaking (Aaron Patterson).

12 messages 2025/05/22

[#122258] [Ruby Misc#21367] Remove link to ruby-doc.org from www.ruby-lang.org/en/documentation/ — "p8 (Petrik de Heus) via ruby-core" <ruby-core@...>

Issue #21367 has been reported by p8 (Petrik de Heus).

11 messages 2025/05/23

[#122277] [Ruby Bug#21371] Proposal to Remove SPARC Architecture Support from Ruby — "ioquatix (Samuel Williams) via ruby-core" <ruby-core@...>

SXNzdWUgIzIxMzcxIGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGlvcXVhdGl4IChTYW11ZWwgV2lsbGlh

10 messages 2025/05/24

[#122343] [Ruby Misc#21385] Namespace: Suggesting a rename — "fxn (Xavier Noria) via ruby-core" <ruby-core@...>

SXNzdWUgIzIxMzg1IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGZ4biAoWGF2aWVyIE5vcmlhKS4NCg0K

32 messages 2025/05/30

[#122345] [Ruby Feature#21386] Introduce `Enumerable#join_map` — "matheusrich (Matheus Richard) via ruby-core" <ruby-core@...>

SXNzdWUgIzIxMzg2IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IG1hdGhldXNyaWNoIChNYXRoZXVzIFJp

12 messages 2025/05/30

[ruby-core:122210] [Ruby Feature#21353] Add shape_id to RBasic under 32 bit

From: "Dan0042 (Daniel DeLorme) via ruby-core" <ruby-core@...>
Date: 2025-05-20 20:11:37 UTC
List: ruby-core #122210
Issue #21353 has been updated by Dan0042 (Daniel DeLorme).


In general this sounds like a good idea, but I think it would be better to have a struct that works the same way for both 32bit and 64bit systems, and also avoids reserving an entire 32 bits, which is overkill for shape ids.

What about this?

	struct RBasic {
	    uint32 flags;
	    uint32 flags2;
	    const VALUE klass;
	}
	
	#define shape_id(ptr) (ptr->flags2)

Not relying on `#if RBASIC_SHAPE_ID_FIELD` would imho reduce overall complexity and simplify maintenance.

Future-proofing: if we run out of bits in `flags`, we can redefine the `shape_id` macro and use some bits from `flags2`


----------------------------------------
Feature #21353: Add shape_id to RBasic under 32 bit
https://bugs.ruby-lang.org/issues/21353#change-113358

* Author: byroot (Jean Boussier)
* Status: Open
----------------------------------------
Currently on 64bit systems, for every types, the `shape_id` is stored inside the `RBasic.flags` field, and is 32bit
long.

However, on 32bit systems like i686 and WASM, it is much more complicated.
For `T_OBJECT`, `T_CLASS` and `T_MODULE`, the `shape_id` is stored as part of "user flags" in `FL_USER4-19`,
and for all other types it's stored alongside the instance variable in the `generic_fields_tbl`, which means
a hash lookup is required to access it.

This situation makes a lot of routine noticeably more complicated, with numerous codepath taken only by 32bit systems,
because to avoid doing two hash-lookup per ivar access, the code need a lot of contortions.
You can look for `SHAPE_IN_BASIC_FLAGS` to have an idea of the added complexity.

In addition, it forces us to duplicate some bits of information. For instance `RUBY_FL_FREEZE` is redundant with the
`shape_id`. The shape already record that the object is frozen, and the only reason `RUBY_FL_FREEZE` hasn't been
eliminated is because on 32bits the `shape_id` isn't store inline for some objects.

Similarly, `RUBY_FL_EXIVAR` is redundant with the `shape_id`, because to know whether an object has ivars, you can
simply check if `shape_id == 0`.

Reclaiming these bits would be very useful for Ractors, as we'd need two bits in objects to be able to implement
[lightwieght locks](https://webkit.org/blog/6161/locking-in-webkit/).

Yet another complication, is that on 32bit systems, the `shape_id` is only 16bits long.
I have the project to use the upper bits of the `shape_id` to store metadata, such as the `frozen` and `too_complex`
status, allowing to test for this without chasing a pointer: https://github.com/ruby/ruby/pull/13289.
But this currently can't be done on 32bit sytems, both because accessing the `shape_id` might require a hash-lookup,
and also because it's only 16bits long, so every single bit used for tagging severely restrict the maximum number of
shapes.

### Proposal

To simplify all this, we propose that on 32bit systems, we add a `VALUE shape_id` in `RBasic`:

```c
struct RBasic {
    VALUE flags;
    const VALUE klass;
#if RBASIC_SHAPE_ID_FIELD
    VALUE shape_id;
#endif
}
```

This ensure that on 32bits, all objects have their `shape_id` always at the same predictable offset, and 32bits long.

As you can see on the pull request, it simplify the code quite significantly: https://github.com/ruby/ruby/pull/13341,
and there's more cleanup that can be done.

The downside obviously is that on 32bit, objects would grow from `20B` to `24B`.

### Pull Request

You can find the proposed patch at: https://github.com/ruby/ruby/pull/13341

cc @tenderlovemaking and @jhawthorn 

Also FYI @katei because as the maintainer of WASM I assume this impact you the most.




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/


In This Thread