From caa92e4e01f8ac5c733521fa313c25cdaae9dce8 Mon Sep 17 00:00:00 2001 From: Jon Morton Date: Mon, 2 Apr 2012 22:18:01 -0500 Subject: [PATCH 1/5] 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 --- src/rt/arch/i386/context.cpp | 8 +- src/rt/arch/x86_64/context.cpp | 8 +- src/rt/boxed_region.cpp | 6 +- src/rt/circular_buffer.cpp | 4 +- src/rt/circular_buffer.h | 3 + src/rt/memory.h | 34 +---- src/rt/memory_region.cpp | 4 +- src/rt/memory_region.h | 2 + src/rt/rust.cpp | 5 +- src/rt/rust.h | 41 ------ src/rt/rust_box_annihilator.cpp | 4 +- src/rt/rust_builtin.cpp | 2 +- src/rt/rust_cc.cpp | 14 +- src/rt/rust_debug.cpp | 4 +- src/rt/rust_env.cpp | 2 +- src/rt/rust_env.h | 8 ++ src/rt/rust_globals.h | 37 ++++- src/rt/rust_internal.h | 183 ------------------------ src/rt/rust_kernel.cpp | 5 +- src/rt/rust_kernel.h | 21 +++ src/rt/rust_log.cpp | 7 +- src/rt/rust_log.h | 2 + src/rt/rust_port.cpp | 4 +- src/rt/rust_port.h | 3 +- src/rt/rust_port_selector.cpp | 2 + src/rt/rust_port_selector.h | 3 +- src/rt/rust_refcount.h | 31 ++++ src/rt/rust_run_program.cpp | 3 +- src/rt/rust_sched_driver.cpp | 4 +- src/rt/rust_sched_launcher.cpp | 1 + src/rt/rust_sched_launcher.h | 3 +- src/rt/rust_sched_loop.cpp | 6 +- src/rt/rust_sched_loop.h | 8 +- src/rt/rust_sched_reaper.cpp | 2 +- src/rt/rust_scheduler.cpp | 3 + src/rt/rust_scheduler.h | 4 +- src/rt/rust_shape.cpp | 8 +- src/rt/rust_shape.h | 3 +- src/rt/rust_stack.cpp | 2 +- src/rt/rust_stack.h | 3 + src/rt/rust_task.cpp | 9 +- src/rt/rust_task.h | 40 +++++- src/rt/rust_type.h | 72 ++++++++++ src/rt/rust_upcall.cpp | 4 +- src/rt/rust_upcall.h | 5 +- src/rt/rust_util.h | 3 +- src/rt/rust_uv.cpp | 4 +- src/rt/sync/lock_and_signal.cpp | 5 +- src/rt/sync/lock_and_signal.h | 2 + src/rt/sync/lock_free_queue.h | 1 + src/rt/sync/rust_thread.cpp | 2 +- src/rt/sync/rust_thread.h | 2 + src/rt/util/array_list.h | 3 + src/rt/util/synchronized_indexed_list.h | 74 ---------- 54 files changed, 311 insertions(+), 412 deletions(-) delete mode 100644 src/rt/rust.h delete mode 100644 src/rt/rust_internal.h create mode 100644 src/rt/rust_refcount.h create mode 100644 src/rt/rust_type.h delete mode 100644 src/rt/util/synchronized_indexed_list.h diff --git a/src/rt/arch/i386/context.cpp b/src/rt/arch/i386/context.cpp index e65420dc0e313..14dbb3e0db7dc 100644 --- a/src/rt/arch/i386/context.cpp +++ b/src/rt/arch/i386/context.cpp @@ -1,10 +1,6 @@ -#include "context.h" - -#include "../../rust.h" -#include -#include -#include +#include "context.h" +#include "../../rust_globals.h" extern "C" uint32_t CDECL swap_registers(registers_t *oregs, registers_t *regs) diff --git a/src/rt/arch/x86_64/context.cpp b/src/rt/arch/x86_64/context.cpp index 46a606c6c6e0e..aefb1fef2c2ee 100644 --- a/src/rt/arch/x86_64/context.cpp +++ b/src/rt/arch/x86_64/context.cpp @@ -1,10 +1,6 @@ -#include "context.h" - -#include "../../rust.h" -#include -#include -#include +#include "context.h" +#include "../../rust_globals.h" extern "C" void CDECL swap_registers(registers_t *oregs, registers_t *regs) diff --git a/src/rt/boxed_region.cpp b/src/rt/boxed_region.cpp index 937069bc38c32..5eec01730f40f 100644 --- a/src/rt/boxed_region.cpp +++ b/src/rt/boxed_region.cpp @@ -1,6 +1,8 @@ -#include + + #include "boxed_region.h" -#include "rust_internal.h" +#include "rust_globals.h" +#include "rust_task.h" // #define DUMP_BOXED_REGION diff --git a/src/rt/circular_buffer.cpp b/src/rt/circular_buffer.cpp index 6753eb20f2e2f..93d7d612f0bd5 100644 --- a/src/rt/circular_buffer.cpp +++ b/src/rt/circular_buffer.cpp @@ -2,7 +2,9 @@ * A simple resizable circular buffer. */ -#include "rust_internal.h" +#include "circular_buffer.h" +#include "rust_globals.h" +#include "rust_kernel.h" circular_buffer::circular_buffer(rust_kernel *kernel, size_t unit_sz) : kernel(kernel), diff --git a/src/rt/circular_buffer.h b/src/rt/circular_buffer.h index 289fcf1ec4f48..c54ee8a33e41e 100644 --- a/src/rt/circular_buffer.h +++ b/src/rt/circular_buffer.h @@ -5,6 +5,9 @@ #ifndef CIRCULAR_BUFFER_H #define CIRCULAR_BUFFER_H +#include "rust_globals.h" +#include "rust_kernel.h" + class circular_buffer : public kernel_owned { static const size_t INITIAL_CIRCULAR_BUFFER_SIZE_IN_UNITS = 8; diff --git a/src/rt/memory.h b/src/rt/memory.h index ea087d14b5102..16662fd7a1428 100644 --- a/src/rt/memory.h +++ b/src/rt/memory.h @@ -2,40 +2,8 @@ #ifndef MEMORY_H #define MEMORY_H -// FIXME: It would be really nice to be able to get rid of this. -inline void *operator new[](size_t size, rust_task *task, const char *tag) { - return task->malloc(size, tag); -} +#include "rust_task.h" -template -inline void *task_owned::operator new(size_t size, rust_task *task, - const char *tag) { - return task->malloc(size, tag); -} - -template -inline void *task_owned::operator new[](size_t size, rust_task *task, - const char *tag) { - return task->malloc(size, tag); -} - -template -inline void *task_owned::operator new(size_t size, rust_task &task, - const char *tag) { - return task.malloc(size, tag); -} - -template -inline void *task_owned::operator new[](size_t size, rust_task &task, - const char *tag) { - return task.malloc(size, tag); -} - -template -inline void *kernel_owned::operator new(size_t size, rust_kernel *kernel, - const char *tag) { - return kernel->malloc(size, tag); -} #endif /* MEMORY_H */ diff --git a/src/rt/memory_region.cpp b/src/rt/memory_region.cpp index c5c36b2b5f33f..7096657999102 100644 --- a/src/rt/memory_region.cpp +++ b/src/rt/memory_region.cpp @@ -1,5 +1,7 @@ -#include "rust_internal.h" + +#include "sync/sync.h" #include "memory_region.h" +#include "rust_env.h" #if RUSTRT_TRACK_ALLOCATIONS >= 3 #include diff --git a/src/rt/memory_region.h b/src/rt/memory_region.h index 3cec23641b1f5..145020e3ccaf9 100644 --- a/src/rt/memory_region.h +++ b/src/rt/memory_region.h @@ -9,7 +9,9 @@ #ifndef MEMORY_REGION_H #define MEMORY_REGION_H +#include "rust_globals.h" #include "sync/lock_and_signal.h" +#include "util/array_list.h" // There are three levels of debugging: // diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp index 695132979beba..4f9cd3bf7fd9a 100644 --- a/src/rt/rust.cpp +++ b/src/rt/rust.cpp @@ -1,7 +1,8 @@ -#include "rust_internal.h" + +#include "rust_globals.h" +#include "rust_kernel.h" #include "rust_util.h" #include "rust_scheduler.h" -#include struct command_line_args : public kernel_owned diff --git a/src/rt/rust.h b/src/rt/rust.h deleted file mode 100644 index fdf95040df83d..0000000000000 --- a/src/rt/rust.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef RUST_H -#define RUST_H - -/* - * Include this file after you've defined the ISO C9x stdint - * types (size_t, uint8_t, uintptr_t, etc.) - */ - -#ifdef __i386__ -// 'cdecl' ABI only means anything on i386 -#ifdef __WIN32__ -#ifndef CDECL -#define CDECL __cdecl -#endif -#ifndef FASTCALL -#define FASTCALL __fastcall -#endif -#else -#define CDECL __attribute__((cdecl)) -#define FASTCALL __attribute__((fastcall)) -#endif -#else -#define CDECL -#define FASTCALL -#endif - -/* Controls whether claims are turned into checks */ -/* Variable name must be kept consistent with trans.rs */ -extern "C" int check_claims; - -/* - * Local Variables: - * fill-column: 78; - * indent-tabs-mode: nil - * c-basic-offset: 4 - * buffer-file-coding-system: utf-8-unix - * compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'"; - * End: - */ - -#endif /* RUST_H */ diff --git a/src/rt/rust_box_annihilator.cpp b/src/rt/rust_box_annihilator.cpp index b5abfde0274e0..21f7b9d2dc377 100644 --- a/src/rt/rust_box_annihilator.cpp +++ b/src/rt/rust_box_annihilator.cpp @@ -1,4 +1,6 @@ -#include "rust_internal.h" + +#include "rust_globals.h" +#include "rust_task.h" #include "rust_shape.h" class annihilator : public shape::data { diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 08707d7f38dc0..79e1e880f5783 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -1,12 +1,12 @@ /* Native builtins. */ -#include "rust_internal.h" #include "rust_sched_loop.h" #include "rust_task.h" #include "rust_util.h" #include "rust_scheduler.h" #include "sync/timer.h" #include "rust_abi.h" +#include "rust_port.h" #ifdef __APPLE__ #include diff --git a/src/rt/rust_cc.cpp b/src/rt/rust_cc.cpp index b0a1804d096be..41cc1684290bd 100644 --- a/src/rt/rust_cc.cpp +++ b/src/rt/rust_cc.cpp @@ -1,19 +1,17 @@ // Rust cycle collector. Temporary, but will probably stick around for some // time until LLVM's GC infrastructure is more mature. -#include "rust_debug.h" -#include "rust_internal.h" -#include "rust_shape.h" -#include "rust_task.h" -#include -#include -#include #include #include #include -#include #include +#include "rust_globals.h" +#include "rust_cc.h" +#include "rust_debug.h" +#include "rust_shape.h" +#include "rust_task.h" + // The number of allocations Rust code performs before performing cycle // collection. #define RUST_CC_FREQUENCY 5000 diff --git a/src/rt/rust_debug.cpp b/src/rt/rust_debug.cpp index 9591d9ade070f..47aaec0008787 100644 --- a/src/rt/rust_debug.cpp +++ b/src/rt/rust_debug.cpp @@ -1,13 +1,13 @@ // Routines useful when debugging the Rust runtime. +#include "rust_globals.h" #include "rust_abi.h" #include "rust_debug.h" -#include "rust_internal.h" +#include "rust_task.h" #include #include #include -#include namespace { diff --git a/src/rt/rust_env.cpp b/src/rt/rust_env.cpp index 9237e8b593c4a..a54dc27c71f49 100644 --- a/src/rt/rust_env.cpp +++ b/src/rt/rust_env.cpp @@ -3,7 +3,7 @@ // that might come from the environment is loaded here, once, during // init. -#include "rust_internal.h" +#include "rust_env.h" // The environment variables that the runtime knows about #define RUST_THREADS "RUST_THREADS" diff --git a/src/rt/rust_env.h b/src/rt/rust_env.h index adf3dc8a7d482..007ac9b1e0b19 100644 --- a/src/rt/rust_env.h +++ b/src/rt/rust_env.h @@ -1,3 +1,9 @@ + +#ifndef RUST_ENV_H +#define RUST_ENV_H + +#include "rust_globals.h" + struct rust_env { size_t num_sched_threads; size_t min_stack_size; @@ -11,3 +17,5 @@ struct rust_env { rust_env* load_env(); void free_env(rust_env *rust_env); + +#endif diff --git a/src/rt/rust_globals.h b/src/rt/rust_globals.h index dcd1ec855754c..54b80ee7908c8 100644 --- a/src/rt/rust_globals.h +++ b/src/rt/rust_globals.h @@ -25,11 +25,10 @@ #include #include #include +#include -#include "rust.h" #include "rand.h" #include "uthash.h" -#include "rust_env.h" #if defined(__WIN32__) extern "C" { @@ -52,6 +51,28 @@ extern "C" { #error "Platform not supported." #endif +#ifdef __i386__ +// 'cdecl' ABI only means anything on i386 +#ifdef __WIN32__ +#ifndef CDECL +#define CDECL __cdecl +#endif +#ifndef FASTCALL +#define FASTCALL __fastcall +#endif +#else +#define CDECL __attribute__((cdecl)) +#define FASTCALL __attribute__((fastcall)) +#endif +#else +#define CDECL +#define FASTCALL +#endif + +/* Controls whether claims are turned into checks */ +/* Variable name must be kept consistent with trans.rs */ +extern "C" int check_claims; + #define CHECKED(call) \ { \ int res = (call); \ @@ -64,4 +85,16 @@ extern "C" { } \ } +#define PTR "0x%" PRIxPTR + +// This accounts for logging buffers. +static size_t const BUF_BYTES = 2048; + +// The error status to use when the process fails +#define PROC_FAIL_CODE 101 + +// A cond(ition) is something we can block on. This can be a channel +// (writing), a port (reading) or a task (waiting). +struct rust_cond { }; + #endif /* RUST_GLOBALS_H */ diff --git a/src/rt/rust_internal.h b/src/rt/rust_internal.h deleted file mode 100644 index bcf88cfcaf157..0000000000000 --- a/src/rt/rust_internal.h +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef RUST_INTERNAL_H -#define RUST_INTERNAL_H - -#include "rust_globals.h" -#include "util/array_list.h" -#include "util/indexed_list.h" -#include "util/synchronized_indexed_list.h" -#include "util/hash_map.h" -#include "sync/sync.h" -#include "sync/lock_and_signal.h" -#include "sync/lock_free_queue.h" - -struct rust_sched_loop; -struct rust_task; -class rust_log; -class rust_port; -class rust_kernel; - -struct stk_seg; -struct type_desc; -struct frame_glue_fns; - -typedef intptr_t rust_sched_id; -typedef intptr_t rust_task_id; -typedef intptr_t rust_port_id; - -#define PTR "0x%" PRIxPTR - -// This drives our preemption scheme. - -static size_t const TIME_SLICE_IN_MS = 10; - -// This accounts for logging buffers. - -static size_t const BUF_BYTES = 2048; - -// The error status to use when the process fails -#define PROC_FAIL_CODE 101 - -// Every reference counted object should use this macro and initialize -// ref_count. - -#define RUST_REFCOUNTED(T) \ - RUST_REFCOUNTED_WITH_DTOR(T, delete (T*)this) -#define RUST_REFCOUNTED_WITH_DTOR(T, dtor) \ - intptr_t ref_count; \ - void ref() { ++ref_count; } \ - void deref() { if (--ref_count == 0) { dtor; } } - -#define RUST_ATOMIC_REFCOUNT() \ -private: \ - intptr_t ref_count; \ -public: \ - void ref() { \ - intptr_t old = sync::increment(ref_count); \ - assert(old > 0); \ - } \ - void deref() { if(0 == sync::decrement(ref_count)) { delete_this(); } } \ - intptr_t get_ref_count() { return sync::read(ref_count); } - -template struct task_owned { - inline void *operator new(size_t size, rust_task *task, const char *tag); - - inline void *operator new[](size_t size, rust_task *task, - const char *tag); - - inline void *operator new(size_t size, rust_task &task, const char *tag); - - inline void *operator new[](size_t size, rust_task &task, - const char *tag); - - void operator delete(void *ptr) { - ((T *)ptr)->task->free(ptr); - } -}; - -template 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 struct region_owned { - void operator delete(void *ptr) { - ((T *)ptr)->region->free(ptr); - } -}; - -// A cond(ition) is something we can block on. This can be a channel -// (writing), a port (reading) or a task (waiting). - -struct rust_cond { }; - -#include "memory_region.h" -#include "rust_log.h" -#include "rust_kernel.h" -#include "rust_sched_loop.h" - -typedef void CDECL (glue_fn)(void *, void *, - const type_desc **, void *); - -struct rust_shape_tables { - uint8_t *tags; - uint8_t *resources; -}; - -typedef unsigned long ref_cnt_t; - -// Corresponds to the boxed data in the @ region. The body follows the -// header; you can obtain a ptr via box_body() below. -struct rust_opaque_box { - ref_cnt_t ref_count; - type_desc *td; - rust_opaque_box *prev; - rust_opaque_box *next; -}; - -// The type of functions that we spawn, which fall into two categories: -// - the main function: has a NULL environment, but uses the void* arg -// - unique closures of type fn~(): have a non-NULL environment, but -// no arguments (and hence the final void*) is harmless -typedef void (*CDECL spawn_fn)(void*, rust_opaque_box*, void *); - -// corresponds to the layout of a fn(), fn@(), fn~() etc -struct fn_env_pair { - spawn_fn f; - rust_opaque_box *env; -}; - -static inline void *box_body(rust_opaque_box *box) { - // Here we take advantage of the fact that the size of a box in 32 - // (resp. 64) bit is 16 (resp. 32) bytes, and thus always 16-byte aligned. - // If this were to change, we would have to update the method - // rustc::middle::trans::base::opaque_box_body() as well. - return (void*)(box + 1); -} - -struct type_desc { - // First part of type_desc is known to compiler. - // first_param = &descs[1] if dynamic, null if static. - const type_desc **first_param; - size_t size; - size_t align; - glue_fn *take_glue; - glue_fn *drop_glue; - glue_fn *free_glue; - void *UNUSED; - glue_fn *sever_glue; // For GC. - glue_fn *mark_glue; // For GC. - uintptr_t unused2; - void *UNUSED_2; - const uint8_t *shape; - const rust_shape_tables *shape_tables; - uintptr_t n_params; - uintptr_t n_obj_params; - - // Residual fields past here are known only to runtime. - UT_hash_handle hh; - size_t n_descs; - const type_desc *descs[]; -}; - -extern "C" type_desc *rust_clone_type_desc(type_desc*); - -#include "circular_buffer.h" -#include "rust_task.h" -#include "rust_port.h" -#include "memory.h" - -// -// Local Variables: -// mode: C++ -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: -// - -#endif diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp index 172926f5f8d60..259870bcd6987 100644 --- a/src/rt/rust_kernel.cpp +++ b/src/rt/rust_kernel.cpp @@ -1,4 +1,7 @@ -#include "rust_internal.h" + +#include "rust_kernel.h" +#include "rust_globals.h" +#include "rust_port.h" #include "rust_util.h" #include "rust_scheduler.h" diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h index 7e3640f063186..3683773a7fb32 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 sched_map; @@ -81,4 +87,19 @@ class rust_kernel { void set_exit_status(int code); }; +template 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 +inline void *kernel_owned::operator new(size_t size, rust_kernel *kernel, + const char *tag) { + return kernel->malloc(size, tag); +} + #endif /* RUST_KERNEL_H */ diff --git a/src/rt/rust_log.cpp b/src/rt/rust_log.cpp index ce48c37062d81..df1ae6fd47f05 100644 --- a/src/rt/rust_log.cpp +++ b/src/rt/rust_log.cpp @@ -2,12 +2,11 @@ * Logging infrastructure that aims to support multi-threading */ -#include "rust_internal.h" + +#include "rust_log.h" #include "util/array_list.h" -#include -#include -#include #include "rust_util.h" +#include "rust_task.h" /** * Synchronizes access to the underlying logging mechanism. diff --git a/src/rt/rust_log.h b/src/rt/rust_log.h index 33fb9eef38b8f..423f66fa7cd46 100644 --- a/src/rt/rust_log.h +++ b/src/rt/rust_log.h @@ -2,6 +2,8 @@ #ifndef RUST_LOG_H #define RUST_LOG_H +#include "rust_globals.h" + const uint32_t log_err = 0; const uint32_t log_warn = 1; const uint32_t log_info = 2; diff --git a/src/rt/rust_port.cpp b/src/rt/rust_port.cpp index 3d8765859621b..f1a40508acad3 100644 --- a/src/rt/rust_port.cpp +++ b/src/rt/rust_port.cpp @@ -1,6 +1,6 @@ -#include "rust_internal.h" -#include "rust_port.h" +#include "rust_port.h" +#include "rust_task.h" rust_port::rust_port(rust_task *task, size_t unit_sz) : ref_count(1), kernel(task->kernel), task(task), diff --git a/src/rt/rust_port.h b/src/rt/rust_port.h index 454b1dcce45b6..ae160de217f21 100644 --- a/src/rt/rust_port.h +++ b/src/rt/rust_port.h @@ -1,7 +1,8 @@ #ifndef RUST_PORT_H #define RUST_PORT_H -#include "rust_internal.h" +#include "rust_globals.h" +#include "circular_buffer.h" class port_detach_cond : public rust_cond { }; diff --git a/src/rt/rust_port_selector.cpp b/src/rt/rust_port_selector.cpp index 51018bf95a95f..7b3b45788f73b 100644 --- a/src/rt/rust_port_selector.cpp +++ b/src/rt/rust_port_selector.cpp @@ -1,5 +1,7 @@ + #include "rust_port.h" #include "rust_port_selector.h" +#include "rust_task.h" rust_port_selector::rust_port_selector() : ports(NULL), n_ports(0) { diff --git a/src/rt/rust_port_selector.h b/src/rt/rust_port_selector.h index 3bfc454aaf85c..8dbf0c4032932 100644 --- a/src/rt/rust_port_selector.h +++ b/src/rt/rust_port_selector.h @@ -1,9 +1,8 @@ #ifndef RUST_PORT_SELECTOR_H #define RUST_PORT_SELECTOR_H -#include "rust_internal.h" +#include "rust_globals.h" -struct rust_task; class rust_port; class rust_port_selector : public rust_cond { diff --git a/src/rt/rust_refcount.h b/src/rt/rust_refcount.h new file mode 100644 index 0000000000000..0e70af31aff96 --- /dev/null +++ b/src/rt/rust_refcount.h @@ -0,0 +1,31 @@ + +#ifndef RUST_REFCOUNT_H +#define RUST_REFCOUNT_H + +#include "sync/sync.h" + +// Refcounting defines +typedef unsigned long ref_cnt_t; + +#define RUST_REFCOUNTED(T) \ + RUST_REFCOUNTED_WITH_DTOR(T, delete (T*)this) + +#define RUST_REFCOUNTED_WITH_DTOR(T, dtor) \ + intptr_t ref_count; \ + void ref() { ++ref_count; } \ + void deref() { if (--ref_count == 0) { dtor; } } + +#define RUST_ATOMIC_REFCOUNT() \ +private: \ + intptr_t ref_count; \ +public: \ + void ref() { \ + intptr_t old = sync::increment(ref_count); \ + assert(old > 0); \ + } \ + void deref() { if(0 == sync::decrement(ref_count)) { delete_this(); } } \ + intptr_t get_ref_count() { return sync::read(ref_count); } + + + +#endif diff --git a/src/rt/rust_run_program.cpp b/src/rt/rust_run_program.cpp index 8390c8e472367..8d7396aab9327 100644 --- a/src/rt/rust_run_program.cpp +++ b/src/rt/rust_run_program.cpp @@ -1,4 +1,5 @@ -#include "rust_internal.h" + +#include "rust_kernel.h" #ifdef __APPLE__ #include diff --git a/src/rt/rust_sched_driver.cpp b/src/rt/rust_sched_driver.cpp index dd9ca9e7f1064..0da9d580dc3b0 100644 --- a/src/rt/rust_sched_driver.cpp +++ b/src/rt/rust_sched_driver.cpp @@ -1,5 +1,5 @@ -#include -#include "rust_internal.h" + +#include "rust_globals.h" #include "rust_sched_driver.h" #include "rust_sched_loop.h" diff --git a/src/rt/rust_sched_launcher.cpp b/src/rt/rust_sched_launcher.cpp index 7111cbb804b5c..3406835dfbb72 100644 --- a/src/rt/rust_sched_launcher.cpp +++ b/src/rt/rust_sched_launcher.cpp @@ -1,3 +1,4 @@ + #include "rust_sched_launcher.h" #include "rust_scheduler.h" diff --git a/src/rt/rust_sched_launcher.h b/src/rt/rust_sched_launcher.h index e5b230fce4d11..523a199401e9a 100644 --- a/src/rt/rust_sched_launcher.h +++ b/src/rt/rust_sched_launcher.h @@ -1,9 +1,10 @@ #ifndef RUST_SCHED_LAUNCHER_H #define RUST_SCHED_LAUNCHER_H -#include "rust_internal.h" #include "sync/rust_thread.h" #include "rust_sched_driver.h" +#include "rust_kernel.h" +#include "rust_sched_loop.h" class rust_sched_launcher : public kernel_owned { public: diff --git a/src/rt/rust_sched_loop.cpp b/src/rt/rust_sched_loop.cpp index 1076aa8af3f60..e8942f37733e5 100644 --- a/src/rt/rust_sched_loop.cpp +++ b/src/rt/rust_sched_loop.cpp @@ -1,9 +1,5 @@ -#include -#include -#include -#include -#include "rust_internal.h" +#include "rust_sched_loop.h" #include "rust_util.h" #include "rust_scheduler.h" diff --git a/src/rt/rust_sched_loop.h b/src/rt/rust_sched_loop.h index 9c059ac623041..7f60f7e449d16 100644 --- a/src/rt/rust_sched_loop.h +++ b/src/rt/rust_sched_loop.h @@ -1,10 +1,12 @@ #ifndef RUST_SCHED_LOOP_H #define RUST_SCHED_LOOP_H -#include "rust_internal.h" +#include "rust_globals.h" +#include "rust_log.h" #include "rust_stack.h" #include "rust_signal.h" #include "context.h" +#include "util/indexed_list.h" enum rust_task_state { task_state_newborn, @@ -23,6 +25,8 @@ enum rust_sched_loop_state { sched_loop_state_exit }; +class rust_kernel; +class rust_scheduler; struct rust_task; typedef indexed_list rust_task_list; @@ -176,6 +180,8 @@ rust_sched_loop::return_c_stack(stk_seg *stack) { } } +// this is needed to appease the circular dependency gods +#include "rust_task.h" // // Local Variables: diff --git a/src/rt/rust_sched_reaper.cpp b/src/rt/rust_sched_reaper.cpp index f2897859f231c..4d5237ac54e1f 100644 --- a/src/rt/rust_sched_reaper.cpp +++ b/src/rt/rust_sched_reaper.cpp @@ -1,4 +1,4 @@ -#include "rust_internal.h" + #include "rust_kernel.h" #include "rust_sched_reaper.h" diff --git a/src/rt/rust_scheduler.cpp b/src/rt/rust_scheduler.cpp index 582289a318241..acf5dfcbe88b8 100644 --- a/src/rt/rust_scheduler.cpp +++ b/src/rt/rust_scheduler.cpp @@ -1,4 +1,7 @@ + #include "rust_scheduler.h" +#include "rust_task.h" +#include "rust_globals.h" #include "rust_util.h" #include "rust_sched_launcher.h" diff --git a/src/rt/rust_scheduler.h b/src/rt/rust_scheduler.h index cd98992b91785..84f3df195a468 100644 --- a/src/rt/rust_scheduler.h +++ b/src/rt/rust_scheduler.h @@ -1,7 +1,9 @@ #ifndef RUST_SCHEDULER_H #define RUST_SCHEDULER_H -#include "rust_internal.h" +#include "rust_globals.h" +#include "util/array_list.h" +#include "rust_kernel.h" class rust_sched_launcher; diff --git a/src/rt/rust_shape.cpp b/src/rt/rust_shape.cpp index 472a691a6fa56..9598744aea390 100644 --- a/src/rt/rust_shape.cpp +++ b/src/rt/rust_shape.cpp @@ -1,16 +1,14 @@ // Functions that interpret the shape of a type to perform various low-level // actions, such as copying, freeing, comparing, and so on. + #include #include #include #include #include -#include -#include -#include -#include -#include "rust_internal.h" + +#include "rust_task.h" #include "rust_shape.h" namespace shape { diff --git a/src/rt/rust_shape.h b/src/rt/rust_shape.h index ad3841b54432c..a181a88145714 100644 --- a/src/rt/rust_shape.h +++ b/src/rt/rust_shape.h @@ -9,7 +9,8 @@ #undef min #include -#include "rust_internal.h" + +#include "rust_globals.h" #include "rust_util.h" // ISAAC pollutes our namespace. diff --git a/src/rt/rust_stack.cpp b/src/rt/rust_stack.cpp index adcf7e4b4bab9..5b5cda74828eb 100644 --- a/src/rt/rust_stack.cpp +++ b/src/rt/rust_stack.cpp @@ -1,5 +1,5 @@ -#include "rust_internal.h" +#include "rust_stack.h" #include "vg/valgrind.h" #include "vg/memcheck.h" diff --git a/src/rt/rust_stack.h b/src/rt/rust_stack.h index ecd591cbe365b..4d88868d5586f 100644 --- a/src/rt/rust_stack.h +++ b/src/rt/rust_stack.h @@ -1,8 +1,11 @@ #ifndef RUST_STACK_H #define RUST_STACK_H +#include "rust_globals.h" #include "memory_region.h" +struct rust_task; + struct stk_seg { stk_seg *prev; stk_seg *next; diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index f56ea868b30a1..e1bc74e53dfeb 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -1,16 +1,15 @@ -#include "rust_internal.h" -#include "rust_cc.h" - #ifndef __WIN32__ #include #endif #include -#include -#include #include +#include "rust_task.h" +#include "rust_cc.h" #include "rust_upcall.h" +#include "rust_env.h" +#include "rust_port.h" // Tasks rust_task::rust_task(rust_sched_loop *sched_loop, rust_task_state state, diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h index f670704293ae3..2a6ed8fdd44e3 100644 --- a/src/rt/rust_task.h +++ b/src/rt/rust_task.h @@ -1,6 +1,3 @@ -/* - * - */ #ifndef RUST_TASK_H #define RUST_TASK_H @@ -8,14 +5,15 @@ #include #include "util/array_list.h" - #include "context.h" #include "rust_debug.h" -#include "rust_internal.h" #include "rust_kernel.h" #include "boxed_region.h" #include "rust_stack.h" #include "rust_port_selector.h" +#include "rust_type.h" +#include "rust_sched_loop.h" +#include "memory.h" // The amount of extra space at the end of each stack segment, available // to the rt, compiler and dynamic linker for running small functions @@ -272,6 +270,38 @@ rust_task : public kernel_owned, rust_cond void cleanup_after_turn(); }; +// FIXME: It would be really nice to be able to get rid of this. +inline void *operator new[](size_t size, rust_task *task, const char *tag) { + return task->malloc(size, tag); +} + + +template struct task_owned { + inline void *operator new(size_t size, rust_task *task, + const char *tag) { + return task->malloc(size, tag); + } + + inline void *operator new[](size_t size, rust_task *task, + const char *tag) { + return task->malloc(size, tag); + } + + inline void *operator new(size_t size, rust_task &task, + const char *tag) { + return task.malloc(size, tag); + } + + inline void *operator new[](size_t size, rust_task &task, + const char *tag) { + return task.malloc(size, tag); + } + + void operator delete(void *ptr) { + ((T *)ptr)->task->free(ptr); + } +}; + // This stuff is on the stack-switching fast path // Get a rough approximation of the current stack pointer diff --git a/src/rt/rust_type.h b/src/rt/rust_type.h new file mode 100644 index 0000000000000..399832d553c4e --- /dev/null +++ b/src/rt/rust_type.h @@ -0,0 +1,72 @@ + +#ifndef RUST_TYPE_H +#define RUST_TYPE_H + +#include "rust_refcount.h" + +// The type of functions that we spawn, which fall into two categories: +// - the main function: has a NULL environment, but uses the void* arg +// - unique closures of type fn~(): have a non-NULL environment, but +// no arguments (and hence the final void*) is harmless +typedef void (*CDECL spawn_fn)(void*, rust_opaque_box*, void *); + +struct type_desc; + +typedef void CDECL (glue_fn)(void *, void *, const type_desc **, void *); + +struct rust_shape_tables { + uint8_t *tags; + uint8_t *resources; +}; + +// Corresponds to the boxed data in the @ region. The body follows the +// header; you can obtain a ptr via box_body() below. +struct rust_opaque_box { + ref_cnt_t ref_count; + type_desc *td; + rust_opaque_box *prev; + rust_opaque_box *next; +}; + +// corresponds to the layout of a fn(), fn@(), fn~() etc +struct fn_env_pair { + spawn_fn f; + rust_opaque_box *env; +}; + +static inline void *box_body(rust_opaque_box *box) { + // Here we take advantage of the fact that the size of a box in 32 + // (resp. 64) bit is 16 (resp. 32) bytes, and thus always 16-byte aligned. + // If this were to change, we would have to update the method + // rustc::middle::trans::base::opaque_box_body() as well. + return (void*)(box + 1); +} + +struct type_desc { + // First part of type_desc is known to compiler. + // first_param = &descs[1] if dynamic, null if static. + const type_desc **first_param; + size_t size; + size_t align; + glue_fn *take_glue; + glue_fn *drop_glue; + glue_fn *free_glue; + void *UNUSED; + glue_fn *sever_glue; // For GC. + glue_fn *mark_glue; // For GC. + uintptr_t unused2; + void *UNUSED_2; + const uint8_t *shape; + const rust_shape_tables *shape_tables; + uintptr_t n_params; + uintptr_t n_obj_params; + + // Residual fields past here are known only to runtime. + UT_hash_handle hh; + size_t n_descs; + const type_desc *descs[]; +}; + +extern "C" type_desc *rust_clone_type_desc(type_desc*); + +#endif diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index 56446ab83a3f6..9f4faa87512bb 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -6,15 +6,15 @@ switch to the C stack. */ +#include "rust_globals.h" +#include "rust_task.h" #include "rust_cc.h" -#include "rust_internal.h" #include "rust_sched_loop.h" #include "rust_unwind.h" #include "rust_upcall.h" #include "rust_util.h" #include - #ifdef __GNUC__ #define LOG_UPCALL_ENTRY(task) \ LOG(task, upcall, \ diff --git a/src/rt/rust_upcall.h b/src/rt/rust_upcall.h index 344730e2171e9..0030ef19b368f 100644 --- a/src/rt/rust_upcall.h +++ b/src/rt/rust_upcall.h @@ -1,6 +1,9 @@ -#pragma once + +#ifndef RUST_UPCALL_H +#define RUST_UPCALL_H // Upcalls used from C code on occasion: extern "C" CDECL void upcall_shared_free(void* ptr); +#endif diff --git a/src/rt/rust_util.h b/src/rt/rust_util.h index 0af16978390ce..9928a05c05780 100644 --- a/src/rt/rust_util.h +++ b/src/rt/rust_util.h @@ -1,8 +1,9 @@ #ifndef RUST_UTIL_H #define RUST_UTIL_H -#include "rust_task.h" #include +#include "rust_task.h" +#include "rust_env.h" // Inline fn used regularly elsewhere. diff --git a/src/rt/rust_uv.cpp b/src/rt/rust_uv.cpp index a926ed8b288cc..7e7486fca621e 100644 --- a/src/rt/rust_uv.cpp +++ b/src/rt/rust_uv.cpp @@ -1,4 +1,6 @@ -#include "rust_internal.h" + +#include "rust_globals.h" +#include "rust_task.h" #include "uv.h" // crust fn pointers diff --git a/src/rt/sync/lock_and_signal.cpp b/src/rt/sync/lock_and_signal.cpp index 7500a9c3a19d2..ccc762c2cc99d 100644 --- a/src/rt/sync/lock_and_signal.cpp +++ b/src/rt/sync/lock_and_signal.cpp @@ -1,5 +1,6 @@ -#include + #include "../rust_globals.h" +#include "lock_and_signal.h" /* * A "lock-and-signal" pair. These are necessarily coupled on pthreads @@ -8,8 +9,6 @@ * if you're using a pthreads cvar+mutex pair. */ -#include "lock_and_signal.h" - // FIXME: This is not a portable way of specifying an invalid pthread_t #define INVALID_THREAD 0 diff --git a/src/rt/sync/lock_and_signal.h b/src/rt/sync/lock_and_signal.h index fae9b1c24ea3e..927b0c5b0ff21 100644 --- a/src/rt/sync/lock_and_signal.h +++ b/src/rt/sync/lock_and_signal.h @@ -2,6 +2,8 @@ #ifndef LOCK_AND_SIGNAL_H #define LOCK_AND_SIGNAL_H +#include "rust_globals.h" + #ifndef RUST_NDEBUG #define DEBUG_LOCKS #endif diff --git a/src/rt/sync/lock_free_queue.h b/src/rt/sync/lock_free_queue.h index 377dd93e34e91..3ee15d5d3a6a6 100644 --- a/src/rt/sync/lock_free_queue.h +++ b/src/rt/sync/lock_free_queue.h @@ -42,6 +42,7 @@ */ #include + template class lock_free_queue { diff --git a/src/rt/sync/rust_thread.cpp b/src/rt/sync/rust_thread.cpp index 6937f4f781138..5d533acde3db9 100644 --- a/src/rt/sync/rust_thread.cpp +++ b/src/rt/sync/rust_thread.cpp @@ -1,4 +1,4 @@ -#include "rust_globals.h" + #include "rust_thread.h" const size_t default_stack_sz = 1024*1024; diff --git a/src/rt/sync/rust_thread.h b/src/rt/sync/rust_thread.h index 1a483b658c0da..56cf85d466085 100644 --- a/src/rt/sync/rust_thread.h +++ b/src/rt/sync/rust_thread.h @@ -1,6 +1,8 @@ #ifndef RUST_THREAD_H #define RUST_THREAD_H +#include "rust_globals.h" + /** * Thread utility class. Derive and implement your own run() method. */ diff --git a/src/rt/util/array_list.h b/src/rt/util/array_list.h index 495594cf7e68a..6321611c81c98 100644 --- a/src/rt/util/array_list.h +++ b/src/rt/util/array_list.h @@ -2,6 +2,9 @@ #ifndef ARRAY_LIST_H #define ARRAY_LIST_H +#include +#include + /** * A simple, resizable array list. */ diff --git a/src/rt/util/synchronized_indexed_list.h b/src/rt/util/synchronized_indexed_list.h deleted file mode 100644 index f7c451ee5b140..0000000000000 --- a/src/rt/util/synchronized_indexed_list.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef SYNCHRONIZED_INDEXED_LIST_H -#define SYNCHRONIZED_INDEXED_LIST_H - -#include "indexed_list.h" -#include "../sync/lock_and_signal.h" - -template class synchronized_indexed_list : - public indexed_list { - lock_and_signal _lock; - -public: - synchronized_indexed_list() { - } - - int32_t append(T *value) { - int32_t index = 0; - _lock.lock(); - index = indexed_list::append(value); - _lock.unlock(); - return index; - } - - bool pop(T **value) { - _lock.lock(); - bool result = indexed_list::pop(value); - _lock.unlock(); - return result; - } - - size_t length() { - size_t length = 0; - _lock.lock(); - length = indexed_list::length(); - _lock.unlock(); - return length; - } - - bool is_empty() { - bool empty = false; - _lock.lock(); - empty = indexed_list::is_empty(); - _lock.unlock(); - return empty; - } - - int32_t remove(T* value) { - size_t index = 0; - _lock.lock(); - index = indexed_list::remove(value); - _lock.unlock(); - return index; - } - - T *operator[](size_t index) { - T *value = NULL; - _lock.lock(); - value = indexed_list::operator[](index); - _lock.unlock(); - return value; - } -}; - -// -// Local Variables: -// mode: C++ -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'"; -// End: -// - -#endif /* SYNCHRONIZED_INDEXED_LIST_H */ From 540a423c5b8e1b372d71c2acc9d2506a7c69ff21 Mon Sep 17 00:00:00 2001 From: Jon Morton Date: Tue, 3 Apr 2012 04:37:00 -0500 Subject: [PATCH 2/5] actually remove memory.h; include cleanups --- src/rt/memory.h | 9 --------- src/rt/rust_kernel.h | 10 +++------- src/rt/rust_refcount.h | 2 -- src/rt/rust_scheduler.cpp | 2 +- src/rt/rust_task.h | 1 - src/rt/rust_upcall.cpp | 1 - 6 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 src/rt/memory.h diff --git a/src/rt/memory.h b/src/rt/memory.h deleted file mode 100644 index 16662fd7a1428..0000000000000 --- a/src/rt/memory.h +++ /dev/null @@ -1,9 +0,0 @@ -// -*- c++ -*- -#ifndef MEMORY_H -#define MEMORY_H - -#include "rust_task.h" - - - -#endif /* MEMORY_H */ diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h index 3683773a7fb32..ec7a5876ad98a 100644 --- a/src/rt/rust_kernel.h +++ b/src/rt/rust_kernel.h @@ -89,17 +89,13 @@ class rust_kernel { template struct kernel_owned { inline void *operator new(size_t size, rust_kernel *kernel, - const char *tag); + const char *tag) { + return kernel->malloc(size, tag); + } void operator delete(void *ptr) { ((T *)ptr)->kernel->free(ptr); } }; -template -inline void *kernel_owned::operator new(size_t size, rust_kernel *kernel, - const char *tag) { - return kernel->malloc(size, tag); -} - #endif /* RUST_KERNEL_H */ diff --git a/src/rt/rust_refcount.h b/src/rt/rust_refcount.h index 0e70af31aff96..b8067cf6941f0 100644 --- a/src/rt/rust_refcount.h +++ b/src/rt/rust_refcount.h @@ -26,6 +26,4 @@ public: \ void deref() { if(0 == sync::decrement(ref_count)) { delete_this(); } } \ intptr_t get_ref_count() { return sync::read(ref_count); } - - #endif diff --git a/src/rt/rust_scheduler.cpp b/src/rt/rust_scheduler.cpp index acf5dfcbe88b8..af52b48f985c8 100644 --- a/src/rt/rust_scheduler.cpp +++ b/src/rt/rust_scheduler.cpp @@ -1,7 +1,7 @@ +#include "rust_globals.h" #include "rust_scheduler.h" #include "rust_task.h" -#include "rust_globals.h" #include "rust_util.h" #include "rust_sched_launcher.h" diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h index 2a6ed8fdd44e3..54362e284506f 100644 --- a/src/rt/rust_task.h +++ b/src/rt/rust_task.h @@ -13,7 +13,6 @@ #include "rust_port_selector.h" #include "rust_type.h" #include "rust_sched_loop.h" -#include "memory.h" // The amount of extra space at the end of each stack segment, available // to the rt, compiler and dynamic linker for running small functions diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index 9f4faa87512bb..f127349e429f9 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -13,7 +13,6 @@ #include "rust_unwind.h" #include "rust_upcall.h" #include "rust_util.h" -#include #ifdef __GNUC__ #define LOG_UPCALL_ENTRY(task) \ From b2e1ef35936adaf1f47b43358471a2c9987478fe Mon Sep 17 00:00:00 2001 From: Jon Morton Date: Tue, 3 Apr 2012 13:43:23 -0500 Subject: [PATCH 3/5] fix include error in rust_task --- src/rt/rust_task.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index e1bc74e53dfeb..07457dd14adde 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -10,6 +10,7 @@ #include "rust_upcall.h" #include "rust_env.h" #include "rust_port.h" +#include "rust_globals.h" // Tasks rust_task::rust_task(rust_sched_loop *sched_loop, rust_task_state state, From 50b0bf9df922a656be0e9ab85fbb729253788722 Mon Sep 17 00:00:00 2001 From: Jon Morton Date: Tue, 3 Apr 2012 17:33:25 -0500 Subject: [PATCH 4/5] fix 'I don't know how C works' --- src/rt/rust_kernel.cpp | 3 ++- src/rt/rust_kernel.h | 2 ++ src/rt/rust_task.cpp | 1 - src/rt/rust_task.h | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp index 259870bcd6987..361282fdb6d5f 100644 --- a/src/rt/rust_kernel.cpp +++ b/src/rt/rust_kernel.cpp @@ -1,6 +1,7 @@ + + #include "rust_kernel.h" -#include "rust_globals.h" #include "rust_port.h" #include "rust_util.h" #include "rust_scheduler.h" diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h index ec7a5876ad98a..bb9df50258680 100644 --- a/src/rt/rust_kernel.h +++ b/src/rt/rust_kernel.h @@ -4,6 +4,8 @@ #include #include + +#include "rust_globals.h" #include "memory_region.h" #include "rust_log.h" #include "rust_sched_reaper.h" diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 07457dd14adde..e1bc74e53dfeb 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -10,7 +10,6 @@ #include "rust_upcall.h" #include "rust_env.h" #include "rust_port.h" -#include "rust_globals.h" // Tasks rust_task::rust_task(rust_sched_loop *sched_loop, rust_task_state state, diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h index 54362e284506f..5a841f00f5913 100644 --- a/src/rt/rust_task.h +++ b/src/rt/rust_task.h @@ -4,6 +4,7 @@ #include +#include "rust_globals.h" #include "util/array_list.h" #include "context.h" #include "rust_debug.h" From 04360433fe8d3154ad51c880afa0ac6344cbedbf Mon Sep 17 00:00:00 2001 From: Jon Morton Date: Tue, 3 Apr 2012 17:50:12 -0500 Subject: [PATCH 5/5] freebsd inttypes.h fix --- src/rt/rust_globals.h | 1 - src/rt/rust_kernel.cpp | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/rt/rust_globals.h b/src/rt/rust_globals.h index 54b80ee7908c8..7bc612b7b1d72 100644 --- a/src/rt/rust_globals.h +++ b/src/rt/rust_globals.h @@ -16,7 +16,6 @@ #define ERROR 0 #include -#include #include #include #include diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp index 361282fdb6d5f..997e484e76b59 100644 --- a/src/rt/rust_kernel.cpp +++ b/src/rt/rust_kernel.cpp @@ -1,13 +1,11 @@ - +#include #include "rust_kernel.h" #include "rust_port.h" #include "rust_util.h" #include "rust_scheduler.h" -#include - #define KLOG_(...) \ KLOG(this, kern, __VA_ARGS__) #define KLOG_ERR_(field, ...) \