-
Notifications
You must be signed in to change notification settings - Fork 54
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
treat hermit like wasm32 #109
base: master
Are you sure you want to change the base?
Conversation
Could you please elaborate on why this implementation precisely is the right thing to do for the hermit targets and why e.g. |
I forgot to mention, this intends to fix #108. If I can get an implementation that just compiles and does nothing, I would be happy too. I chose the wasm implementation simply because I am not familiar enough with psm to adapt the psm implementation to do the right thing for Hermit. From what I could gather from the source code, they differ in how they allocate memory and how they query page size. Hermit supports neither mmap nor sysconf, so I went with the wasm implementation. Hermit usually runs on x86_64 and aarch64, though there might also be other supported architectures. |
Ah so my bad. I didn't check the PR closely enough, and it looks like That said, using |
unsafe { libc::sysconf(libc::_SC_PAGE_SIZE) as usize } | ||
#[cfg(target_arch = "wasm32")] | ||
#[cfg(any(target_arch = "wasm32",target_os = "hermit"))] |
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 there is absolutely no way to obtain the page size on hermit then lets hardcode it to something more appropriate for platforms hermit runs on (probably 4kB.)
Is page_size used for anything but controlling the size of allocations? If not, renaming to allocation_granularity or such might be appropriate. Hermit uses Talc as an Allocator. Here is how Talc rounds up allocation sizes. As Talc stores some metadata along with each allocation, picking a power of two will have it just barely not fit within the size category. I could not find any special treatment for page size allocations, though maybe I missed it. Given this, an allocation granularity of 1 would make sense. |
This implements stacker on hermit by treating it the same as wasm32