forked from GitHub/bdwgc-rust
Compare commits
12 Commits
v0.6.8
...
feature/ta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56de2259dd | ||
|
|
b540c0597c | ||
|
|
10ffdd9351 | ||
|
|
0bd260a7c0 | ||
|
|
6cb47fddd0 | ||
|
|
039a10213d | ||
|
|
b204c1a6a2 | ||
|
|
44fff26f2f | ||
|
|
ef9675ab17 | ||
|
|
4bf1effc4b | ||
|
|
1aaf2fb621 | ||
|
|
25631ef919 |
11
.github/mergify.yml
vendored
Normal file
11
.github/mergify.yml
vendored
Normal 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: []
|
||||
13
.github/workflows/dependabot.yaml
vendored
13
.github/workflows/dependabot.yaml
vendored
@@ -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 }}
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "bdwgc-alloc"
|
||||
description = "impl GlobalAlloc for bdwgc"
|
||||
version = "0.6.8"
|
||||
version = "0.6.7"
|
||||
authors = [
|
||||
"swgillespie <sean.william.g@gmail.com>",
|
||||
"Yota Toyama <raviqqe@gmail.com>",
|
||||
|
||||
@@ -5,4 +5,5 @@ members = [
|
||||
"free_by_borrow",
|
||||
"free_by_gc",
|
||||
"static_threads",
|
||||
"tagged_pointer",
|
||||
]
|
||||
|
||||
9
examples/tagged_pointer/Cargo.toml
Normal file
9
examples/tagged_pointer/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "tagged_pointer"
|
||||
version = "0.1.0"
|
||||
authors = ["Yota Toyama <raviqqe@gmail.com>"]
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
bdwgc-alloc = { path = "../.." }
|
||||
27
examples/tagged_pointer/src/main.rs
Normal file
27
examples/tagged_pointer/src/main.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use bdwgc_alloc::Allocator;
|
||||
use std::alloc::{alloc, Layout};
|
||||
|
||||
const BITS: usize = usize::MAX << 48 | 0x7;
|
||||
|
||||
#[global_allocator]
|
||||
static GLOBAL_ALLOCATOR: Allocator = Allocator;
|
||||
|
||||
fn main() {
|
||||
unsafe { Allocator::initialize() }
|
||||
|
||||
loop {
|
||||
let x = allocate();
|
||||
unsafe { *x = 42 };
|
||||
let x = x as usize | BITS;
|
||||
|
||||
assert_eq!(x & BITS, BITS);
|
||||
|
||||
Allocator::force_collect();
|
||||
|
||||
assert_eq!(unsafe { *((x & !BITS) as *mut usize) }, 42);
|
||||
}
|
||||
}
|
||||
|
||||
fn allocate() -> *mut usize {
|
||||
(unsafe { alloc(Layout::from_size_align(1 << 8, 8).unwrap()) }) as *mut usize
|
||||
}
|
||||
1
rust-toolchain
Normal file
1
rust-toolchain
Normal file
@@ -0,0 +1 @@
|
||||
stable
|
||||
@@ -1,3 +0,0 @@
|
||||
[toolchain]
|
||||
channel = "stable"
|
||||
components = ["clippy", "rustfmt", "rust-analyzer", "rust-src"]
|
||||
2
vendor/bdwgc
vendored
2
vendor/bdwgc
vendored
Submodule vendor/bdwgc updated: 98e4d0a382...e8c073d786
2
vendor/libatomic_ops
vendored
2
vendor/libatomic_ops
vendored
Submodule vendor/libatomic_ops updated: 40d5b8c1ae...9f6bc3b928
Reference in New Issue
Block a user