forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
36: Delete boehm specific code r=ltratt a=jacob-hughes This is now being served from the softdev/boehm_allocator crate, which contains code needed for both rboehm and rustc_boehm. Co-authored-by: Jacob Hughes <jh@jakehughes.uk>
- Loading branch information
Showing
10 changed files
with
59 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
# rboehm | ||
A Rust API for the Boehm-Demers-Weiser garbage collector | ||
# libgc | ||
|
||
libgc is a garbage collector for Rust. It works by providing a garbage-collected | ||
`Gc<T>` smart pointer in the style of `Rc<T>`. | ||
|
||
# Structure | ||
|
||
There are three repositories which make up the gc infrastructure: | ||
- **libgc** the main library which provides the `Gc<T>` smart pointer and its | ||
API. | ||
- **libgc_internal** contains the gc allocation and collector logic. This is | ||
collector specific, and can be conditionally compiled to support different | ||
implementations. At the moment, it only supports a single collector | ||
implementation: the Boehm-Demers-Weiser GC. Users should never interact | ||
directly with this crate. Instead, any relevant APIs are re-exported | ||
through libgc. | ||
- **rustgc** a fork of rustc with GC-aware optimisations. This can be used to | ||
compile user programs which use `libgc`, giving them better GC | ||
performance. Use of rustgc is not mandated, but it enables further | ||
optimisations for programs which use `libgc`. | ||
|
||
This seperation between libgc and rustgc exists so that a stripped-down form of | ||
garbage collection can be used without compiler support. The further split | ||
between libgc and libgc_core exists to make linkage easier when the rustgc | ||
compiler is used. | ||
|
||
rustgc needs access to the GC's `Allocator` implementation. This exists in the | ||
libgc_internal crate so that it can be linked to the target binary either as | ||
part of libgc, or as part of the rust standard library (if compiled with | ||
rustgc). libgc contains code which would not compile if it was packaged as part | ||
of rustgc. To prevent duplication, the libgc_interal crate will link correctly | ||
as either a standard cargo crate, or as part of the rust core library. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,3 @@ | ||
use std::sync::atomic::{AtomicUsize, Ordering}; | ||
|
||
pub static NUM_REGISTERED_FINALIZERS: AtomicUsize = AtomicUsize::new(0); | ||
|
||
#[derive(Debug)] | ||
pub struct GcStats { | ||
total_gc_time: usize, // In milliseconds. | ||
num_collections: usize, | ||
finalizers_registered: usize, | ||
total_freed: usize, // In bytes | ||
total_alloced: usize, // In bytes | ||
} | ||
|
||
#[cfg(feature = "gc_stats")] | ||
impl From<boehm::BoehmStats> for GcStats { | ||
fn from(item: boehm::BoehmStats) -> Self { | ||
GcStats { | ||
total_gc_time: item.total_gc_time, | ||
num_collections: item.num_collections, | ||
finalizers_registered: NUM_REGISTERED_FINALIZERS.load(Ordering::Relaxed), | ||
total_freed: item.total_freed, | ||
total_alloced: item.total_alloced, | ||
} | ||
} | ||
} | ||
|
||
#[cfg(feature = "gc_stats")] | ||
pub fn get_stats() -> GcStats { | ||
GcStats::from(boehm::BoehmStats::gen()) | ||
} |