2011-06-27 19:15:03 -07:00
|
|
|
// -*- c++ -*-
|
2010-08-17 23:40:07 -07:00
|
|
|
#ifndef MEMORY_H
|
|
|
|
#define MEMORY_H
|
|
|
|
|
2011-07-07 13:06:38 -07:00
|
|
|
// FIXME: It would be really nice to be able to get rid of this.
|
2011-07-18 12:02:26 -07:00
|
|
|
inline void *operator new[](size_t size, rust_task *task, const char *tag) {
|
|
|
|
return task->malloc(size, tag);
|
2010-08-17 23:40:07 -07:00
|
|
|
}
|
|
|
|
|
2011-07-07 13:06:38 -07:00
|
|
|
template <typename T>
|
2011-07-18 12:02:26 -07:00
|
|
|
inline void *task_owned<T>::operator new(size_t size, rust_task *task,
|
|
|
|
const char *tag) {
|
|
|
|
return task->malloc(size, tag);
|
2010-08-17 23:40:07 -07:00
|
|
|
}
|
|
|
|
|
2011-07-07 13:06:38 -07:00
|
|
|
template <typename T>
|
2011-07-18 12:02:26 -07:00
|
|
|
inline void *task_owned<T>::operator new[](size_t size, rust_task *task,
|
|
|
|
const char *tag) {
|
|
|
|
return task->malloc(size, tag);
|
2010-08-17 23:40:07 -07:00
|
|
|
}
|
|
|
|
|
2011-07-07 13:06:38 -07:00
|
|
|
template <typename T>
|
2011-07-18 12:02:26 -07:00
|
|
|
inline void *task_owned<T>::operator new(size_t size, rust_task &task,
|
|
|
|
const char *tag) {
|
|
|
|
return task.malloc(size, tag);
|
2010-08-17 23:40:07 -07:00
|
|
|
}
|
|
|
|
|
2011-07-07 13:06:38 -07:00
|
|
|
template <typename T>
|
2011-07-18 12:02:26 -07:00
|
|
|
inline void *task_owned<T>::operator new[](size_t size, rust_task &task,
|
|
|
|
const char *tag) {
|
|
|
|
return task.malloc(size, tag);
|
2010-08-17 23:40:07 -07:00
|
|
|
}
|
|
|
|
|
2011-07-07 13:06:38 -07:00
|
|
|
template <typename T>
|
2011-07-18 12:02:26 -07:00
|
|
|
inline void *kernel_owned<T>::operator new(size_t size, rust_kernel *kernel,
|
|
|
|
const char *tag) {
|
|
|
|
return kernel->malloc(size, tag);
|
2010-08-17 23:40:07 -07:00
|
|
|
}
|
|
|
|
|
2011-07-07 13:06:38 -07:00
|
|
|
|
2010-08-17 23:40:07 -07:00
|
|
|
#endif /* MEMORY_H */
|