Rewrite boxed_region/memory_region in Rust
This drops more of the old C++ runtime to rather be written in rust. A few features were lost along the way, but hopefully not too many. The main loss is that there are no longer backtraces associated with allocations (rust doesn't have a way of acquiring those just yet). Other than that though, I believe that the rest of the debugging utilities made their way over into rust. Closes #8704
This commit is contained in:
parent
c5074ae646
commit
357ef1f69c
13 changed files with 257 additions and 656 deletions
|
|
@ -13,8 +13,6 @@
|
|||
#include "rust_util.h"
|
||||
#include "sync/rust_thread.h"
|
||||
#include "sync/lock_and_signal.h"
|
||||
#include "memory_region.h"
|
||||
#include "boxed_region.h"
|
||||
#include "vg/valgrind.h"
|
||||
|
||||
#include <time.h>
|
||||
|
|
@ -477,44 +475,6 @@ rust_initialize_rt_tls_key(tls_key *key) {
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" CDECL memory_region*
|
||||
rust_new_memory_region(uintptr_t detailed_leaks,
|
||||
uintptr_t poison_on_free) {
|
||||
return new memory_region((bool)detailed_leaks,
|
||||
(bool)poison_on_free);
|
||||
}
|
||||
|
||||
extern "C" CDECL void
|
||||
rust_delete_memory_region(memory_region *region) {
|
||||
delete region;
|
||||
}
|
||||
|
||||
extern "C" CDECL boxed_region*
|
||||
rust_new_boxed_region(memory_region *region,
|
||||
uintptr_t poison_on_free) {
|
||||
return new boxed_region(region, poison_on_free);
|
||||
}
|
||||
|
||||
extern "C" CDECL void
|
||||
rust_delete_boxed_region(boxed_region *region) {
|
||||
delete region;
|
||||
}
|
||||
|
||||
extern "C" CDECL rust_opaque_box*
|
||||
rust_boxed_region_malloc(boxed_region *region, type_desc *td, size_t size) {
|
||||
return region->malloc(td, size);
|
||||
}
|
||||
|
||||
extern "C" CDECL rust_opaque_box*
|
||||
rust_boxed_region_realloc(boxed_region *region, rust_opaque_box *ptr, size_t size) {
|
||||
return region->realloc(ptr, size);
|
||||
}
|
||||
|
||||
extern "C" CDECL void
|
||||
rust_boxed_region_free(boxed_region *region, rust_opaque_box *box) {
|
||||
region->free(box);
|
||||
}
|
||||
|
||||
typedef void *(rust_try_fn)(void*, void*);
|
||||
|
||||
extern "C" CDECL uintptr_t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue