From fb80c73fb3fd7fd18cedf716ff3c3cdc8d90f93d Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 15 Nov 2021 17:15:42 +1100 Subject: Remove `DropArena`. Most arena-allocate types that impl `Drop` get their own `TypedArena`, but a few infrequently used ones share a `DropArena`. This sharing adds complexity but doesn't help performance or memory usage. Perhaps it was more effective in the past prior to some other improvements to arenas. This commit removes `DropArena` and the sharing of arenas via the `few` attribute of the `arena_types` macro. This change removes over 100 lines of code and nine uses of `unsafe` (one of which affects the parallel compiler) and makes the remaining code easier to read. --- compiler/rustc_middle/src/arena.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'compiler/rustc_middle') diff --git a/compiler/rustc_middle/src/arena.rs b/compiler/rustc_middle/src/arena.rs index 420c500a7de..2bcc2a4f7cf 100644 --- a/compiler/rustc_middle/src/arena.rs +++ b/compiler/rustc_middle/src/arena.rs @@ -1,10 +1,5 @@ /// This declares a list of types which can be allocated by `Arena`. /// -/// The `few` modifier will cause allocation to use the shared arena and recording the destructor. -/// This is faster and more memory efficient if there's only a few allocations of the type. -/// Leaving `few` out will cause the type to get its own dedicated `TypedArena` which is -/// faster and more memory efficient if there is lots of allocations. -/// /// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]` where `T` is the type /// listed. These impls will appear in the implement_ty_decoder! macro. #[macro_export] @@ -37,7 +32,7 @@ macro_rules! arena_types { [decode] code_region: rustc_middle::mir::coverage::CodeRegion, [] const_allocs: rustc_middle::mir::interpret::Allocation, // Required for the incremental on-disk cache - [few] mir_keys: rustc_hir::def_id::DefIdSet, + [] mir_keys: rustc_hir::def_id::DefIdSet, [] region_scope_tree: rustc_middle::middle::region::ScopeTree, [] dropck_outlives: rustc_middle::infer::canonical::Canonical<'tcx, @@ -77,10 +72,10 @@ macro_rules! arena_types { rustc_middle::infer::canonical::Canonical<'tcx, rustc_middle::infer::canonical::QueryResponse<'tcx, rustc_middle::ty::Ty<'tcx>> >, - [few] all_traits: Vec, - [few] privacy_access_levels: rustc_middle::middle::privacy::AccessLevels, - [few] foreign_module: rustc_session::cstore::ForeignModule, - [few] foreign_modules: Vec, + [] all_traits: Vec, + [] privacy_access_levels: rustc_middle::middle::privacy::AccessLevels, + [] foreign_module: rustc_session::cstore::ForeignModule, + [] foreign_modules: Vec, [] upvars_mentioned: rustc_data_structures::fx::FxIndexMap, [] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation, [] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>, -- cgit 1.4.1-3-g733a5