4 Commits

Author SHA1 Message Date
Yota Toyama
e11647fab9 Merge branch 'main' into chore/pointer-mask 2023-09-28 15:55:11 +10:00
Yota Toyama
08d549315b Fix 2023-09-24 20:23:45 +10:00
Yota Toyama
a4bcbf2c7b Call memalign 2023-09-24 17:01:53 +10:00
Yota Toyama
5f41a2b8e2 Set pointer mask 2023-09-24 16:56:08 +10:00
29 changed files with 111 additions and 357 deletions

View File

@@ -3,9 +3,7 @@
"autogen", "autogen",
"autotools", "autotools",
"bdwgc", "bdwgc",
"canonicalize",
"cflag", "cflag",
"clippy",
"dealloc", "dealloc",
"finalizer", "finalizer",
"gcollect", "gcollect",
@@ -15,7 +13,6 @@
"repr", "repr",
"rustc", "rustc",
"stackbottom", "stackbottom",
"swatinem",
"unregisters" "unregisters"
] ]
} }

1
.envrc
View File

@@ -1 +0,0 @@
use flake

11
.github/mergify.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
pull_request_rules:
- name: dependabot
conditions:
- author=dependabot[bot]
actions:
queue:
name: default
method: squash
queue_rules:
- name: default
conditions: []

View File

@@ -1,13 +0,0 @@
name: dependabot
on: pull_request
permissions:
contents: write
pull-requests: write
jobs:
merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- run: gh pr merge --auto --squash ${{ github.event.pull_request.html_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -8,25 +8,27 @@ jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- uses: swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo clippy -- -D warnings - run: cargo clippy -- -D warnings
format: format:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- run: cargo fmt -- --check - run: cargo fmt -- --check
spell-check: spell-check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: streetsidesoftware/cspell-action@main - uses: streetsidesoftware/cspell-action@main
with: with:
files: "**/*.{md,rs}" files: "**/*.{md,rs}"
readme: readme:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: lycheeverse/lychee-action@v2 - uses: lycheeverse/lychee-action@v1
with:
fail: true

View File

@@ -1,29 +0,0 @@
name: release
on:
push:
branches:
- main
pull_request:
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
release:
permissions:
id-token: write
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'release' || '' }}
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: swatinem/rust-cache@v2
- run: cargo install cargo-workspaces
- uses: rust-lang/crates-io-auth-action@v1
id: auth
if: github.ref == 'refs/heads/main'
- run: >
cargo workspaces publish -y --from-git --no-verify
${{ github.ref != 'refs/heads/main' && '--dry-run' || '' }}
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

View File

@@ -8,32 +8,32 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- uses: swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo build - run: cargo build
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- uses: swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo test - run: cargo test
examples: examples:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- uses: swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: tools/example_test.sh - run: examples/test.sh
cmake: cmake:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true
- uses: swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- run: cargo build --no-default-features --features cmake - run: cargo build --no-default-features --features cmake

3
.gitignore vendored
View File

@@ -1,3 +1,2 @@
.cargo_cache *.lock
target target
.direnv

4
.gitmodules vendored
View File

@@ -1,6 +1,6 @@
[submodule "vendor/bdwgc"] [submodule "vendor/bdwgc"]
path = vendor/bdwgc path = vendor/bdwgc
url = https://github.com/bdwgc/bdwgc url = https://github.com/ivmai/bdwgc
[submodule "vendor/libatomic_ops"] [submodule "vendor/libatomic_ops"]
path = vendor/libatomic_ops path = vendor/libatomic_ops
url = https://github.com/bdwgc/libatomic_ops url = https://github.com/ivmai/libatomic_ops

86
Cargo.lock generated
View File

