Skip to content

Exporting reset_munmap_all_arenas to C and Python Bindings #1210

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

Merged
merged 2 commits into from
Jul 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bindings/c/include/kllvm-c/kllvm-c.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ void kore_symbol_add_formal_argument(kore_symbol *, kore_sort const *);

void kllvm_init(void);
void kllvm_free_all_memory(void);
void kllvm_reset_munmap_all_arenas(void);

/* Sort-specific functions */

Expand Down
5 changes: 5 additions & 0 deletions bindings/c/lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ auto managed(kore_symbol *ptr) {
extern "C" {
void free_all_kore_mem();
bool hook_BYTES_mutableBytesEnabled();
void reset_munmap_all_arenas();
}

extern "C" {
Expand Down Expand Up @@ -430,6 +431,10 @@ void kllvm_free_all_memory(void) {
free_all_kore_mem();
}

void kllvm_reset_munmap_all_arenas(void) {
reset_munmap_all_arenas();
}
Comment on lines +434 to +436
Copy link
Member

Choose a reason for hiding this comment

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

We will also need this in the header file, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, sorry!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've just pushed this fix, thanks for spotting it!


bool kllvm_mutable_bytes_enabled(void) {
return hook_BYTES_mutableBytesEnabled();
}
Expand Down
2 changes: 2 additions & 0 deletions bindings/python/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ PYBIND11_DECLARE_HOLDER_TYPE(T, raw_ptr<T>, true);
extern "C" {
void init_static_objects(void);
void free_all_kore_mem(void);
void reset_munmap_all_arenas(void);
block *take_steps(int64_t, block *);
void *construct_initial_configuration(kore_pattern const *initial);
}
Expand All @@ -61,6 +62,7 @@ void bind_runtime(py::module_ &m) {

m.def("init_static_objects", init_static_objects);
m.def("free_all_gc_memory", free_all_kore_mem);
m.def("reset_munmap_all_arenas", reset_munmap_all_arenas);

// This class can't be used directly from Python; the mutability semantics
// that we get from the Pybind wrappers make it really easy to break things.
Expand Down