Skip to content

Commit

Permalink
Merge branch 'master' into feature/fork
Browse files Browse the repository at this point in the history
  • Loading branch information
wks committed Apr 3, 2024
2 parents d293c04 + d91b203 commit b526ec1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/mmtk/mmtk-core"
readme = "README.md"
categories = ["memory-management"]
keywords = ["gc", "garbage", "collection", "garbage-collection", "allocation"]
rust-version = "1.70.0"
rust-version = "1.71.1"
build = "build.rs"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.71.1
1.77.0
4 changes: 3 additions & 1 deletion src/policy/lockfreeimmortalspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ impl<VM: VMBinding> LockFreeImmortalSpace<VM> {
// Create a VM request of fixed size
let vmrequest = VMRequest::fixed_size(aligned_total_bytes);
// Reserve the space
let VMRequest::Extent{ extent, top } = vmrequest else { unreachable!() };
let VMRequest::Extent { extent, top } = vmrequest else {
unreachable!()
};
let start = args.heap.reserve(extent, top);

let space = Self {
Expand Down
2 changes: 1 addition & 1 deletion src/scheduler/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub type ThreadId = usize;

thread_local! {
/// Current worker's ordinal
static WORKER_ORDINAL: Atomic<ThreadId> = Atomic::new(ThreadId::MAX);
static WORKER_ORDINAL: Atomic<ThreadId> = const { Atomic::new(ThreadId::MAX) };
}

/// Get current worker ordinal. Return `None` if the current thread is not a worker.
Expand Down
3 changes: 2 additions & 1 deletion src/util/heap/layout/vm_layout.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! The module defines virutal memory layout parameters.
use std::ptr::addr_of;
use std::sync::atomic::AtomicBool;

use atomic::Ordering;
Expand Down Expand Up @@ -192,5 +193,5 @@ pub fn vm_layout() -> &'static VMLayout {
if cfg!(debug_assertions) {
VM_LAYOUT_FETCHED.store(true, Ordering::SeqCst);
}
unsafe { &VM_LAYOUT }
unsafe { &*addr_of!(VM_LAYOUT) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,22 @@ pub fn acquire_typed_allocator() {
|| {
let fixture = MMTKFixture::create();
let tls_opaque_pointer = VMMutatorThread(VMThread(OpaquePointer::UNINITIALIZED));
static mut DEFAULT_ALLOCATOR_OFFSET: usize = 0;

// ANCHOR: avoid_resolving_allocator
// At boot time
let selector = memory_manager::get_allocator_mapping(
fixture.get_mmtk(),
AllocationSemantics::Default,
);
unsafe {
DEFAULT_ALLOCATOR_OFFSET =
crate::plan::Mutator::<MockVM>::get_allocator_base_offset(selector);
}
let default_allocator_offset =
crate::plan::Mutator::<MockVM>::get_allocator_base_offset(selector);
let mutator = memory_manager::bind_mutator(fixture.get_mmtk(), tls_opaque_pointer);

// At run time: allocate with the default semantics without resolving allocator
let default_allocator: &mut BumpAllocator<MockVM> = {
let mutator_addr = Address::from_ref(&*mutator);
unsafe {
(mutator_addr + DEFAULT_ALLOCATOR_OFFSET).as_mut_ref::<BumpAllocator<MockVM>>()
(mutator_addr + default_allocator_offset).as_mut_ref::<BumpAllocator<MockVM>>()
}
};
let addr = default_allocator.alloc(8, 8, 0);
Expand Down

0 comments on commit b526ec1

Please sign in to comment.