libfoedus-core
FOEDUS Core Library
|
A few macros and functions to exploit compiler specific optimizations. More...
A few macros and functions to exploit compiler specific optimizations.
This file contains a few macros and functions analogous to linux/compiler.h
![]() |
Modules | |
Memorandum on ARMv8 (AArch64) Support | |
We keep notes on FOEDUS's ARMv8 (AArch64) Support here. | |
Macros | |
#define | LIKELY(x) __builtin_expect(!!(x), 1) |
Hints that x is highly likely true. More... | |
#define | UNLIKELY(x) __builtin_expect(!!(x), 0) |
Hints that x is highly likely false. More... | |
#define | NO_INLINE __attribute__((noinline)) |
A function suffix to hint that the function should never be inlined. More... | |
#define | ALWAYS_INLINE __attribute__((always_inline)) |
A function suffix to hint that the function should always be inlined. More... | |
#define | ASSUME_ALIGNED(x, y) __builtin_assume_aligned(x, y) |
Wraps GCC's __builtin_assume_aligned. More... | |
#define | MAY_ALIAS __attribute__((__may_alias__)) |
Wraps GCC's attribute((may_alias)). More... | |
#define | RESTRICT_ALIAS __restrict |
Wraps GCC's __restrict. More... | |
#define ALWAYS_INLINE __attribute__((always_inline)) |
A function suffix to hint that the function should always be inlined.
GCC's always_inline.
Definition at line 106 of file compiler.hpp.
#define ASSUME_ALIGNED | ( | x, | |
y | |||
) | __builtin_assume_aligned(x, y) |
Wraps GCC's __builtin_assume_aligned.
Definition at line 111 of file compiler.hpp.
Referenced by foedus::storage::hash::HashInsertLogType::apply_record(), foedus::storage::hash::HashUpdateLogType::apply_record(), foedus::storage::masstree::MasstreeCommonLogType::apply_record_prepare(), foedus::storage::masstree::MasstreeCursor::copy_combined_key(), foedus::storage::masstree::copy_input_key(), foedus::storage::masstree::count_common_slices(), foedus::storage::hash::HashDataPage::create_record_in_snapshot(), foedus::cache::CacheHashtable::evict_main_loop(), foedus::storage::masstree::MasstreeCommonLogType::get_payload(), foedus::assorted::read_bigendian(), and foedus::assorted::write_bigendian().
#define LIKELY | ( | x | ) | __builtin_expect(!!(x), 1) |
Hints that x is highly likely true.
GCC's __builtin_expect.
Definition at line 103 of file compiler.hpp.
Referenced by foedus::ErrorStack::append_custom_message(), foedus::storage::masstree::MasstreeCommonLogType::compare_logs(), foedus::ErrorStack::copy_custom_message(), foedus::ErrorStack::ErrorStack(), foedus::cache::CacheHashtable::evict_main_loop(), foedus::storage::array::ArrayComposeContext::execute(), foedus::storage::hash::HashComposeContext::execute(), foedus::storage::masstree::MasstreeComposeContext::execute(), foedus::storage::masstree::MasstreeStoragePimpl::find_border_physical(), foedus::storage::masstree::MasstreeBorderPage::find_key(), foedus::storage::masstree::MasstreeBorderPage::find_key_for_reserve(), foedus::storage::sequential::SequentialRecordIterator::next(), foedus::storage::hash::ComposedBinsBuffer::next_bin(), foedus::ErrorStack::operator=(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_next_layer(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_this_layer_recurse(), foedus::storage::hash::HashDataPage::search_key_physical(), foedus::ErrorStack::verify(), and foedus::ErrorStack::~ErrorStack().
#define MAY_ALIAS __attribute__((__may_alias__)) |
Wraps GCC's attribute((may_alias)).
This is QUITE important for us. This keyword is not for performance but for correctness. I'm seeing weird behaviors even with -fno-strict-aliasing. This keyword might help. Otherwise, we have to memcpy to type-pun everything. uggggrrr.
Definition at line 107 of file compiler.hpp.
#define NO_INLINE __attribute__((noinline)) |
A function suffix to hint that the function should never be inlined.
GCC's noinline.
Definition at line 105 of file compiler.hpp.
#define RESTRICT_ALIAS __restrict |
Wraps GCC's __restrict.
OTOH, this explicitly helps compiler auto-vectorize and do other stuffs, saying that the variable is never aliased in the function. Seems like older gcc ignored __restrict when fno-strict-aliasing is specified, but recent gcc doesn't.
Definition at line 108 of file compiler.hpp.
#define UNLIKELY | ( | x | ) | __builtin_expect(!!(x), 0) |
Hints that x is highly likely false.
GCC's __builtin_expect.
Definition at line 104 of file compiler.hpp.
Referenced by foedus::xct::Xct::acquire_local_work_memory(), foedus::xct::McsWwImpl< ADAPTOR >::acquire_unconditional(), foedus::xct::Xct::add_to_lock_free_read_set(), foedus::xct::Xct::add_to_lock_free_write_set(), foedus::xct::Xct::add_to_page_version_set(), foedus::xct::Xct::add_to_pointer_set(), foedus::xct::Xct::add_to_read_set(), foedus::xct::Xct::add_to_write_set(), foedus::storage::sequential::SequentialStoragePimpl::append_record(), foedus::storage::hash::ComposedBinsMergedStream::assure_writer_buffer(), foedus::xct::SysxctLockList::batch_get_or_add_entries(), foedus::xct::XctManagerPimpl::begin_xct(), foedus::storage::masstree::MasstreeStoragePimpl::check_next_layer_bit(), foedus::ErrorStack::clear_custom_message(), foedus::storage::array::compact_logs(), foedus::storage::hash::ReserveRecords::create_new_tail_page(), foedus::storage::hash::HashTmpBin::delete_record(), foedus::storage::array::ArrayComposeContext::execute(), foedus::storage::hash::HashComposeContext::execute(), foedus::cache::CacheHashtable::find_batch(), foedus::storage::masstree::MasstreeStoragePimpl::find_border_physical(), foedus::storage::masstree::MasstreeBorderPage::find_key_normalized(), foedus::thread::ThreadPimpl::find_or_read_snapshot_pages_batch(), foedus::storage::masstree::MasstreeStoragePimpl::follow_layer(), foedus::storage::hash::HashStoragePimpl::follow_page_bin_head(), foedus::thread::ThreadPimpl::follow_page_pointer(), foedus::thread::ThreadPimpl::follow_page_pointers_for_read_batch(), foedus::thread::ThreadPimpl::follow_page_pointers_for_write_batch(), foedus::storage::masstree::MasstreeStoragePimpl::get_first_root(), foedus::xct::SysxctLockList::get_or_add_entry(), foedus::memory::PagePoolPimpl::grab(), foedus::memory::NumaCoreMemory::grab_free_snapshot_page(), foedus::memory::NumaCoreMemory::grab_free_volatile_page(), foedus::memory::PagePoolPimpl::grab_one(), foedus::snapshot::MergeSort::groupify(), foedus::storage::hash::HashTmpBin::insert_record(), foedus::storage::masstree::MasstreeStorage::insert_record(), foedus::storage::masstree::MasstreeStorage::insert_record_normalized(), foedus::thread::ThreadPimpl::install_a_volatile_page(), foedus::xct::Xct::issue_next_id(), foedus::storage::hash::HashStoragePimpl::locate_record(), foedus::storage::sequential::StreamStatus::next(), foedus::storage::sequential::SequentialRecordIterator::next(), foedus::storage::sequential::SequentialStorageControlBlock::optimistic_read_truncate_epoch(), foedus::storage::hash::HashTmpBin::overwrite_record(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_next_layer(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_this_layer_recurse(), foedus::xct::XctManagerPimpl::precommit_xct_lock(), foedus::xct::XctManagerPimpl::precommit_xct_lock_batch_track_moved(), foedus::xct::XctManagerPimpl::precommit_xct_verify_readonly(), foedus::xct::XctManagerPimpl::precommit_xct_verify_readwrite(), foedus::log::ThreadLogBuffer::publish_committed_log(), foedus::xct::McsWwImpl< ADAPTOR >::release(), foedus::memory::NumaCoreMemory::release_free_snapshot_page(), foedus::memory::NumaCoreMemory::release_free_volatile_page(), foedus::xct::McsImpl< ADAPTOR, McsRwSimpleBlock >::release_rw_writer(), foedus::log::ThreadLogBuffer::reserve_new_log(), foedus::xct::run_nested_sysxct_impl(), foedus::xct::XctId::spin_while_being_written(), foedus::storage::masstree::MasstreeBorderPage::track_moved_record_next_layer(), foedus::storage::hash::HashStoragePimpl::track_moved_record_search(), foedus::thread::ThreadRef::try_impersonate(), foedus::storage::hash::HashTmpBin::update_record(), foedus::storage::masstree::MasstreeStorage::upsert_record(), and foedus::storage::masstree::MasstreeStorage::upsert_record_normalized().