Skip to content

Added the two new types any_pointer and any_array #164

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

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

Tisten
Copy link
Contributor

@Tisten Tisten commented Oct 27, 2022

As requested in the issue #145

void* instance, size_t instance_size,
const unsigned char* packed_instance, size_t packed_instance_size,
size_t* consumed )
void* instance, size_t instance_size,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR contains some "space to tab" conversions to minimize the "strange indent here" feedback.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to get to fixing a clang-format file :)

@@ -177,11 +177,11 @@ static void dl_internal_store_string( const uint8_t* instance, CDLBinStoreContex
dl_binary_writer_write( &store_ctx->writer, &offset, sizeof(uintptr_t) );
}

static dl_error_t dl_internal_instance_store( dl_ctx_t dl_ctx, const dl_type_desc* type, uint8_t* instance, CDLBinStoreContext* store_ctx );
static dl_error_t dl_internal_instance_store( dl_ctx_t dl_ctx, const dl_type_desc* type, const uint8_t* instance, CDLBinStoreContext* store_ctx );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "store" functions now treat the data as const

src/dl.cpp Outdated
return err;
dl_binary_writer_seek_set( &store_ctx->writer, sub_pos );

// use when fast_loading is merged
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code was written to work with fast pointer patching, but since that PR hasn't been merged I've re-written this PR to work without it.

" // ... DL_DECLARE_ANY ...\n"
" typedef uint32_t dl_typeid_t;\n"
"\n"
" struct dl_anyptr {\n"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the C/C++ type for anyptr

Copy link
Owner

@wc-duck wc-duck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to wait with more input until fast-patching is merged and the DL_STORAGE_TYPE_ANY is at least investigated or explained to me why it is a bad idea if it is :)

{
dl_type_atom_t atom_type = member->AtomType();
dl_type_storage_t storage_type = member->StorageType();

if (storage_type == DL_TYPE_STORAGE_ANYARRAY)
atom_type = DL_TYPE_ATOM_ARRAY; // To avoid code duplification and simplify implementation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you prefer the code duplification here?

@Tisten Tisten changed the title Added the two new types anyptr and anyarray Added the two new types any_pointer and any_array Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants