Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings with the stable Rust toolchain #1099

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks our MSRV policy. Our pinned Rust version is 1.71.1 and the MSRV should be at max 1.70. We can think about bumping our pinned version (to 1.77).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bumped rust-toolchain to 1.77.0.

build = "build.rs"

[lib]
Expand Down
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
Loading