Skip to content
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

Convention for allocator and arena passing #9

Open
jnterry opened this issue Sep 15, 2018 · 1 comment
Open

Convention for allocator and arena passing #9

jnterry opened this issue Sep 15, 2018 · 1 comment
Labels

Comments

@jnterry
Copy link
Owner

jnterry commented Sep 15, 2018

Arenas and allocators are currently passed by both reference and by pointer to different functions, and constantly dereferencing and taking the address of them is a pain.

Decide on a convention, probably by reference as we don't want to allow them to be null (but do we need to allocate them on the heap???), and add to check_code_style.hpp

We also want move assignment operators for all of them (recently added for ArenaPool, might not be in others)

@jnterry
Copy link
Owner Author

jnterry commented Sep 24, 2018

It's probably best to use pointers to pass allocators around, since we want to be able to store them in POD structs, and we cant store references in structs without having a constructor.

Arenas could be passed around by reference, since we just store the arena struct as a member of a POD struct directly, no need to chase pointers.

Eg,
struct Kernel { xen::Allocator* root_allocator; xen::ArenaPool<LoadedModule> modules; };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant