-
Notifications
You must be signed in to change notification settings - Fork 8
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
Default data reflection #169
base: master
Are you sure you want to change the base?
Conversation
Loading multiple type libraries with default data resulted in DL_ERROR_OUT_OF_DEFAULT_VALUE_SLOTS.
Merge remote-tracking branch 'origin/master' into default_data_reflection
Fixed pointer patching of default values Fixed merging of identical strings when packing json data
@@ -139,63 +140,6 @@ dl_error_t DL_DLL_EXPORT dl_instance_load_inplace( dl_ctx_t dl_ctx, | |||
return DL_ERROR_OK; | |||
} | |||
|
|||
struct CDLBinStoreContext |
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.
Moved to new private header: "dl_store.h"
@@ -1,6 +1,30 @@ | |||
#include "dl_patch_ptr.h" | |||
#include "dl_types.h" | |||
|
|||
struct dl_patched_ptrs |
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 is a plain "undo" of the things mentioned here: https://github.com/wc-duck/datalibrary/pull/158/files#r1000718654
@@ -122,12 +123,27 @@ dl_error_t DL_DLL_EXPORT dl_reflect_get_type_members( dl_ctx_t dl_ctx, dl_typeid | |||
if(members_size < type->member_count) | |||
return DL_ERROR_BUFFER_TOO_SMALL; | |||
|
|||
if (!dl_ctx->default_data_patched) |
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 is the internal state I want to avoid by storing the default data in a persistant memory location instead of reallocating a buffer and moving around the data every time new types are added/loaded, discuss it here #161 (comment)
CArrayStatic<SString, 128>& strings; | ||
}; | ||
|
||
dl_error_t dl_internal_store_member( dl_ctx_t dl_ctx, const dl_member_desc* member, const uint8_t* instance, CDLBinStoreContext* store_ctx ); |
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.
Being able to use this interface from dl_txt_pack.cpp means dl_patch_ptr doesn't need to handle pointer recording and string merging for storing. It just patches pointers.
# Conflicts: # src/dl_txt_pack.cpp # tests/unittest2.tld
Expose default data in the reflection API, solve: #161
The implementation is not "final". Right now there is an internal state which is not thread safe. This is mentioned in the issue above, so please discuss the preferred solution there.
Also includes second iteration of string merging, now doing it when json parsing as well: #14