Skip to content

Commit

Permalink
Merge pull request #26 from psiha/feature/new_containers
Browse files Browse the repository at this point in the history
new vektors
  • Loading branch information
psiha authored Dec 13, 2024
2 parents 7afa647 + 999c4b6 commit 075e09a
Show file tree
Hide file tree
Showing 11 changed files with 1,918 additions and 946 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/gh-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,30 @@ jobs:
submodules: true
- uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '23'
distribution: 'temurin'

- name: Setup latest Xcode on MacOS
if: matrix.os == 'macos-latest'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest

# For x64 OSX this action offers only v15 https://github.com/KyleMayes/install-llvm-action/blob/master/assets.json
# luckily latest is now ARM by default:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
- name: Install LLVM and Clang on MacOS
if: matrix.os == 'macos-latest'
uses: KyleMayes/[email protected]
with:
# https://github.com/KyleMayes/install-llvm-action/issues/65
arch: arm64
version: 18
env: true

- name: Install LLVM and Clang on Linux
if: matrix.os == 'ubuntu-latest'
# https://apt.llvm.org
run: |
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
Expand All @@ -86,9 +100,11 @@ jobs:
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
${{ matrix.cmake_toolchain }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DGitHubCIRun=true
-S ${{ github.workspace }}
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions include/psi/vm/containers/allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ namespace psi::vm
{
//------------------------------------------------------------------------------

namespace detail { [[ noreturn ]] inline void throw_bad_alloc() { throw std::bad_alloc(); } }
namespace detail { [[ noreturn, gnu::cold ]] inline void throw_bad_alloc() { throw std::bad_alloc(); } }

class allocator_backing_mapping
{
public:
constexpr allocator_backing_mapping() = default;

err::fallible_result< std::size_t, error > open( auto const * const file_name ) noexcept { return open( create_file( file_name, create_rw_file_flags() ) ); }
err::fallible_result<std::size_t, error> open( auto const * const file_name ) noexcept { return open( create_file( file_name, create_rw_file_flags() ) ); }

auto data() const noexcept { return view_.data(); }

Expand Down
15 changes: 9 additions & 6 deletions include/psi/vm/containers/b+tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,15 @@ class bptree_base

[[ gnu::pure ]] bool is_root() const noexcept { return !parent; }

# ifndef __clang__ // https://github.com/llvm/llvm-project/issues/36032
protected: // merely to prevent slicing (in return-node-by-ref cases)
constexpr node_header( node_header const & ) noexcept = default;
constexpr node_header( node_header && ) noexcept = default;
constexpr node_header ( node_header const & ) noexcept = default;
constexpr node_header ( node_header && ) noexcept = default;
public:
constexpr node_header( ) noexcept = default;
constexpr node_header ( ) noexcept = default;
constexpr node_header & operator=( node_header && ) noexcept = default;
constexpr node_header & operator=( node_header const & ) noexcept = default;
# endif
}; // struct node_header
using node_size_type = node_header::size_type;

Expand Down Expand Up @@ -1346,7 +1348,7 @@ class bptree_base_wkey : public bptree_base
{
BOOST_ASSUME( target.num_vals + source.num_vals <= target.max_values );

std::ranges::move( keys( source ), keys( target ).end() );
std::ranges::move( keys( source ), &target.keys[ target.num_vals ] );
target.num_vals += source.num_vals;
source.num_vals = 0;

Expand Down Expand Up @@ -1387,8 +1389,9 @@ class bptree_base_wkey : public bptree_base
move_chldrn( right, 0, num_chldrn( right ), left, num_chldrn( left ) );
auto & separator_key{ parent.keys[ parent_key_idx ] };
left.num_vals += 1;
keys( left ).back() = std::move( separator_key );
std::ranges::move( keys( right ), keys( left ).end() );
auto & last_left_key{ keys( left ).back() };
last_left_key = std::move( separator_key );
std::ranges::move( keys( right ), std::next( &last_left_key ) );
left.num_vals += right.num_vals;
BOOST_ASSUME( left.num_vals >= left.max_values - 1 ); BOOST_ASSUME( left.num_vals <= left.max_values );

Expand Down
Loading

0 comments on commit 075e09a

Please sign in to comment.