@@ -1,86 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "autotools"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef941527c41b0fc0dd48511a8154cd5fc7e29200a0ff8b7203c5d777dbc795cf"
dependencies = [
"cc",
]
[[package]]
name = "bdwgc-alloc"
version = "0.6.13"
dependencies = [
"autotools",
"cmake",
"libc",
]
[[package]]
name = "cc"
version = "1.2.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215"
dependencies = [
"find-msvc-tools",
"shlex",
]
[[package]]
name = "cmake"
version = "0.1.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"
dependencies = [
"cc",
]
[[package]]
name = "dynamic_threads"
version = "0.1.0"
dependencies = [
"bdwgc-alloc",
]
[[package]]
name = "find-msvc-tools"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"
[[package]]
name = "free_by_borrow"
version = "0.1.0"
dependencies = [
"bdwgc-alloc",
]
[[package]]
name = "free_by_gc"
version = "0.1.0"
dependencies = [
"bdwgc-alloc",
]
[[package]]
name = "libc"
version = "0.2.186"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "static_threads"
version = "0.1.0"
dependencies = [
"bdwgc-alloc",
]

View File

@@ -1,29 +1,21 @@
[package] [package]
name = "bdwgc-alloc" name = "bdwgc-alloc"
version = "0.6.13"
edition = "2024"
description = "impl GlobalAlloc for bdwgc" description = "impl GlobalAlloc for bdwgc"
version = "0.6.7"
authors = [
"swgillespie <sean.william.g@gmail.com>",
"Yota Toyama <raviqqe@gmail.com>",
]
repository = "https://github.com/raviqqe/bdwgc-alloc" repository = "https://github.com/raviqqe/bdwgc-alloc"
edition = "2021"
license = "MIT" license = "MIT"
categories = ["api-bindings", "memory-management", "no-std", "no-std::no-alloc"]
[workspace]
resolver = "3"
members = ["examples/*"]
[dependencies]
libc = "0.2.186"
[build-dependencies]
autotools = { version = "0.2.7", optional = true }
cmake = { version = "0.1.58", optional = true }
[features] [features]
default = ["autotools"] default = ["autotools"]
[lints.clippy] [dependencies]
alloc_instead_of_core = "deny" libc = "0.2"
dbg_macro = "deny"
missing_const_for_fn = "deny" [build-dependencies]
std_instead_of_alloc = "deny" autotools = { version = "0.2", optional = true }
std_instead_of_core = "deny" cmake = { version = "0.1", optional = true }

View File

