[#114062] [Ruby master Bug#19751] Ruby 3.2.2 Fails to Compile from Source — "martin_vahi (Martin Vahi) via ruby-core" <ruby-core@...>

Issue #19751 has been reported by martin_vahi (Martin Vahi).

9 messages 2023/07/01

[#114064] [Ruby master Feature#19752] Allow `--backtrace-limit` to appear in RUBYOPT — "tomstuart (Tom Stuart) via ruby-core" <ruby-core@...>

SXNzdWUgIzE5NzUyIGhhcyBiZWVuIHJlcG9ydGVkIGJ5IHRvbXN0dWFydCAoVG9tIFN0dWFydCku

8 messages 2023/07/01

[#114070] [Ruby master Bug#19753] IO::Buffer#get_string can't handle negative offset — "noteflakes (Sharon Rosner) via ruby-core" <ruby-core@...>

Issue #19753 has been reported by noteflakes (Sharon Rosner).

10 messages 2023/07/03

[#114072] [Ruby master Bug#19754] `IO::Buffer#get_string` raises unsuitable exception for too large offset — "nobu (Nobuyoshi Nakada) via ruby-core" <ruby-core@...>

Issue #19754 has been reported by nobu (Nobuyoshi Nakada).

7 messages 2023/07/03

[#114074] [Ruby master Feature#19755] Module#class_eval and Binding#eval use caller location by default — "byroot (Jean Boussier) via ruby-core" <ruby-core@...>

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

15 messages 2023/07/03

[#114080] [Ruby master Bug#19756] URI::HTTP.build does not accept a host of `_gateway`, but `URI.parse` will. — "postmodern (Hal Brodigan) via ruby-core" <ruby-core@...>

Issue #19756 has been reported by postmodern (Hal Brodigan).

9 messages 2023/07/04

[#114168] [Ruby master Misc#19766] DevMeeting-2023-08-24 — "mame (Yusuke Endoh) via ruby-core" <ruby-core@...>

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

9 messages 2023/07/13

[#114222] [Ruby master Misc#19772] API Naming for YARP compiler — "jemmai (Jemma Issroff) via ruby-core" <ruby-core@...>

Issue #19772 has been reported by jemmai (Jemma Issroff).

31 messages 2023/07/17

[#114276] [Ruby master Bug#19784] String#delete_prefix! problem — "inversion (Yura Babak) via ruby-core" <ruby-core@...>

Issue #19784 has been reported by inversion (Yura Babak).

10 messages 2023/07/25

[#114309] [Ruby master Feature#19787] Add Enumerable#uniq_map, Enumerable::Lazy#uniq_map, Array#uniq_map and Array#uniq_map! — "joshuay03 (Joshua Young) via ruby-core" <ruby-core@...>

Issue #19787 has been reported by joshuay03 (Joshua Young).

7 messages 2023/07/29

[#114319] [Ruby master Feature#19790] Optionally write Ruby crash reports into a file rather than STDERR — "byroot (Jean Boussier) via ruby-core" <ruby-core@...>

SXNzdWUgIzE5NzkwIGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGJ5cm9vdCAoSmVhbiBCb3Vzc2llciku

13 messages 2023/07/31

[ruby-core:114128] [Ruby master Feature#19729] Store object age in a bitmap

From: "ko1 (Koichi Sasada) via ruby-core" <ruby-core@...>
Date: 2023-07-11 04:55:10 UTC
List: ruby-core #114128
Issue #19729 has been updated by ko1 (Koichi Sasada).


no problem.
let's try to merge.

----------------------------------------
Feature #19729: Store object age in a bitmap
https://bugs.ruby-lang.org/issues/19729#change-103801

* Author: eightbitraptor (Matthew Valentine-House)
* Status: Open
* Priority: Normal
----------------------------------------
## Github PR

[Store object age in a bitmap #7938](https://github.com/ruby/ruby/pull/7938)

## Abstract

Ruby currently uses 2 bits of the flags in every object to track how many GC
events the object has survived. Objects are created at age 0 and can currently
grow to age 3, at which point they are considered "old".

Similar to the work carried out for [bitmap marking in Ruby
2.0](https://bugs.ruby-lang.org/issues/5839) which moved the mark bit from the
flags to a bitmap attached to a heap page; This PR moves the age bits out of the
object flags and stores them in a bitmap.

## Description

This PR creates a new bitmap `age_bits` on each heap page. the size of the
bitmap is controlled by `HEAP_PAGE_BITMAP_LIMIT`, which roughly indicates how
many objects need to be considered by that bitmap, and `RVALUE_AGE_BITS_SIZE`
which varies how many bits we use per object to store the age. 

We also introduce functions `RVALUE_AGE_SET`, `RVALUE_AGE_GET`,
`RVALUE_AGE_RESET` and `RVALUE_AGE_INC`  to manipulate the age of an object
pointed to by a VALUE.

## Impact

**Benefits:**

* Improved CoW performance, GC will modify the object header fewer times for 
  fewer objects.
* Allow configuration of the age at which objects are considered old. Because
  the number of bits used is configurable, we can support arbitrary numbers of
  GC events before an object is considered old. We can use this to change
  major/minor GC timings for workloads with unusually high/low object churn.
* Free a flag in each object that can be repurposed. Object flags are a precious
  resource, we should prefer to store data outside the flags where possible.
* Remove GC related concerns from the object structure. This is important for
  initiatives like a generic GC interface and MMTk in order to keep GC related
  code as isolated as possible.

**Concerns:**

* Slightly increased RSS, because we now allocate an extra 2 bits per heap page
  slot, to create the age_bits bitmap on VM bootup. On my machine 
  `sizeof(struct heap_page)` has increased from 1312 to 1728 bytes.

## Benchmarking

Railsbench and Optcarrot benchmarked using `yjit-bench`. Showing small memory
increase, but comparable performance.

```
master: ruby 3.3.0dev (2023-06-08T11:22:43Z master 3fe09eba9d) [x86_64-linux]
mvh-rvalue-age-bitmap: ruby 3.3.0dev (2023-06-13T06:59:40Z master c74f42a4fb) [x86_64-linux]

----------  -----------  ----------  ---------  --------------------------  ----------  ---------  -----------------------------  ----------------------------
bench       master (ms)  stddev (%)  RSS (MiB)  mvh-rvalue-age-bitmap (ms)  stddev (%)  RSS (MiB)  mvh-rvalue-age-bitmap 1st itr  master/mvh-rvalue-age-bitmap
railsbench  2154.3       0.5         101.4      2124.9                      0.5         101.5      1.01                           1.01
optcarrot   5372.2       0.6         55.0       5282.3                      0.6         55.1       1.02                           1.02
----------  -----------  ----------  ---------  --------------------------  ----------  ---------  -----------------------------  ----------------------------
Legend:
- mvh-rvalue-age-bitmap 1st itr: ratio of master/mvh-rvalue-age-bitmap time for the first benchmarking iteration.
- master/mvh-rvalue-age-bitmap: ratio of master/mvh-rvalue-age-bitmap time. Higher is better for mvh-rvalue-age-bitmap. Above 1 represents a speedup.
```

## Notes

**FL_PROMOTED**

We still use one of the two age bits. The original `FL_PROMOTED0` has been
renamed to `FL_PROMOTED` and has been repurposed to indicate an objects
old/young status.

We need this because correctly tracking references from old to young objects
relies on a write barrier, that's triggered whenever a field on an object is
written to. Because this code is a very hot path it needs to be fast. Looking up
the heap page and then calculating the old/young status based on the age bits
would slow down this part of the code too much.

Instead we set `FL_PROMOTED` whenever the object crosses the threshold into the
old gen, and unset it if that object ever gets demoted back into the young gen.
This way the write barrier can quickly tell whether the object is old or not and
whether to add it to the rememberset.





-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- [email protected]
 To unsubscribe send an email to [email protected]
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

In This Thread

Prev Next