22// table.cpp
33// OpenGraphCxx
44//
5- // Audited for 6.5.4
5+ // Audited for 6.5.1
66// Status: WIP
77// Modified based Compute code
88
99#include < OpenGraphCxx/Data/table.hpp>
1010#include < OpenGraphCxx/Data/page.hpp>
1111#include < OpenGraphCxx/Data/page_const.hpp>
1212#include < OpenGraphCxx/Data/zone.hpp>
13- #include < OpenGraphCxx/Util /assert.hpp>
13+ #include < OpenGraphCxx/Misc /assert.hpp>
1414#include < sys/mman.h>
1515#include < dispatch/dispatch.h>
1616#if OG_TARGET_OS_DARWIN
@@ -29,7 +29,7 @@ namespace OG {
2929namespace data {
3030
3131#if OG_TARGET_OS_DARWIN
32- malloc_zone_t *_Nullable _malloc_zone;
32+ malloc_zone_t *table:: _malloc_zone = nullptr ;
3333#endif
3434
3535table &table::ensure_shared () {
@@ -242,9 +242,9 @@ void table::dealloc_page_locked(ptr<page> page) OG_NOEXCEPT {
242242 }
243243}
244244
245- // TO BE AUDITED
246- uint64_t table::raw_page_seed (ptr<page> page) OG_NOEXCEPT {
247- page. assert_valid (_data_capacity );
245+ OG_CONSTEXPR
246+ uint64_t table::raw_page_seed (ptr<page> page) const OG_NOEXCEPT {
247+ assert_valid (page );
248248 lock ();
249249 uint32_t page_index = page.page_index ();
250250 uint32_t map_index = page_index / pages_per_map;
@@ -255,8 +255,8 @@ uint64_t table::raw_page_seed(ptr<page> page) OG_NOEXCEPT {
255255 if (map_index < _page_metadata_maps.size () && _page_metadata_maps[map_index].test (page_index % page_size)) {
256256 auto info = page->zone ->info ();
257257 // FIXME
258- w22 = info.to_raw_value () & 0xffffff00 ;
259- w21 = info.to_raw_value () & 0x000000ff ;
258+ w22 = info.value () & 0xffffff00 ;
259+ w21 = info.value () & 0x000000ff ;
260260 result = uint64_t (1 ) << 32 ;
261261 }
262262 unlock ();
@@ -267,9 +267,9 @@ void table::print() const OG_NOEXCEPT {
267267 lock ();
268268 fprintf (stderr, " data::table %p:\n %.2fKB allocated, %.2fKB used, %.2fKB reusable.\n " ,
269269 this ,
270- double (_region_capacity - page_size) / 1024.0 ,
270+ double (region_capacity () - page_size) / 1024.0 ,
271271 double (this ->used_pages_num ()) / 1024.0 ,
272- double (_reusable_pages_num ) / 1024.0 );
272+ double (reusable_pages_num () ) / 1024.0 );
273273 unlock ();
274274}
275275
0 commit comments