@@ -1,8 +1,8 @@
# bdwgc-rust # bdwgc-alloc
[![GitHub Action](https://img.shields.io/github/actions/workflow/status/bdwgc/bdwgc-rust/test.yaml?branch=main&style=flat-square)](https://github.com/bdwgc/bdwgc-rust/actions) [![GitHub Action](https://img.shields.io/github/actions/workflow/status/raviqqe/bdwgc-alloc/test.yaml?branch=main&style=flat-square)](https://github.com/raviqqe/bdwgc-alloc/actions)
[![Crate](https://img.shields.io/crates/v/bdwgc-alloc.svg?style=flat-square)](https://crates.io/crates/bdwgc-alloc) [![Crate](https://img.shields.io/crates/v/bdwgc-alloc.svg?style=flat-square)](https://crates.io/crates/bdwgc-alloc)
[![License](https://img.shields.io/github/license/bdwgc/bdwgc-rust.svg?style=flat-square)](LICENSE) [![License](https://img.shields.io/github/license/raviqqe/bdwgc-alloc.svg?style=flat-square)](LICENSE)
[`GlobalAlloc`](https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html) implementation for [`bdwgc`][bdwgc], the conservative garbage collector. [`GlobalAlloc`](https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html) implementation for [`bdwgc`][bdwgc], the conservative garbage collector.
@@ -22,4 +22,4 @@ cargo build --no-default-features --features cmake
[MIT](LICENSE) [MIT](LICENSE)
[bdwgc]: https://github.com/bdwgc/bdwgc [bdwgc]: https://github.com/ivmai/bdwgc

View File

@@ -6,7 +6,7 @@ fn main() {
for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] { for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] {
std::process::Command::new("sh") std::process::Command::new("sh")
.arg("-c") .arg("-c")
.arg(format!("cd {dir} && ./autogen.sh")) .arg(format!("cd {} && ./autogen.sh", dir))
.output() .output()
.unwrap(); .unwrap();
} }
@@ -17,28 +17,27 @@ fn main() {
println!( println!(
"cargo:rustc-link-search=native={}", "cargo:rustc-link-search=native={}",
dst.join("lib64").display() dst.join("lib").display()
); );
println!("cargo:rustc-link-lib=static=atomic_ops"); println!("cargo:rustc-link-lib=static=atomic_ops");
let dst = autotools::Config::new(LIB_GC_DIR) let dst = autotools::Config::new(LIB_GC_DIR)
.cflag(format!( .cflag(format!(
// spell-checker: disable-next-line "-I{} -L/lib/x86_64-linux-gnu -lpthread -fPIC -D POINTER_MASK=0x7",
"-I{} -L/lib/x86_64-linux-gnu -lpthread -fPIC",
dst.join("include").display() dst.join("include").display()
)) ))
.build(); .build();
println!( println!(
"cargo:rustc-link-search=native={}", "cargo:rustc-link-search=native={}",
dst.join("lib64").display() dst.join("lib").display()
); );
println!("cargo:rustc-link-lib=static=gc"); println!("cargo:rustc-link-lib=static=gc");
for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] { for dir in &[LIB_ATOMIC_OPS_DIR, LIB_GC_DIR] {
std::process::Command::new("sh") std::process::Command::new("sh")
.arg("-c") .arg("-c")
.arg(format!("cd {dir} && git clean -dfx")) .arg(format!("cd {} && git clean -dfx", dir))
.output() .output()
.unwrap(); .unwrap();
} }
@@ -59,13 +58,16 @@ fn main() {
let dst = Config::new(LIB_GC_DIR) let dst = Config::new(LIB_GC_DIR)
.profile("Release") .profile("Release")
.define("GC_BUILD_SHARED_LIBS", "FALSE") .define("BUILD_SHARED_LIBS", "FALSE")
.cflag(format!("-I{}", libatomic_include_path)) .cflag(format!(
"-I{} -DPOINTER_MASK=0x7",
libatomic_include_path, foo
))
.build(); .build();
println!( println!(
"cargo:rustc-link-search=native={}", "cargo:rustc-link-search=native={}",
dst.join("lib64").display() dst.join("lib").display()
); );
println!("cargo:rustc-link-lib=static=gc"); println!("cargo:rustc-link-lib=static=gc");
} }

8
examples/Cargo.toml Normal file
View File

@@ -0,0 +1,8 @@
[workspace]
resolver = "2"
members = [
"dynamic_threads",
"free_by_borrow",
"free_by_gc",
"static_threads",
]

View File

@@ -1,7 +1,8 @@
[package] [package]
name = "dynamic_threads" name = "dynamic_threads"
version = "0.1.0" version = "0.1.0"
edition = "2024" authors = ["Yota Toyama <raviqqe@gmail.com>"]
edition = "2021"
publish = false publish = false
[dependencies] [dependencies]

View File

@@ -1,7 +1,8 @@
[package] [package]
name = "free_by_borrow" name = "free_by_borrow"
version = "0.1.0" version = "0.1.0"
edition = "2024" authors = ["Yota Toyama <raviqqe@gmail.com>"]
edition = "2021"
publish = false publish = false
[dependencies] [dependencies]

View File

@@ -1,7 +1,8 @@
[package] [package]
name = "free_by_gc" name = "free_by_gc"
version = "0.1.0" version = "0.1.0"
edition = "2024" authors = ["Yota Toyama <raviqqe@gmail.com>"]
edition = "2021"
publish = false publish = false
[dependencies] [dependencies]

View File

@@ -1,7 +1,8 @@
[package] [package]
name = "static_threads" name = "static_threads"
version = "0.1.0" version = "0.1.0"
edition = "2024" authors = ["Yota Toyama <raviqqe@gmail.com>"]
edition = "2021"
publish = false publish = false
[dependencies] [dependencies]

12
examples/test.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
set -ex
cd $(dirname $0)
for cargo_file in */Cargo.toml; do
cargo run --bin $(dirname $cargo_file) &
pid=$!
sleep 20
kill $pid
done

66
flake.lock generated
View File

@@ -1,66 +0,0 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1779185128,
"narHash": "sha256-Kl2bkmwZJD3n2KWDxuIlturZ7emqRK+anpD1LmDwpmY=",
"owner": "nix-community",
"repo": "fenix",
"rev": "b7bd9323fe26a3b4f4bddbb2c2a1dacabced2f88",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1778869304,
"narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d233902339c02a9c334e7e593de68855ad26c4cb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"fenix": "fenix",
"nixpkgs": "nixpkgs"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1779074864,
"narHash": "sha256-0M3WqsWmtXmv9Ev/vnFfCHosWvISDwiuuhQ104UO3CI=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "cdfe408d4b436e806ff525cb3e67588a6a009ed1",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@@ -1,54 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, fenix, ... }:
let
supportedSystems = [
"aarch64-darwin" "aarch64-linux"
"x86_64-darwin" "x86_64-linux"
];
each-system = f: nixpkgs.lib.genAttrs supportedSystems (system: f rec {
pkgs = import nixpkgs {
inherit system overlays;
};
inherit (pkgs) lib;
inherit system;
});
overlays = [
fenix.overlays.default
];
in {
_pkgs = each-system ({ pkgs, ... }: pkgs);
devShells = each-system ({ pkgs, lib, ... }: {
default = pkgs.mkShell {
packages = [
pkgs.pkg-config
(pkgs.fenix.complete.withComponents [
"cargo" "clippy" "rust-src" "rustc" "rustfmt"
])
pkgs.rust-analyzer-nightly
pkgs.cmake
];
};
});
};
nixConfig = {
extra-substituters = [
"https://fenix.cachix.org"
];
extra-trusted-public-keys = [
"fenix.cachix.org-1:ecJhr+RdYEdcVgUkjruiYhjbBloIEGov7bos90cZi0Q="
];
};
}

1
rust-toolchain Normal file
View File

@@ -0,0 +1 @@
stable

View File

@@ -1,3 +0,0 @@
[toolchain]
channel = "stable"
components = ["clippy", "rustfmt", "rust-analyzer", "rust-src"]

View File

@@ -1,4 +1,4 @@
use core::{ use std::{
error, error,
fmt::{self, Display, Formatter}, fmt::{self, Display, Formatter},
}; };
@@ -9,7 +9,7 @@ pub struct Error {
} }
impl Error { impl Error {
pub const fn new(description: &'static str) -> Error { pub fn new(description: &'static str) -> Error {
Error { description } Error { description }
} }
} }

View File

@@ -1,9 +1,10 @@
#![doc = include_str!("../README.md")] #![doc = include_str!("../README.md")]
#![no_std]
extern crate alloc;
mod error; mod error;
use core::alloc::{GlobalAlloc, Layout}; use alloc::alloc::{GlobalAlloc, Layout};
use core::ptr::null; use core::ptr::null;
use libc::{c_int, c_void, size_t}; use libc::{c_int, c_void, size_t};
@@ -16,7 +17,7 @@ struct GcStackBase {
} }
#[link(name = "gc", kind = "static")] #[link(name = "gc", kind = "static")]
unsafe extern "C" { extern "C" {
fn GC_allow_register_threads(); fn GC_allow_register_threads();
fn GC_alloc_lock(); fn GC_alloc_lock();
fn GC_alloc_unlock(); fn GC_alloc_unlock();
@@ -24,6 +25,7 @@ unsafe extern "C" {
fn GC_get_stack_base(stack_base: *mut GcStackBase) -> c_int; fn GC_get_stack_base(stack_base: *mut GcStackBase) -> c_int;
fn GC_init(); fn GC_init();
fn GC_malloc(size: size_t) -> *mut c_void; fn GC_malloc(size: size_t) -> *mut c_void;
fn GC_memalign(align: size_t, size: size_t) -> *mut c_void;
fn GC_realloc(ptr: *mut c_void, size: size_t) -> *mut c_void; fn GC_realloc(ptr: *mut c_void, size: size_t) -> *mut c_void;
fn GC_register_my_thread(stack_base: *const GcStackBase) -> c_int; fn GC_register_my_thread(stack_base: *const GcStackBase) -> c_int;
fn GC_set_stackbottom(thread: *const c_void, stack_bottom: *const GcStackBase); fn GC_set_stackbottom(thread: *const c_void, stack_bottom: *const GcStackBase);
@@ -57,10 +59,8 @@ impl Allocator {
/// ///
/// This function must be called in a main thread. /// This function must be called in a main thread.
pub unsafe fn initialize() { pub unsafe fn initialize() {
unsafe { GC_init();
GC_init(); GC_allow_register_threads();
GC_allow_register_threads();
}
} }
/// Registers a current thread to a collector. /// Registers a current thread to a collector.
@@ -71,9 +71,9 @@ impl Allocator {
pub unsafe fn register_current_thread() -> Result<(), error::Error> { pub unsafe fn register_current_thread() -> Result<(), error::Error> {
let mut base = GcStackBase { mem_base: null() }; let mut base = GcStackBase { mem_base: null() };
if unsafe { GC_get_stack_base(&mut base) } != GC_SUCCESS { if GC_get_stack_base(&mut base) != GC_SUCCESS {
return Err(error::Error::new("failed to get stack base")); return Err(error::Error::new("failed to get stack base"));
} else if unsafe { GC_register_my_thread(&base) } != GC_SUCCESS { } else if GC_register_my_thread(&base) != GC_SUCCESS {
return Err(error::Error::new("failed to register a thread for GC")); return Err(error::Error::new("failed to register a thread for GC"));
} }
@@ -89,14 +89,12 @@ impl Allocator {
/// ///
/// The bottom address must be valid. /// The bottom address must be valid.
pub unsafe fn set_stack_bottom(bottom: *const u8) { pub unsafe fn set_stack_bottom(bottom: *const u8) {
unsafe { GC_set_stackbottom(
GC_set_stackbottom( null(),
null(), &GcStackBase {
&GcStackBase { mem_base: bottom as *const libc::c_void,
mem_base: bottom as *const libc::c_void, },
}, )
)
}
} }
/// Unregisters a current thread from a collector. /// Unregisters a current thread from a collector.
@@ -105,7 +103,7 @@ impl Allocator {
/// ///
/// The thread must be registered already. /// The thread must be registered already.
pub unsafe fn unregister_current_thread() { pub unsafe fn unregister_current_thread() {
unsafe { GC_unregister_my_thread() } GC_unregister_my_thread()
} }
/// Runs a garbage collection forcibly. /// Runs a garbage collection forcibly.
@@ -123,20 +121,20 @@ impl Allocator {
finalizer: extern "C" fn(*mut c_void, *mut c_void), finalizer: extern "C" fn(*mut c_void, *mut c_void),
client_data: *const c_void, client_data: *const c_void,
) { ) {
unsafe { GC_register_finalizer(ptr, finalizer, client_data, null(), null()) }; GC_register_finalizer(ptr, finalizer, client_data, null(), null());
} }
} }
unsafe impl GlobalAlloc for Allocator { unsafe impl GlobalAlloc for Allocator {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 { unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
(unsafe { GC_malloc(layout.size()) }) as *mut u8 GC_memalign(layout.align(), layout.size()) as *mut u8
} }
unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) { unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) {
unsafe { GC_free(ptr as *mut c_void) } GC_free(ptr as *mut c_void)
} }
unsafe fn realloc(&self, ptr: *mut u8, _layout: Layout, size: usize) -> *mut u8 { unsafe fn realloc(&self, ptr: *mut u8, _layout: Layout, size: usize) -> *mut u8 {
(unsafe { GC_realloc(ptr as *mut c_void, size) }) as *mut u8 GC_realloc(ptr as *mut c_void, size) as *mut u8
} }
} }

View File

@@ -1,20 +0,0 @@
#!/bin/sh
set -ex
duration=20
cd $(dirname $0)/..
for directory in $(ls examples); do
(
cd examples/$directory
cargo build
cargo run &
pid=$!
sleep $duration
kill $pid
)
done

2
vendor/bdwgc vendored