mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-15 05:05:58 +08:00
Use MaxSizeVector instead of std::vector: xcode sometimes assumes that std::vector allocates aligned memory and therefore issues aligned instruction to initialize it. This can result in random crashes when compiling with AVX instructions enabled.
This commit is contained in:
parent
373c340b71
commit
13df3441ae
@ -50,7 +50,7 @@ class EventCount {
|
|||||||
public:
|
public:
|
||||||
class Waiter;
|
class Waiter;
|
||||||
|
|
||||||
EventCount(std::vector<Waiter>& waiters) : waiters_(waiters) {
|
EventCount(MaxSizeVector<Waiter>& waiters) : waiters_(waiters) {
|
||||||
eigen_assert(waiters.size() < (1 << kWaiterBits) - 1);
|
eigen_assert(waiters.size() < (1 << kWaiterBits) - 1);
|
||||||
// Initialize epoch to something close to overflow to test overflow.
|
// Initialize epoch to something close to overflow to test overflow.
|
||||||
state_ = kStackMask | (kEpochMask - kEpochInc * waiters.size() * 2);
|
state_ = kStackMask | (kEpochMask - kEpochInc * waiters.size() * 2);
|
||||||
@ -199,7 +199,7 @@ class EventCount {
|
|||||||
static const uint64_t kEpochMask = ((1ull << kEpochBits) - 1) << kEpochShift;
|
static const uint64_t kEpochMask = ((1ull << kEpochBits) - 1) << kEpochShift;
|
||||||
static const uint64_t kEpochInc = 1ull << kEpochShift;
|
static const uint64_t kEpochInc = 1ull << kEpochShift;
|
||||||
std::atomic<uint64_t> state_;
|
std::atomic<uint64_t> state_;
|
||||||
std::vector<Waiter>& waiters_;
|
MaxSizeVector<Waiter>& waiters_;
|
||||||
|
|
||||||
void Park(Waiter* w) {
|
void Park(Waiter* w) {
|
||||||
std::unique_lock<std::mutex> lock(w->mu);
|
std::unique_lock<std::mutex> lock(w->mu);
|
||||||
|
@ -123,7 +123,7 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
MaxSizeVector<Thread*> threads_;
|
MaxSizeVector<Thread*> threads_;
|
||||||
MaxSizeVector<Queue*> queues_;
|
MaxSizeVector<Queue*> queues_;
|
||||||
MaxSizeVector<unsigned> coprimes_;
|
MaxSizeVector<unsigned> coprimes_;
|
||||||
std::vector<EventCount::Waiter> waiters_;
|
MaxSizeVector<EventCount::Waiter> waiters_;
|
||||||
std::atomic<unsigned> blocked_;
|
std::atomic<unsigned> blocked_;
|
||||||
std::atomic<bool> spinning_;
|
std::atomic<bool> spinning_;
|
||||||
std::atomic<bool> done_;
|
std::atomic<bool> done_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user