Skip to content

Commit e5280cf

Browse files
committed
yukon: scaffold out a "Localizer" class which will do all the localization work
1 parent a32965c commit e5280cf

File tree

6 files changed

+65
-2
lines changed

6 files changed

+65
-2
lines changed

runtime/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ set(CORE_SOURCES
5555
core/HeapPage.cpp
5656
core/SizedPage.cpp
5757
core/LocalityPage.cpp
58+
core/Localizer.cpp
5859

5960
core/Utils.cpp
6061

runtime/core/Localizer.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
/*
3+
* This file is part of the Alaska Handle-Based Memory Management System
4+
*
5+
* Copyright (c) 2024, Nick Wanninger <ncw@u.northwestern.edu>
6+
* Copyright (c) 2024, The Constellation Project
7+
* All rights reserved.
8+
*
9+
* This is free software. You are permitted to use, redistribute,
10+
* and modify it as specified in the file "LICENSE".
11+
*/
12+
13+
14+
#include <alaska/Runtime.hpp>
15+
#include <alaska/Localizer.hpp>
16+
17+
namespace alaska {
18+
19+
20+
Localizer::Localizer(alaska::Configuration &config, alaska::Runtime &rt)
21+
: rt(rt) {}
22+
void Localizer::feed_hotness_data(size_t count, handle_id_t *handle_ids) {}
23+
} // namespace alaska

runtime/core/Runtime.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/*
23
* This file is part of the Alaska Handle-Based Memory Management System
34
*
@@ -13,6 +14,7 @@
1314
#include <alaska/Runtime.hpp>
1415
#include <alaska/SizeClass.hpp>
1516
#include <alaska/BarrierManager.hpp>
17+
#include <alaska/Localizer.hpp>
1618
#include "alaska/alaska.hpp"
1719
#include "alaska/utils.h"
1820
#include <stdlib.h>
@@ -28,7 +30,8 @@ namespace alaska {
2830

2931
Runtime::Runtime(alaska::Configuration config)
3032
: handle_table(config)
31-
, heap(config) {
33+
, heap(config)
34+
, locality_manager(config, *this) {
3235
// Validate that there is not already a runtime (TODO: atomics?)
3336
ALASKA_ASSERT(g_runtime == nullptr, "Cannot create more than one runtime");
3437

runtime/include/alaska/Localizer.hpp

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* This file is part of the Alaska Handle-Based Memory Management System
3+
*
4+
* Copyright (c) 2024, Nick Wanninger <ncw@u.northwestern.edu>
5+
* Copyright (c) 2024, The Constellation Project
6+
* All rights reserved.
7+
*
8+
* This is free software. You are permitted to use, redistribute,
9+
* and modify it as specified in the file "LICENSE".
10+
*/
11+
12+
#pragma once
13+
14+
#include <alaska/alaska.hpp>
15+
#include <alaska/Configuration.hpp>
16+
17+
namespace alaska {
18+
19+
20+
// fwd decl
21+
struct Runtime;
22+
23+
24+
class Localizer {
25+
alaska::Runtime &rt;
26+
27+
public:
28+
Localizer(alaska::Configuration &config, alaska::Runtime &rt);
29+
void feed_hotness_data(size_t count, handle_id_t *handle_ids);
30+
};
31+
} // namespace alaska

runtime/include/alaska/Runtime.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <alaska/alaska.hpp>
1919
#include <ck/set.h>
2020
#include <alaska/Configuration.hpp>
21+
#include <alaska/Localizer.hpp>
2122

2223
namespace alaska {
2324
/**
@@ -52,6 +53,8 @@ namespace alaska {
5253
// This is defaulted to a "nop" manager which simply does nothing.
5354
alaska::BarrierManager *barrier_manager;
5455

56+
alaska::Localizer locality_manager;
57+
5558

5659
// Return the singleton instance of the Runtime if it has been allocated. Abort otherwise.
5760
static Runtime &get();

runtime/include/alaska/alaska.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ namespace alaska {
5252
extern long translation_hits;
5353
extern long translation_misses;
5454

55+
using handle_id_t = uint64_t;
56+
5557

5658
class Mapping {
5759
private:
@@ -125,7 +127,7 @@ namespace alaska {
125127
return out;
126128
}
127129

128-
ALASKA_INLINE uint64_t handle_id(void) const {
130+
ALASKA_INLINE handle_id_t handle_id(void) const {
129131
uint64_t out = ((uint64_t)encode() << ALASKA_SIZE_BITS);
130132
return (out & ~(1UL << 63)) >> ALASKA_SIZE_BITS;
131133
}

0 commit comments

Comments
 (0)