-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove FieldTemplate<> from field reflection type #374
Remove FieldTemplate<> from field reflection type #374
Conversation
veselinp
commented
Mar 21, 2017
- FieldTemplate<> params are part of field relfection type, this unnecessary increases generated symbol names.
@veselinp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Clang build is failing with this change. Can you look into what's wrong?
CHANGELOG.md
Outdated
### C++ & `gbc` ### | ||
|
||
* Remove FieldTemplate details from field reflection type. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: there's a gbc
section right below where this would make more sense. Consider also duplicating the entry in the C++ section as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
CHANGELOG.md
Outdated
@@ -19,6 +19,10 @@ different versioning scheme, following the Haskell community's | |||
* C# NuGet version: TBD (minor bump needed) | |||
* C# Comm NuGet version: TBD (minor bump needed) | |||
|
|||
### C++ & `gbc` ### | |||
|
|||
* Remove FieldTemplate details from field reflection type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: can you expand on this and say why we're making the change (to shorten the symbol names)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
I've pushed a fixup, clang should be happy now. |
clang build is happy. Looks like VC12 is still broken though. |
vc12 doesn't understand constexpr :) |
now, clang is broken, I'm looking again |
ordered_non_unique_field<SimpleStructView::Schema::var::m_str>, | ||
ordered_non_unique_field<SimpleStructView::Schema::var::m_uint64> | ||
ordered_non_unique_field<SimpleStructView::Schema::var::m_str, get_field_template<SimpleStructView::Schema::var::m_str>::type>, | ||
ordered_non_unique_field<SimpleStructView::Schema::var::m_uint64, get_field_template<SimpleStructView::Schema::var::m_uint64>::type> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this part of the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simplified this, and moved all logic into ordered_non_unique_field<>, please check cpp/test/core/multi_index.h
vc12 doesn't support constexp - ordered_non_unique_field requires member field address in compile time, which can be resolved via FieldTemplate.
CHANGELOG.md
Outdated
@@ -21,6 +21,9 @@ different versioning scheme, following the Haskell community's | |||
|
|||
### `gbc` and Bond compiler library ### | |||
|
|||
* C++ codegen generates field reflection, that uses an explicit type | |||
derrived from reflection::FieldTemplate. This hides FieldTemplate | |||
details and, as result, shortens symbol names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Change to "C++ codegen hides FieldTemplate details, shortening symbol names."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
I will look again later today. |
cpp/inc/bond/core/reflection.h
Outdated
@@ -101,24 +101,21 @@ struct FieldTemplate | |||
/// @brief Static data member describing field metadata | |||
static const Metadata& metadata; | |||
|
|||
/// @brief Static data member representing the field pointer | |||
static const field_pointer field; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a breaking change (removal of public member of public interface). Is it intentional? If so, what's motivating making this breaking change?
It appears that the replacement for this functionality is &theFieldType.GetVariable(someStruct)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, let me revisit this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this materially reduces the lib and PDB size, then it's something we can consider. The next release for C++ will have some other breaking changes (albeit minor ones) like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it back for now, we may want to handle vc12 explicitly to remove this symbol from generated .obj files.
python/inc/bond/python/struct.h
Outdated
@@ -26,14 +26,14 @@ class def_readwrite_property | |||
: c(c) | |||
{} | |||
|
|||
template <typename Field> | |||
void operator()(const Field&) const | |||
template <uint16_t field_id, typename ModifierTag, typename Struct, typename FieldType, FieldType Struct::*field_ptr, const bond::Metadata* metadata_ptr> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this change required to get this to build?
- If so, then the introduction of the anonymous struct is not working as I'd expect it to (the anonymous struct should have an is a relationship with
FieldTemplate
), and is a large breaking change. - If this was just done to clean up the code, that's fine, but I need to get confirmation from you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is related to FieldTemplate<>::field change. I will revert this file for now.
- FieldTemplate<> params are part of field reflection type, this unnecessary increases size of generated symbol names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge this in now. By the way, I needed to fix up the changelog section. That merge didn't go well.
CI failure is MSVC 2013 timeout...