mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:22:43 +00:00 
			
		
		
		
	 6ac454e70a
			
		
	
	
		6ac454e70a
		
	
	
	
	
		
			
			Problem: - Default destructors (and constructors) are in `.cpp` files. This prevents the compiler's optimizer from inlining them when it thinks inlining is appropriate (unless LTO is used). - Forward declarations can prevent some optimizations, such as inlining of constructors and destructors. Solution: - Remove them or set them to `= default` and let the compiler handle the generation of them. - Remove unneeded forward declarations.
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			793 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			793 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include "Range.h"
 | |
| #include <AK/Vector.h>
 | |
| 
 | |
| namespace UserspaceEmulator {
 | |
| 
 | |
| class RangeAllocator {
 | |
| public:
 | |
|     RangeAllocator();
 | |
| 
 | |
|     void initialize_with_range(VirtualAddress, size_t);
 | |
| 
 | |
|     Optional<Range> allocate_anywhere(size_t, size_t alignment = PAGE_SIZE);
 | |
|     Optional<Range> allocate_specific(VirtualAddress, size_t);
 | |
|     Optional<Range> allocate_randomized(size_t, size_t alignment);
 | |
|     void deallocate(const Range&);
 | |
| 
 | |
|     void dump() const;
 | |
| 
 | |
|     bool contains(const Range& range) const { return m_total_range.contains(range); }
 | |
| 
 | |
| private:
 | |
|     void carve_at_index(int, const Range&);
 | |
| 
 | |
|     Vector<Range> m_available_ranges;
 | |
|     Range m_total_range;
 | |
| };
 | |
| 
 | |
| }
 |