[Bf-blender-cvs] [30fdd868f14] temp-trimesh-sculpt: stupid msvc doesn't want to inline c++ methods
Joseph Eagar
noreply at git.blender.org
Wed Oct 14 04:05:49 CEST 2020
Commit: 30fdd868f146289ec2703015d9276c355662dbd6
Author: Joseph Eagar
Date: Tue Oct 6 12:58:12 2020 -0700
Branches: temp-trimesh-sculpt
https://developer.blender.org/rB30fdd868f146289ec2703015d9276c355662dbd6
stupid msvc doesn't want to inline c++ methods
===================================================================
M extern/parallel-hashmap/phmap.h
M extern/parallel-hashmap/phmap_base.h
M source/blender/blenlib/BLI_hashmap.h
M source/blender/blenlib/CMakeLists.txt
M source/blender/blenlib/intern/hashmap.cc
M source/blender/blenlib/intern/hashmap_gen.h
M source/blender/blenlib/intern/testHashMap.c
M source/blender/trimesh/intern/trimesh.c
M source/blender/trimesh/intern/trimesh_log.c
M source/blender/trimesh/trimesh.h
===================================================================
diff --git a/extern/parallel-hashmap/phmap.h b/extern/parallel-hashmap/phmap.h
index 8f3c1869a72..f8ad2b5912c 100644
--- a/extern/parallel-hashmap/phmap.h
+++ b/extern/parallel-hashmap/phmap.h
@@ -1,6 +1,10 @@
#if !defined(phmap_h_guard_)
#define phmap_h_guard_
+#ifdef _MSC_VER
+#define FORCEINLINE __forceinline
+#endif
+
// ---------------------------------------------------------------------------
// Copyright (c) 2019, Gregory Popovitch - greg7mdp at gmail.com
//
@@ -39,12 +43,12 @@
#pragma warning(disable : 4127) // conditional expression is constant
#pragma warning(disable : 4324) // structure was padded due to alignment specifier
- #pragma warning(disable : 4514) // unreferenced inline function has been removed
+ #pragma warning(disable : 4514) // unreferenced FORCEINLINE function has been removed
#pragma warning(disable : 4623) // default constructor was implicitly defined as deleted
#pragma warning(disable : 4625) // copy constructor was implicitly defined as deleted
#pragma warning(disable : 4626) // assignment operator was implicitly defined as deleted
#pragma warning(disable : 4710) // function not inlined
- #pragma warning(disable : 4711) // selected for automatic inline expansion
+ #pragma warning(disable : 4711) // selected for automatic FORCEINLINE expansion
#pragma warning(disable : 4820) // '6' bytes padding added after data member
#pragma warning(disable : 4868) // compiler may not enforce left-to-right evaluation order in braced initializer list
#pragma warning(disable : 5027) // move assignment operator was implicitly defined as deleted
@@ -254,7 +258,7 @@ static_assert(kDeleted == -2,
// A single block of empty control bytes for tables without any slots allocated.
// This enables removing a branch in the hot path of find().
// --------------------------------------------------------------------------
-inline ctrl_t* EmptyGroup() {
+FORCEINLINE ctrl_t* EmptyGroup() {
alignas(16) static constexpr ctrl_t empty_group[] = {
kSentinel, kEmpty, kEmpty, kEmpty, kEmpty, kEmpty, kEmpty, kEmpty,
kEmpty, kEmpty, kEmpty, kEmpty, kEmpty, kEmpty, kEmpty, kEmpty};
@@ -262,7 +266,7 @@ inline ctrl_t* EmptyGroup() {
}
// --------------------------------------------------------------------------
-inline size_t HashSeed(const ctrl_t* ctrl) {
+FORCEINLINE size_t HashSeed(const ctrl_t* ctrl) {
// The low bits of the pointer have little or no entropy because of
// alignment. We shift the pointer to try to use higher entropy bits. A
// good number seems to be 12 bits, because that aligns with page size.
@@ -271,7 +275,7 @@ inline size_t HashSeed(const ctrl_t* ctrl) {
#ifdef PHMAP_NON_DETERMINISTIC
-inline size_t H1(size_t hash, const ctrl_t* ctrl) {
+FORCEINLINE size_t H1(size_t hash, const ctrl_t* ctrl) {
// use ctrl_ pointer to add entropy to ensure
// non-deterministic iteration order.
return (hash >> 7) ^ HashSeed(ctrl);
@@ -279,7 +283,7 @@ inline size_t H1(size_t hash, const ctrl_t* ctrl) {
#else
-inline size_t H1(size_t hash, const ctrl_t* ) {
+FORCEINLINE size_t H1(size_t hash, const ctrl_t* ) {
return (hash >> 7);
}
@@ -579,25 +583,25 @@ struct HashtablezInfo
inline void RecordRehashSlow(HashtablezInfo*, size_t ) {}
-static inline void RecordInsertSlow(HashtablezInfo* , size_t, size_t ) {}
+static FORCEINLINE void RecordInsertSlow(HashtablezInfo* , size_t, size_t ) {}
-static inline void RecordEraseSlow(HashtablezInfo*) {}
+static FORCEINLINE void RecordEraseSlow(HashtablezInfo*) {}
-static inline HashtablezInfo* SampleSlow(int64_t*) { return nullptr; }
-static inline void UnsampleSlow(HashtablezInfo* ) {}
+static FORCEINLINE HashtablezInfo* SampleSlow(int64_t*) { return nullptr; }
+static FORCEINLINE void UnsampleSlow(HashtablezInfo* ) {}
class HashtablezInfoHandle
{
public:
- inline void RecordStorageChanged(size_t , size_t ) {}
- inline void RecordRehash(size_t ) {}
- inline void RecordInsert(size_t , size_t ) {}
- inline void RecordErase() {}
- friend inline void swap(HashtablezInfoHandle& ,
+ FORCEINLINE void RecordStorageChanged(size_t , size_t ) {}
+ FORCEINLINE void RecordRehash(size_t ) {}
+ FORCEINLINE void RecordInsert(size_t , size_t ) {}
+ FORCEINLINE void RecordErase() {}
+ friend FORCEINLINE void swap(HashtablezInfoHandle& ,
HashtablezInfoHandle& ) noexcept {}
};
-static inline HashtablezInfoHandle Sample() { return HashtablezInfoHandle(); }
+static FORCEINLINE HashtablezInfoHandle Sample() { return HashtablezInfoHandle(); }
class HashtablezSampler
{
@@ -612,9 +616,9 @@ public:
int64_t Iterate(const std::function<void(const HashtablezInfo& stack)>& ) { return 0; }
};
-static inline void SetHashtablezEnabled(bool ) {}
-static inline void SetHashtablezSampleParameter(int32_t ) {}
-static inline void SetHashtablezMaxSamples(int32_t ) {}
+static FORCEINLINE void SetHashtablezEnabled(bool ) {}
+static FORCEINLINE void SetHashtablezSampleParameter(int32_t ) {}
+static FORCEINLINE void SetHashtablezMaxSamples(int32_t ) {}
namespace memory_internal {
@@ -722,7 +726,7 @@ DecomposePairImpl(F&& f, std::pair<std::tuple<K>, V> p) {
//
// IMPLEMENTATION DETAILS
//
-// The table stores elements inline in a slot array. In addition to the slot
+// The table stores elements FORCEINLINE in a slot array. In addition to the slot
// array the table maintains some control state per slot. The extra state is one
// byte per slot and stores empty or deleted marks, or alternatively 7 bits from
// the hash of an occupied slot. The table is split into logical groups of
@@ -867,14 +871,14 @@ public:
pointer operator->() const { return &operator*(); }
// PRECONDITION: not an end() iterator.
- inline iterator& operator++() {
+ FORCEINLINE iterator& operator++() {
++ctrl_;
++slot_;
skip_empty_or_deleted();
return *this;
}
// PRECONDITION: not an end() iterator.
- inline iterator operator++(int) {
+ FORCEINLINE iterator operator++(int) {
auto tmp = *this;
++*this;
return tmp;
@@ -899,10 +903,10 @@ public:
}
#endif
- inline friend bool operator==(const iterator& a, const iterator& b) {
+ FORCEINLINE friend bool operator==(const iterator& a, const iterator& b) {
return a.ctrl_ == b.ctrl_;
}
- inline friend bool operator!=(const iterator& a, const iterator& b) {
+ FORCEINLINE friend bool operator!=(const iterator& a, const iterator& b) {
return !(a == b);
}
@@ -948,21 +952,21 @@ public:
reference operator*() const { return *inner_; }
pointer operator->() const { return inner_.operator->(); }
- inline const_iterator& operator++() {
+ FORCEINLINE const_iterator& operator++() {
++inner_;
return *this;
}
- inline const_iterator operator++(int) { return inner_++; }
+ FORCEINLINE const_iterator operator++(int) { return inner_++; }
- inline friend bool operator==(const const_iterator& a, const const_iterator& b) {
+ FORCEINLINE friend bool operator==(const const_iterator& a, const const_iterator& b) {
return a.inner_ == b.inner_;
}
- inline friend bool operator!=(const const_iterator& a, const const_iterator& b) {
+ FORCEINLINE friend bool operator!=(const const_iterator& a, const const_iterator& b) {
return !(a == b);
}
private:
- inline const_iterator(const ctrl_t* ctrl, const slot_type* slot)
+ FORCEINLINE const_iterator(const ctrl_t* ctrl, const slot_type* slot)
: inner_(const_cast<ctrl_t*>(ctrl), const_cast<slot_type*>(slot)) {}
iterator inner_;
@@ -1077,11 +1081,11 @@ public:
const allocator_type& alloc)
: raw_hash_set(init, 0, hasher(), key_equal(), alloc) {}
- inline raw_hash_set(const raw_hash_set& that)
+ FORCEINLINE raw_hash_set(const raw_hash_set& that)
: raw_hash_set(that, AllocTraits::select_on_container_copy_construction(
that.alloc_ref())) {}
- inline raw_hash_set(const raw_hash_set& that, const allocator_type& a)
+ FORCEINLINE raw_hash_set(const raw_hash_set& that, const allocator_type& a)
: raw_hash_set(0, that.hash_ref(), that.eq_ref(), a) {
reserve(that.size());
// Because the table is guaranteed to be empty, we can do something faster
@@ -1097,7 +1101,7 @@ public:
growth_left() -= that.size();
}
- inline raw_hash_set(raw_hash_set&& that) noexcept(
+ FORCEINLINE raw_hash_set(raw_hash_set&& that) noexcept(
std::is_nothrow_copy_constructible<hasher>::value&&
std::is_nothrow_copy_constructible<key_equal>::value&&
std::is_nothrow_copy_constructible<allocator_type>::value)
@@ -1135,7 +1139,7 @@ public:
}
}
- inline raw_hash_set& operator=(const raw_hash_set& that) {
+ FORCEINLINE raw_hash_set& operator=(const raw_hash_set& that) {
raw_hash_set tmp(that,
AllocTraits::propagate_on_container_copy_assignment::value
? that.alloc_ref()
@@ -1144,7 +1148,7 @@ public:
return *this;
}
- inline raw_hash_set& operator=(raw_hash_set&& that) noexcept(
+ FORCEINLINE raw_hash_set& operator=(raw_hash_set&& that) noexcept(
phmap::allocator_traits<allocator_type>::is_always_equal::value&&
std::is_nothrow_move_assignable<hasher>::value&&
std::is_nothrow_move_assignable<key_equal>::value) {
@@ -1157,12 +1161,12 @@ public:
~raw_hash_set() { destroy_slots(); }
- inline iterator begin() {
+ FORCEINLINE iterator begin() {
auto it = iterator_at(0);
it.skip_empty_or_deleted();
return it;
}
- inline iterator end()
+ FORCEINLINE iterator end()
{
#if PHMAP_BIDIRECTIONAL
return iterator_at(capacity_);
@@ -1171,17 +1175,17 @@ public:
#endif
}
- inline const_it
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list