Swap Boost.Container's small_vector out for LLVM's

This implementation misses a shrink to fit function, but reassigning the
vector with a fresh one should be equivalent.
This commit is contained in:
Robbert van der Helm
2022-04-14 23:31:14 +02:00
parent fd25010aca
commit b2a15620f3
18 changed files with 1601 additions and 97 deletions
+6 -7
View File
@@ -20,8 +20,8 @@
#include <bitsery/traits/array.h>
#include <bitsery/traits/vector.h>
#include <llvm/small-vector.h>
#include <vestige/aeffectx.h>
#include <boost/container/small_vector.hpp>
#include "../audio-shm.h"
#include "../bitsery/ext/in-place-optional.h"
@@ -123,18 +123,17 @@ class alignas(16) DynamicVstEvents {
* the `sysex_data_` field before dumping everything to
* `vst_events_buffer_`.
*/
boost::container::small_vector<VstEvent, 64> events_;
llvm::SmallVector<VstEvent, 64> events_;
/**
* If the host or a plugin sends SysEx data, then we will store that data
* here. I've only seen this happen with the combination of an Arturia
* MiniLab keyboard, REAPER, and D16 Group plugins. We'll store this as an
* associative list of `(index, data)` pairs, where `index` corresponds to
* an event in `events`. There's no 'small_unordered_map' in
* Boost.Container, so this will have to do.
* an event in `events`. There's no 'SmallUnorderedMap' equivalent to the
* `SmallVector`.
*/
boost::container::small_vector<std::pair<native_size_t, std::string>, 8>
sysex_data_;
llvm::SmallVector<std::pair<native_size_t, std::string>, 8> sysex_data_;
template <typename S>
void serialize(S& s) {
@@ -161,7 +160,7 @@ class alignas(16) DynamicVstEvents {
* MIDI events the host can send at once we have to build this object on the
* heap by hand.
*/
boost::container::small_vector<
llvm::SmallVector<
uint8_t,
sizeof(VstEvents) +
((64 - 1) *
+3 -6
View File
@@ -16,18 +16,15 @@
#pragma once
#include <llvm/small-vector.h>
#include <pluginterfaces/vst/ivstevents.h>
#include <boost/container/small_vector.hpp>
#include "../../bitsery/ext/in-place-variant.h"
#include "../../bitsery/traits/small-vector.h"
#include "base.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
// FIXME: When used in a Boost.Containers small vector, GCC somehow complains
// that the fields in `YaEvent` may be uninitialized (during the
// deserialization). This warning only shows up during a unity build.
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
/**
* A wrapper around `DataEvent` for serialization purposes, as this event
@@ -270,7 +267,7 @@ class YaEventList : public Steinberg::Vst::IEventList {
}
private:
boost::container::small_vector<YaEvent, 64> events_;
llvm::SmallVector<YaEvent, 64> events_;
};
#pragma GCC diagnostic pop
@@ -16,20 +16,14 @@
#pragma once
#include <llvm/small-vector.h>
#include <pluginterfaces/vst/ivstparameterchanges.h>
#include <boost/container/small_vector.hpp>
#include "../../bitsery/traits/small-vector.h"
#include "base.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
// FIXME: When used in a Boost.Containers small vector, GCC somehow complains
// that the fields in this class may be uninitialized (during the
// deserialization). This warning only shows up during a unity build.
#if defined(__GNUC__) && !defined(__llvm__)
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
/**
* Wraps around `IParamValueQueue` for serializing a queue containing changes to
@@ -102,9 +96,7 @@ class alignas(16) YaParamValueQueue : public Steinberg::Vst::IParamValueQueue {
*
* This contains pairs of `(sample_offset, value)`.
*/
boost::container::small_vector<std::pair<int32, Steinberg::Vst::ParamValue>,
16>
queue_;
llvm::SmallVector<std::pair<int32, Steinberg::Vst::ParamValue>, 16> queue_;
};
#pragma GCC diagnostic pop
@@ -16,8 +16,8 @@
#pragma once
#include <llvm/small-vector.h>
#include <pluginterfaces/vst/ivstparameterchanges.h>
#include <boost/container/small_vector.hpp>
#include "../../bitsery/traits/small-vector.h"
#include "base.h"
@@ -85,7 +85,7 @@ class YaParameterChanges : public Steinberg::Vst::IParameterChanges {
/**
* The parameter value changes queues.
*/
boost::container::small_vector<YaParamValueQueue, 16> queues_;
llvm::SmallVector<YaParamValueQueue, 16> queues_;
};
#pragma GCC diagnostic pop
+4 -4
View File
@@ -112,8 +112,8 @@ class YaProcessData {
struct Response {
// We store raw pointers instead of references so we can default
// initialize this object during deserialization
boost::container::small_vector_base<Steinberg::Vst::AudioBusBuffers>*
outputs = nullptr;
llvm::SmallVectorImpl<Steinberg::Vst::AudioBusBuffers>* outputs =
nullptr;
std::optional<YaParameterChanges>* output_parameter_changes = nullptr;
std::optional<YaEventList>* output_events = nullptr;
@@ -206,7 +206,7 @@ class YaProcessData {
* be set to point to our shared memory surface that holds the actual audio
* data.
*/
boost::container::small_vector<Steinberg::Vst::AudioBusBuffers, 8> inputs_;
llvm::SmallVector<Steinberg::Vst::AudioBusBuffers, 8> inputs_;
/**
* This contains metadata about the output buffers for every bus. During
@@ -214,7 +214,7 @@ class YaProcessData {
* be set to point to our shared memory surface that holds the actual audio
* data.
*/
boost::container::small_vector<Steinberg::Vst::AudioBusBuffers, 8> outputs_;
llvm::SmallVector<Steinberg::Vst::AudioBusBuffers, 8> outputs_;
/**
* Incoming parameter changes.