From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [IPv6:2a01:4f8:1c0c:6b10::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id C0B101F44D for ; Tue, 16 Apr 2024 08:41:19 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=fPdLElhd; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=PyQ3mOCc; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id C4E0A84311; Tue, 16 Apr 2024 08:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1713256870; bh=kwSrAzayvgCc0m8mXFUzh5IZqBkxI71dAVCQspNwfmg=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=fPdLElhdqfZjBjoWmoOXKHlPTB10LWA3Fwe852Jrktj/4ujsezwPjzdDStG/pz/qQ oU4y/Wh6Un3Xaqfbs2qPByHzIVAtFcm+zVlSR//FIk/MbSbtCeIIZW4ZocBN8I7+oc 7IIF7iVKq5SDrafz7KAKw9bVuSwep4fwHyxFvbYQ= Received: from s.wrqvwxzv.outbound-mail.sendgrid.net (s.wrqvwxzv.outbound-mail.sendgrid.net [149.72.154.232]) by nue.mailmanlists.eu (Postfix) with ESMTPS id A0D2F84309 for ; Tue, 16 Apr 2024 08:41:06 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=PyQ3mOCc; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=tht6ArMS7rxm1UT+a9qDKcMqoa5cgPLVY9YESJtML2k=; b=PyQ3mOCcrVKusYgQItuiBUZq5pp3hVZ3pNOwB1hphrIjFydbhRcOOKYsIDdzYJ80iiwq gt4n5x+unTImAIOQJxGEkrdtQj9JL04vfq9ZbXFWmWFmnnwgrXsW06i5d1BU24hNWqfN9C MWbpehQl+RCqgEbTGiySY5ds6Ein4IGWMVq84kFOidSB9Px0eZZz1gAtXqPvYxiF2WGghG sYEDA53jSq2buumRv1LI82AIErQfbm/C1LeuxGOXe3tyGyi5d0wzhVSgnV5QVF5UqLfBHZ B9y0rcZbEy+/W2FkcXSBkil3TVgas4gTSUMVx1vWqK7fKWpMZqvO+hpBXtTp+OeQ== Received: by recvd-bb7996b79-zhcjh with SMTP id recvd-bb7996b79-zhcjh-1-661E399E-12 2024-04-16 08:41:02.882399691 +0000 UTC m=+297620.325217479 Received: from herokuapp.com (unknown) by geopod-ismtpd-5 (SG) with ESMTP id PXXGqI8aR7-h2XsoDoeSSg for ; Tue, 16 Apr 2024 08:41:02.849 +0000 (UTC) Date: Tue, 16 Apr 2024 08:41:02 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 20351 X-Redmine-Issue-Author: eightbitraptor X-Redmine-Issue-Priority: Normal X-Redmine-Sender: eightbitraptor X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 94122 X-SG-EID: =?us-ascii?Q?u001=2E9VAa+KF84+ACjWkSb8mcy8gS+fYyyXFRcDVQpXgr7nDVEZYc6+Pq9ajFu?= =?us-ascii?Q?WmefySeLz3zn3rchgcytbyt4srfHH8FuYLgsYRD?= =?us-ascii?Q?3WTVvJnqa+pjLp+YiWWS7sJrBg1gctizipnkZME?= =?us-ascii?Q?ZDE596O1phlDa+ubWIU5aVOnBlck1jGij=2FzDfqH?= =?us-ascii?Q?0HPKDUoCFyW4hz7pkucxT+9=2FdEBa+46wx+VBaE2?= =?us-ascii?Q?nwlcQQ8Jza2s3Imp26ms4stvxyZxOmSVcJckYs9?= =?us-ascii?Q?RIrOolGkOxtogv4AMdqiHte5g6aFKHm4LQu+keU?= =?us-ascii?Q?boxy19vg=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: VYWD3UYU32ZZBHDNNIOQIS6DNKTYKT5P X-Message-ID-Hash: VYWD3UYU32ZZBHDNNIOQIS6DNKTYKT5P X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:117527] [Ruby master Feature#20351] Optionally extract common GC routines into a DSO List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "eightbitraptor (Matthew Valentine-House) via ruby-core" Cc: "eightbitraptor (Matthew Valentine-House)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20351 has been updated by eightbitraptor (Matthew Valentine-House). Do you have an idea of a timeline for Ractor local GC? Is there an open feature request I can read (I've searched on Redmine and I can't find one). It's hard for us to assess any collisions between this work and Ractor local GC at the current time as I'm unsure about the implementation details. Our intention is to allow the GC to be overloaded in such a way that multiple heaps can be initialised and managed independently, in isolation from each other or the VM, so potentially each Ractor could use this feature to manage it's own heap. To be clear this feature request and the associated PR are only providing some of the base mechanism to allow us to experiment. We have not committed to an approach at this stage. With our current knowledge I believe it is possible to accommodate per-ractor GC and we will be careful to think about this in our design. In order to do this it would be very useful to have some guidance on the current per-ractor GC work. ---------------------------------------- Feature #20351: Optionally extract common GC routines into a DSO https://bugs.ruby-lang.org/issues/20351#change-107917 * Author: eightbitraptor (Matthew Valentine-House) * Status: Closed ---------------------------------------- **UPDATE: Based on feedback on the original PR (thank you @katei and @nobu) we have changed our approach to this project.** **An updated PR can be found here: [[GH #10456]](https://github.com/ruby/ruby/pull/10456)** --- ~~[Github PR#10302](https://github.com/ruby/ruby/pull/10302)~~ **NOTE: This proposal does not change the default build of Ruby, and therefore should NOT cause performance degradation for Ruby built in the usual way** Our long term goal is to standardise Ruby's GC interface, allowing alternative GC implementations to be used. This will be acheived by optionally building Ruby's GC as a shared object; enabling it to be replaced at runtime using using `LD_LIBRARY_PATH`. eg: ``` LD_LIBRARY_PATH=/custom_gc_location ruby script.rb ``` This ticket proposes the first step towards this goal. A new experimental build option, `--enable-shared-gc`, that will compile and link a module into the built `ruby` binary as a shared object - `miniruby` will remain statically linked to the existing GC in all cases. Similar methods of replacing functionality relied on by Ruby have precedent. `jemalloc` uses `LD_PRELOAD` to replace `glibc` provided `malloc` and `free` at runtime. Although this project will be the first time a technique such as this has been used to replace core Ruby functionality. This flag will be marked as experimental & **disabled by default**. [The PR linked from this ticket](https://github.com/ruby/ruby/pull/10302) implements the new build flag, along with the absolute minimum code required to test it's implementation (a single debug function). The implementation of the new build flag is based on the existing implementation of `--enable-shared` and behaves as follows: - `--enable-shared --enable-shared-gc` This will build both `libruby` and `librubygc` as shared objects. `ruby` will link dynamically to both `libruby` and `librubygc`. - `--disable-shared --enable-shared-gc` This will build `librubygc` as a shared object, and build `libruby` as a static object. `libruby` will link dynamically to `librubygc` and `ruby` will be statically linked to `libruby`. - `--disable-shared-gc` **This will be the default**, and when this case is true the build behaviour will be exactly the same as it is currently. ie. the existing Ruby GC will be built and linked statically into either `ruby` or `libruby.so` depending on the state of `--enable-shared`. We are aware that there will be a small performance penalty from moving the GC logic into a shared object, but this is an opt-in configuration turned on at build time intended to be used by experienced users. Still, we anticipate that, even with this configuration turned on, this penalty will be negligible compared the the benefit that being able to use high performance GC algorithms will provide. This performance penalty is also the reason that **this feature will be disabled by default**. There will be no performance impact for anyone compiling Ruby in the usual manner, without explicitly enabling this feature. We have discussed this proposal with @matz who has approved our work on this project - having a clear abstraction between the VM and the GC will enable us to iterate faster on improvements to Ruby's existing GC. ## Motivation In the long term we want to provide the ability to override the current Ruby GC implementation in order to: * Experiment with modern high-performance GC implementations, such as Immix, G1, LXR etc. * Easily split-test changes to the GC, or the GC tuning, in production without having to rebuild Ruby * Easily use debug builds of the GC to help identify production problems and bottlenecks without having to rebuild Ruby * Encourage the academic memory management research community to consider Ruby for their research (the current work on [MMTk & Ruby](https://github.com/mmtk/mmtk-ruby) is a good example of this). ## Future work The initial implementation of the shared GC module in this PR is deliberately small, and exists only for testing the build system integration. The next steps are to identify boundaries between the GC and the VM and begin to extract common functionality into this GC wrapper module to serve as the foundation of our GC interface. ## Who's working on this - @eightbitraptor - @tenderlovemaking - @peterzhu2118 - @eileencodes -- 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/postorius/lists/ruby-core.ml.ruby-lang.org/