Bump version (#465)

This commit is contained in:
Yota Toyama
2025-09-19 08:44:19 -07:00
committed by GitHub
parent 03b3e65fc8
commit 5a34f4f9ef
4 changed files with 33 additions and 29 deletions

View File

@@ -9,6 +9,8 @@ concurrency:
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:
@@ -17,7 +19,9 @@ jobs:
submodules: true
- uses: raviqqe/cargo-cache@v1
- run: cargo install cargo-workspaces
- run: cargo workspaces publish -y --from-git --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- uses: rust-lang/crates-io-auth-action@v1
id: auth
if: github.ref == 'refs/heads/main'
- run: cargo workspaces publish -y --from-git ${{ github.ref != 'refs/heads/main' && '--dry-run' || '' }}
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

2
Cargo.lock generated
View File

@@ -13,7 +13,7 @@ dependencies = [
[[package]]
name = "bdwgc-alloc"
version = "0.6.10"
version = "0.6.11"
dependencies = [
"autotools",
"cmake",

View File

@@ -1,21 +1,17 @@
[package]
name = "bdwgc-alloc"
version = "0.6.11"
edition = "2024"
description = "impl GlobalAlloc for bdwgc"
version = "0.6.10"
authors = [
"swgillespie <sean.william.g@gmail.com>",
"Yota Toyama <raviqqe@gmail.com>",
]
repository = "https://github.com/raviqqe/bdwgc-alloc"
edition = "2021"
license = "MIT"
[features]
default = ["autotools"]
[dependencies]
libc = "0.2"
[build-dependencies]
autotools = { version = "0.2", optional = true }
cmake = { version = "0.1", optional = true }
[features]
default = ["autotools"]

View File

@@ -17,7 +17,7 @@ struct GcStackBase {
}
#[link(name = "gc", kind = "static")]
extern "C" {
unsafe extern "C" {
fn GC_allow_register_threads();
fn GC_alloc_lock();
fn GC_alloc_unlock();
@@ -58,9 +58,11 @@ impl Allocator {
///
/// This function must be called in a main thread.
pub unsafe fn initialize() {
unsafe {
GC_init();
GC_allow_register_threads();
}
}
/// Registers a current thread to a collector.
///
@@ -70,9 +72,9 @@ impl Allocator {
pub unsafe fn register_current_thread() -> Result<(), error::Error> {
let mut base = GcStackBase { mem_base: null() };
if GC_get_stack_base(&mut base) != GC_SUCCESS {
if unsafe { GC_get_stack_base(&mut base) } != GC_SUCCESS {
return Err(error::Error::new("failed to get stack base"));
} else if GC_register_my_thread(&base) != GC_SUCCESS {
} else if unsafe { GC_register_my_thread(&base) } != GC_SUCCESS {
return Err(error::Error::new("failed to register a thread for GC"));
}
@@ -88,6 +90,7 @@ impl Allocator {
///
/// The bottom address must be valid.
pub unsafe fn set_stack_bottom(bottom: *const u8) {
unsafe {
GC_set_stackbottom(
null(),
&GcStackBase {
@@ -95,6 +98,7 @@ impl Allocator {
},
)
}
}
/// Unregisters a current thread from a collector.
///
@@ -102,7 +106,7 @@ impl Allocator {
///
/// The thread must be registered already.
pub unsafe fn unregister_current_thread() {
GC_unregister_my_thread()
unsafe { GC_unregister_my_thread() }
}
/// Runs a garbage collection forcibly.
@@ -120,20 +124,20 @@ impl Allocator {
finalizer: extern "C" fn(*mut c_void, *mut c_void),
client_data: *const c_void,
) {
GC_register_finalizer(ptr, finalizer, client_data, null(), null());
unsafe { GC_register_finalizer(ptr, finalizer, client_data, null(), null()) };
}
}
unsafe impl GlobalAlloc for Allocator {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
GC_malloc(layout.size()) as *mut u8
(unsafe { GC_malloc(layout.size()) }) as *mut u8
}
unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) {
GC_free(ptr as *mut c_void)
unsafe { GC_free(ptr as *mut c_void) }
}
unsafe fn realloc(&self, ptr: *mut u8, _layout: Layout, size: usize) -> *mut u8 {
GC_realloc(ptr as *mut c_void, size) as *mut u8
(unsafe { GC_realloc(ptr as *mut c_void, size) }) as *mut u8
}
}