-
Notifications
You must be signed in to change notification settings - Fork 457
CDRIVER-2813 remove BSON_EXTRA_ALIGNMENT option
#1942
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
Changes from 5 commits
0af9fff
e780edd
dfab040
8b31fed
73871ed
4d18bac
ae3724f
6a901f3
b821a7e
75cd19a
71ad3da
b49f838
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
eramongodb marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,11 +120,11 @@ typedef struct _bson_json_opts_t bson_json_opts_t; | |
| * | ||
| * This structure is meant to fit in two sequential 64-byte cachelines. | ||
| */ | ||
| BSON_ALIGNED_BEGIN (128) typedef struct _bson_t { | ||
| BSON_ALIGNED_BEGIN (BSON_ALIGN_OF_PTR) typedef struct _bson_t { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we instead fix
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am concerned removing the alignment specifier could break existing code allocating without libbson functions. Example: Upgrading to 2.0 may make this a runtime error. Maybe (hopefully) it is unlikely. I see no usage on GitHub code search for AFAIK types being aligned to a pointer size (or 8) is less of an issue. If there is little observed benefit, it might not be worth the risk (even if small).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Polymorphic types such as |
||
| uint32_t flags; /* Internal flags for the bson_t. */ | ||
| uint32_t len; /* Length of BSON data. */ | ||
| uint8_t padding[120]; /* Padding for stack allocation. */ | ||
| } bson_t BSON_ALIGNED_END (128); | ||
| } bson_t BSON_ALIGNED_END (BSON_ALIGN_OF_PTR); | ||
|
|
||
| /** | ||
| * BSON_INITIALIZER: | ||
|
|
@@ -342,7 +342,7 @@ typedef struct _bson_value_t { | |
| * This structure is safe to discard on the stack. No cleanup is necessary | ||
| * after using it. | ||
| */ | ||
| BSON_ALIGNED_BEGIN (128) | ||
| BSON_ALIGNED_BEGIN (BSON_ALIGN_OF_PTR) | ||
| typedef struct { | ||
| const uint8_t *raw; /* The raw buffer being iterated. */ | ||
| uint32_t len; /* The length of raw. */ | ||
|
|
@@ -356,7 +356,7 @@ typedef struct { | |
| uint32_t next_off; /* The offset of the next field. */ | ||
| uint32_t err_off; /* The offset of the error. */ | ||
| bson_value_t value; /* Internal value for various state. */ | ||
| } bson_iter_t BSON_ALIGNED_END (128); | ||
| } bson_iter_t BSON_ALIGNED_END (BSON_ALIGN_OF_PTR); | ||
|
|
||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.