about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-04-21 19:03:52 -0700
committerBrian Anderson <banderson@mozilla.com>2013-04-21 19:03:54 -0700
commitd7f5e437a28dd85b8a7523af9212a9a1100ea725 (patch)
treefac7e88de46f3583839b3c2b82d541af7b7b8197 /src/rt/rust_builtin.cpp
parent2fe118b26fdb2897eb000ae47f912cc6b2534324 (diff)
downloadrust-d7f5e437a28dd85b8a7523af9212a9a1100ea725.tar.gz
rust-d7f5e437a28dd85b8a7523af9212a9a1100ea725.zip
core::rt: Add the local heap to newsched tasks
Reusing the existing boxed_region implementation from the runtime
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index a0db6f64f69..b8749b8f73d 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -851,6 +851,41 @@ rust_initialize_global_state() {
     }
 }
 
+extern "C" CDECL memory_region*
+rust_new_memory_region(uintptr_t synchronized,
+                       uintptr_t detailed_leaks,
+                       uintptr_t poison_on_free) {
+    return new memory_region((bool)synchronized,
+                             (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 void
+rust_boxed_region_free(boxed_region *region, rust_opaque_box *box) {
+    region->free(box);
+}
+
 //
 // Local Variables:
 // mode: C++