about summary refs log tree commit diff
path: root/src/rt/rust_kernel.h
diff options
context:
space:
mode:
authorJon Morton <jonanin@gmail.com>2012-04-02 22:18:01 -0500
committerBrian Anderson <banderson@mozilla.com>2012-04-03 16:02:38 -0700
commit632a4c9326561de2bd9d9ded19a82f22678a0cf4 (patch)
treee5c5c509b2679cab824819c1d6340e44986d950d /src/rt/rust_kernel.h
parent704ca046a13977175975cb20a77ea2fbac15d77a (diff)
downloadrust-632a4c9326561de2bd9d9ded19a82f22678a0cf4.tar.gz
rust-632a4c9326561de2bd9d9ded19a82f22678a0cf4.zip
Refactor includes structure, getting rid of rust_internal.h
Many changes to code structure are included:
- removed TIME_SLICE_IN_MS
- removed sychronized_indexed_list
- removed region_owned
- kernel_owned move to kernel.h, task_owned moved to task.h
- global configs moved to rust_globals.h
- changed #pragma once to standard guard in rust_upcall.h
- got rid of memory.h
Diffstat (limited to 'src/rt/rust_kernel.h')
-rw-r--r--src/rt/rust_kernel.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h
index 7e3640f0631..3683773a7fb 100644
--- a/src/rt/rust_kernel.h
+++ b/src/rt/rust_kernel.h
@@ -7,9 +7,15 @@
 #include "memory_region.h"
 #include "rust_log.h"
 #include "rust_sched_reaper.h"
+#include "util/hash_map.h"
 
 struct rust_task_thread;
 class rust_scheduler;
+class rust_port;
+
+typedef intptr_t rust_sched_id;
+typedef intptr_t rust_task_id;
+typedef intptr_t rust_port_id;
 
 typedef std::map<rust_sched_id, rust_scheduler*> sched_map;
 
@@ -81,4 +87,19 @@ public:
     void set_exit_status(int code);
 };
 
+template <typename T> struct kernel_owned {
+    inline void *operator new(size_t size, rust_kernel *kernel,
+                              const char *tag);
+
+    void operator delete(void *ptr) {
+        ((T *)ptr)->kernel->free(ptr);
+    }
+};
+
+template <typename T>
+inline void *kernel_owned<T>::operator new(size_t size, rust_kernel *kernel,
+                                           const char *tag) {
+    return kernel->malloc(size, tag);
+}
+
 #endif /* RUST_KERNEL_H */