From 53a897731e23320e67602d3d4c56e09caffb98ca Mon Sep 17 00:00:00 2001 From: rmawatson <rmawatson@hotmail.com> Date: Fri, 1 Dec 2017 18:15:41 +0100 Subject: [PATCH] this is allow custom allocator for obj-api structs/tables. (#4520) added "native_custom_alloc" attribute to tables/structs, eg. table parent_table( native_custom_alloc:"custom_alloc_name" ) { ... } with a custom allocator defined as template <typename T> class custom_alloc_name : public std::allocator<T> { public: typedef T* pointer; template <class U> struct rebind { typedef custom_alloc_name<U> other; }; pointer allocate(const std::size_t n) { return ....; } void deallocate(T* ptr, std::size_t n) { ... } custom_alloc_name() throw() {} template <class U> custom_alloc_name(const custom_alloc_name<U>&) throw() {} }; }; --- docs/source/CppUsage.md | 39 ++++++++++++++++++ include/flatbuffers/flatbuffers.h | 8 ++-- include/flatbuffers/idl.h | 1 + src/idl_gen_cpp.cpp | 20 ++++++++- src/idl_parser.cpp | 4 ++ tests/monster_test.bfbs | Bin 5400 -> 5520 bytes .../namespace_test2_generated.ts | 20 ++++----- 7 files changed, 77 insertions(+), 15 deletions(-) diff --git a/docs/source/CppUsage.md b/docs/source/CppUsage.md index 2ded6110..e858e0a3 100644 --- a/docs/source/CppUsage.md +++ b/docs/source/CppUsage.md @@ -126,6 +126,45 @@ The following attributes are specific to the object-based API code generation: "native_inline", the value specified with this attribute will be included verbatim in the class constructor initializer list for this member. +- `native_custom_alloc`:"custom_allocator" (on a table or struct): When using the + object-based API all generated NativeTables that are allocated when unpacking + your flatbuffer will use "custom allocator". The allocator is also used by + any std::vector that appears in a table defined with `native_custom_alloc`. + This can be used to provide allocation from a pool for example, for faster + unpacking when using the object-based API. + + Minimal Example: + + schema: + + table mytable(native_custom_alloc:"custom_allocator") { + ... + } + + with custom_allocator defined before flatbuffers.h is included, as: + + template <typename T> struct custom_allocator : public std::allocator<T> { + + typedef T *pointer; + + template <class U> + struct rebind { + typedef custom_allocator<U> other; + }; + + pointer allocate(const std::size_t n) { + return std::allocator<T>::allocate(n); + } + + void deallocate(T* ptr, std::size_t n) { + return std::allocator<T>::deallocate(ptr,n); + } + + custom_allocator() throw() {} + template <class U> + custom_allocator(const custom_allocator<U>&) throw() {} + }; + - `native_type`' "type" (on a struct): In some cases, a more optimal C++ data type exists for a given struct. For example, the following schema: diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index 3b56ba49..aa5df859 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -656,10 +656,10 @@ inline voffset_t FieldIndexToOffset(voffset_t field_id) { return static_cast<voffset_t>((field_id + fixed_fields) * sizeof(voffset_t)); } -template <typename T> const T* data(const std::vector<T> &v) { +template <typename T, typename Alloc> const T* data(const std::vector<T, Alloc> &v) { return v.empty() ? nullptr : &v.front(); } -template <typename T> T* data(std::vector<T> &v) { +template <typename T, typename Alloc> T* data(std::vector<T, Alloc> &v) { return v.empty() ? nullptr : &v.front(); } @@ -1283,8 +1283,8 @@ class FlatBufferBuilder /// serialize into the buffer as a `vector`. /// @return Returns a typed `Offset` into the serialized data indicating /// where the vector is stored. - template<typename T> Offset<Vector<const T *>> CreateVectorOfStructs( - const std::vector<T> &v) { + template<typename T, typename Alloc> Offset<Vector<const T *>> CreateVectorOfStructs( + const std::vector<T, Alloc> &v) { return CreateVectorOfStructs(data(v), v.size()); } diff --git a/include/flatbuffers/idl.h b/include/flatbuffers/idl.h index c0408de6..d06b5a42 100644 --- a/include/flatbuffers/idl.h +++ b/include/flatbuffers/idl.h @@ -526,6 +526,7 @@ class Parser : public ParserState { known_attributes_["cpp_ptr_type"] = true; known_attributes_["cpp_str_type"] = true; known_attributes_["native_inline"] = true; + known_attributes_["native_custom_alloc"] = true; known_attributes_["native_type"] = true; known_attributes_["native_default"] = true; known_attributes_["flexbuffer"] = true; diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp index 623ada2f..8b283795 100644 --- a/src/idl_gen_cpp.cpp +++ b/src/idl_gen_cpp.cpp @@ -479,7 +479,11 @@ class CppGenerator : public BaseGenerator { } case BASE_TYPE_VECTOR: { const auto type_name = GenTypeNative(type.VectorType(), true, field); - return "std::vector<" + type_name + ">"; + if (type.struct_def && type.struct_def->attributes.Lookup("native_custom_alloc")) { + auto native_custom_alloc = type.struct_def->attributes.Lookup("native_custom_alloc"); + return "std::vector<" + type_name + "," + native_custom_alloc->constant + "<" + type_name + ">>"; + } else + return "std::vector<" + type_name + ">"; } case BASE_TYPE_STRUCT: { auto type_name = WrapInNameSpace(*type.struct_def); @@ -1323,6 +1327,17 @@ class CppGenerator : public BaseGenerator { code_ += " }"; } + void GenOperatorNewDelete(const StructDef & struct_def) { + if (auto native_custom_alloc = struct_def.attributes.Lookup("native_custom_alloc")) { + code_ += " inline void *operator new (std::size_t count) {"; + code_ += " return " + native_custom_alloc->constant + "<{{NATIVE_NAME}}>().allocate(count / sizeof({{NATIVE_NAME}}));"; + code_ += " }"; + code_ += " inline void operator delete (void *ptr) {"; + code_ += " return " + native_custom_alloc->constant + "<{{NATIVE_NAME}}>().deallocate(static_cast<{{NATIVE_NAME}}*>(ptr),1);"; + code_ += " }"; + } + } + void GenNativeTable(const StructDef &struct_def) { const auto native_name = NativeName(Name(struct_def), &struct_def, parser_.opts); code_.SetValue("STRUCT_NAME", Name(struct_def)); @@ -1336,6 +1351,7 @@ class CppGenerator : public BaseGenerator { it != struct_def.fields.vec.end(); ++it) { GenMember(**it); } + GenOperatorNewDelete(struct_def); GenDefaultConstructor(struct_def); code_ += "};"; code_ += ""; @@ -2388,6 +2404,8 @@ class CppGenerator : public BaseGenerator { code_ += " }"; } } + code_.SetValue("NATIVE_NAME", Name(struct_def)); + GenOperatorNewDelete(struct_def); code_ += "};"; code_.SetValue("STRUCT_BYTE_SIZE", NumToString(struct_def.bytesize)); diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index cc58a1cd..65e7cb86 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -676,6 +676,10 @@ CheckedError Parser::ParseField(StructDef &struct_def) { } } + auto field_native_custom_alloc = field->attributes.Lookup("native_custom_alloc"); + if (field_native_custom_alloc) + return Error("native_custom_alloc can only be used with a table or struct definition"); + field->native_inline = field->attributes.Lookup("native_inline") != nullptr; if (field->native_inline && !IsStruct(field->value.type)) return Error("native_inline can only be defined on structs'"); diff --git a/tests/monster_test.bfbs b/tests/monster_test.bfbs index 843e308c5204d9c36bad66ae49ac2d37041b4cce..2e247eb3af964b0f0aa98041a26d12cb0ebb965b 100644 GIT binary patch literal 5520 zcmai2Z)hCX5ucMz(n&h$6j@PJ#dX%MFh&?*ORfo_7+H-S1!CFQsvAm)ywdGi7w&eC zyFFD7CLcmDAs<XBp%ha}D8clDDIp(%2}Xoa`XL`eDaM3iN<RdD=pUoHt?Q(%x4++; zeS3R{-HsT&xASJ^&CHuOJGT=evT%IijL5J|NLF%^mk}Amli<I|^T1QUmx09|!K%oO z0-iB{0H$|FMLvH5^DdEdBO=Q?MBV}}LU<c^9rJF;8~|1_A}@h2i}{I@OW0G_s)3I^ zC(Pb`m~m(R2V{2QA7yjEZvn6TDT**alL)q!6Bk}^tKQ79O}ARBcr!=+3#$JMtX%`r zZu&vU8xKd!KJ>!@z6T|o(?-Hqs=v^O`BOmEzY^=8T{#i>jnJ#hjVOwyuznkc(pI>Y zz>z;28w>Q4I+ndgc&1GImfh8g_uX>1e#~!HvF}dAqGb>DF*wv`9ON_La;%Ru+GTCH z_ArWQJNJ1PbB;?VmyThO{jiU*I|Q_`yQO-%sfRJ?h~2k?N>B&c#3IBv4{VPecVmVK zBB^##w}mO}NgEa_O^>wOc&0r0ZG09%L+Z#2b<gw7+8FF_>9zdU|4s1oY)*Sc#D%=v zk^CbjPV{jeNGivV{$gU^&;51-V;@h3>t1~cnR2G)u6Z-Z>p}HJf34Ci(oh=@Orbe% z;%WWlSx|S@{D}-;9!s8eD<U7<jUw{w2T~97Z4%fK+vN*2?`Wm$HoS&f|2}x$1pWj< z&jYtHzm4%6Fb}+r=l3u^i_ymTN83>}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zQw8d4KYitq%pt2u8CVP}4kSl$tnnk_K)M^I%z9o|ACJDKWU1Lg4(YTr%lmEy#7FiX zwQJ367@hprg~09mKFdS-Gna1*c%_FoRx^*tY&VWP?IGQTk$$V+lfw6^@v+vAH`diI zHu**wi%<NDt>(GClAN+1Kl+qmzkOJ0wHr-d;l-<7I@wpJgZ^0$bG2o&cQvmB9{FO% z)?B|OAVUvwLaSd}6nTR@mwme-?WJCKtf^<)_ZHJ&lI4~!G|uOartkb?B>VTxY95MM x(LM#M50qcRyVCVHe@yUf5Sx{Y{Fg)BeCbKEZ-+rw`S$U;ekW<v_{fxN{{tzh&zArI diff --git a/tests/namespace_test/namespace_test2_generated.ts b/tests/namespace_test/namespace_test2_generated.ts index 8deae09c..8a4aebd0 100644 --- a/tests/namespace_test/namespace_test2_generated.ts +++ b/tests/namespace_test/namespace_test2_generated.ts @@ -1,6 +1,6 @@ // automatically generated by the FlatBuffers compiler, do not modify -import * as NS9459827973991502386 from "./namespace_test1_generated"; +import * as NS11563891686210618450 from "./namespace_test1_generated"; /** * @constructor */ @@ -39,24 +39,24 @@ static getRootAsTableInFirstNS(bb:flatbuffers.ByteBuffer, obj?:TableInFirstNS):T * @param {NamespaceA.NamespaceB.TableInNestedNS=} obj * @returns {NamespaceA.NamespaceB.TableInNestedNS|null} */ -fooTable(obj?:NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS):NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS|null { +fooTable(obj?:NS11563891686210618450.NamespaceA.NamespaceB.TableInNestedNS):NS11563891686210618450.NamespaceA.NamespaceB.TableInNestedNS|null { var offset = this.bb.__offset(this.bb_pos, 4); - return offset ? (obj || new NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; + return offset ? (obj || new NS11563891686210618450.NamespaceA.NamespaceB.TableInNestedNS).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; }; /** * @returns {NamespaceA.NamespaceB.EnumInNestedNS} */ -fooEnum():NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS { +fooEnum():NS11563891686210618450.NamespaceA.NamespaceB.EnumInNestedNS { var offset = this.bb.__offset(this.bb_pos, 6); - return offset ? /** @type {NamespaceA.NamespaceB.EnumInNestedNS} */ (this.bb.readInt8(this.bb_pos + offset)) : NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS.A; + return offset ? /** @type {NamespaceA.NamespaceB.EnumInNestedNS} */ (this.bb.readInt8(this.bb_pos + offset)) : NS11563891686210618450.NamespaceA.NamespaceB.EnumInNestedNS.A; }; /** * @param {NamespaceA.NamespaceB.EnumInNestedNS} value * @returns {boolean} */ -mutate_foo_enum(value:NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS):boolean { +mutate_foo_enum(value:NS11563891686210618450.NamespaceA.NamespaceB.EnumInNestedNS):boolean { var offset = this.bb.__offset(this.bb_pos, 6); if (offset === 0) { @@ -71,9 +71,9 @@ mutate_foo_enum(value:NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS * @param {NamespaceA.NamespaceB.StructInNestedNS=} obj * @returns {NamespaceA.NamespaceB.StructInNestedNS|null} */ -fooStruct(obj?:NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS):NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS|null { +fooStruct(obj?:NS11563891686210618450.NamespaceA.NamespaceB.StructInNestedNS):NS11563891686210618450.NamespaceA.NamespaceB.StructInNestedNS|null { var offset = this.bb.__offset(this.bb_pos, 8); - return offset ? (obj || new NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS).__init(this.bb_pos + offset, this.bb) : null; + return offset ? (obj || new NS11563891686210618450.NamespaceA.NamespaceB.StructInNestedNS).__init(this.bb_pos + offset, this.bb) : null; }; /** @@ -95,8 +95,8 @@ static addFooTable(builder:flatbuffers.Builder, fooTableOffset:flatbuffers.Offse * @param {flatbuffers.Builder} builder * @param {NamespaceA.NamespaceB.EnumInNestedNS} fooEnum */ -static addFooEnum(builder:flatbuffers.Builder, fooEnum:NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS) { - builder.addFieldInt8(1, fooEnum, NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS.A); +static addFooEnum(builder:flatbuffers.Builder, fooEnum:NS11563891686210618450.NamespaceA.NamespaceB.EnumInNestedNS) { + builder.addFieldInt8(1, fooEnum, NS11563891686210618450.NamespaceA.NamespaceB.EnumInNestedNS.A); }; /** -- GitLab