Skip to content

Commit ab4e554

Browse files
committed
Update README.md
1 parent 4b67c8b commit ab4e554

File tree

1 file changed

+7
-48
lines changed

1 file changed

+7
-48
lines changed

README.md

Lines changed: 7 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,14 @@ This repository holds the [MMTk](https://www.mmtk.io/) bindings for Ruby. The bi
66

77
### Building
88

9-
Since this repository is sync'd into [ruby/ruby](https://github.com/ruby/ruby/), you can choose to either build it in this repository or build it in ruby/ruby. If you're building it in this repository, note that it is only expected to work on the latest commit of Ruby master.
10-
11-
To build `librubygc.mmtk.so` locally, run the following:
12-
13-
```sh
14-
rake compile
15-
```
16-
This command will:
17-
18-
- **Clone the Ruby repository**: If you don't already have it, the script clones Ruby into `res/ruby`.
19-
- **Copy MMTk GC code**: It copies the MMTk garbage collector code into the Ruby source tree.
20-
- **Configure and build Ruby**: Sets up the build configurations to integrate MMTk with Ruby's garbage collector API.
21-
- **Compiling the MMTk shared library**: Builds `librubygc.mmtk.so` using Rust's Cargo build system.
22-
- **Install the shared library**: Copies `librubygc.mmtk.so` into the `mod_gc` directory.
23-
24-
Once it's done, you'll have a shared object `mod_gc/librubygc.mmtk.so` (`modgc/librubygc.mmtk.bundle` on macOS), that can be loaded into any Ruby interpeter built `--with-shared-gc` support using the path.
25-
26-
Example:
27-
28-
```
29-
./configure --with-shared-gc=$HOME/mmtk/mod_gc
30-
```
31-
32-
Successful builds, when loaded, will display `+GC[mmtk]` in the Ruby version string. This indicates that Ruby has been compiled with shared GC support and that MMTk is loaded.
33-
34-
```sh
35-
RUBY_GC_LIBRARY=mmtk ruby -v
36-
ruby 3.4.0dev (2024-11-25T13:05:23Z master f127bcb829) +PRISM +GC[mmtk] [arm64-darwin24]
37-
```
38-
39-
**Note**: Make sure you have all the necessary dependencies installed:
40-
41-
- **Rust toolchain**: Required for building MMTk.
42-
- **Ruby build dependencies**: Libraries and tools needed to compile Ruby from source.
43-
- **Rake**: Ruby's build program, used to run the compile task.
44-
45-
That's it! You're all set to experiment with different GC algorithms in Ruby using MMTk.
46-
47-
48-
49-
50-
51-
52-
9+
> [!NOTE]
10+
> This repository is synchronized into [ruby/ruby](https://github.com/ruby/ruby/), you can choose to either build it in this repository or build it in ruby/ruby. If you're building it in this repository, note that it is only expected to work on the latest commit of Ruby master.
5311
12+
1. Ensure you have the Rust toolchain installed. You can follow [these instructions](https://www.rust-lang.org/tools/install) to install it.
13+
1. Ensure that you are running with Ruby from the latest commit of Ruby master and your Ruby is configured with `--with-modular-gc`. If you're unsure how to do this, refer to the ["building guide"](https://github.com/ruby/ruby/tree/master/gc#building-guide) for Modular GC.
14+
1. Run `bundle install`.
15+
1. Run `bundle exec rake` to compile and install MMTk as a Modular GC.
16+
1. You can now run Ruby with environment variable `RUBY_GC_LIBRARY=mmtk` to use MMTk.
5417

5518
### Running
5619

@@ -60,7 +23,3 @@ After building Ruby and the MMTk bindings, run Ruby with `RUBY_GC_LIBRARY=mmtk`
6023
- `MMTK_HEAP_MODE=<fixed|dynamic>`: Configures the MMTk heap used. `fixed` is a fixed size heap, `dynamic` is a dynamic sized heap that will grow and shrink in size based on heuristics using the [MemBalancer](https://dl.acm.org/doi/pdf/10.1145/3563323) algorithm. Defaults to `dynamic`.
6124
- `MMTK_HEAP_MIN=<size>`: Configures the lower bound in heap memory usage by MMTk. Only valid when `MMTK_HEAP_MODE=dynamic`. `size` is in bytes, but you can also append `KiB`, `MiB`, `GiB` for larger sizes. Defaults to 1MiB.
6225
- `MMTK_HEAP_MAX=<size>`: Configures the upper bound in heap memory usage by MMTk. Once this limit is reached and no objects can be garbage collected, it will crash with an out-of-memory. `size` is in bytes, but you can also append `KiB`, `MiB`, `GiB` for larger sizes. Defaults to 80% of your system RAM.
63-
64-
## Code structure
65-
66-
TODO

0 commit comments

Comments
 (0)