about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-11-12 06:05:03 -0800
committerBrian Anderson <banderson@mozilla.com>2013-11-12 06:05:03 -0800
commit6b6f89b0ecf7dcde1a03cc5f61fe0767befadd5f (patch)
treee309f6f0c5219bc19c5ef2d54992d426f3ee2b1e
parent11b07847e6e75bfd26efe85f8c60f53fcc55a631 (diff)
downloadrust-6b6f89b0ecf7dcde1a03cc5f61fe0767befadd5f.tar.gz
rust-6b6f89b0ecf7dcde1a03cc5f61fe0767befadd5f.zip
rt: Delete more C++
-rw-r--r--src/rt/rust_builtin.cpp11
-rw-r--r--src/rt/rust_test_helpers.cpp1
-rw-r--r--src/rt/rust_type.h81
-rw-r--r--src/rt/rust_upcall.cpp1
-rw-r--r--src/rt/rust_util.h57
5 files changed, 10 insertions, 141 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index b8e808863c0..90042491d1d 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -10,7 +10,6 @@
 
 /* Foreign builtins. */
 
-#include "rust_util.h"
 #include "sync/lock_and_signal.h"
 #include "vg/valgrind.h"
 
@@ -234,6 +233,16 @@ precise_time_ns(uint64_t *ns) {
 #endif
 }
 
+struct
+rust_vec
+{
+    size_t fill;    // in bytes; if zero, heapified
+    size_t alloc;   // in bytes
+    uint8_t data[0];
+};
+
+typedef rust_vec rust_str;
+
 struct rust_tm {
     int32_t tm_sec;
     int32_t tm_min;
diff --git a/src/rt/rust_test_helpers.cpp b/src/rt/rust_test_helpers.cpp
index 3c6e2d68c2f..631745e656a 100644
--- a/src/rt/rust_test_helpers.cpp
+++ b/src/rt/rust_test_helpers.cpp
@@ -10,7 +10,6 @@
 
 // Helper functions used only in tests
 
-#include "rust_util.h"
 #include "sync/lock_and_signal.h"
 
 // These functions are used in the unit tests for C ABI calls.
diff --git a/src/rt/rust_type.h b/src/rt/rust_type.h
deleted file mode 100644
index fe3c946a40b..00000000000
--- a/src/rt/rust_type.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-#ifndef RUST_TYPE_H
-#define RUST_TYPE_H
-
-#include "rust_globals.h"
-
-struct rust_opaque_box;
-
-// 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)(rust_opaque_box*, void *);
-
-struct type_desc;
-
-typedef void CDECL (glue_fn)(void *,
-                             void *);
-
-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;
-};
-
-// 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 slice {
-    void *data;
-    size_t length;
-};
-
-struct type_desc {
-    size_t size;
-    size_t align;
-    glue_fn *take_glue;
-    glue_fn *drop_glue;
-    glue_fn *free_glue;
-    glue_fn *visit_glue;
-    size_t borrow_offset;
-    slice name;
-};
-
-#endif
-
-//
-// Local Variables:
-// mode: C++
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index e7648a081be..95f4bec02e9 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -17,7 +17,6 @@
  */
 
 #include "rust_globals.h"
-#include "rust_util.h"
 
 //Unwinding ABI declarations.
 typedef int _Unwind_Reason_Code;
diff --git a/src/rt/rust_util.h b/src/rt/rust_util.h
deleted file mode 100644
index bd3258c24f9..00000000000
--- a/src/rt/rust_util.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#ifndef RUST_UTIL_H
-#define RUST_UTIL_H
-
-#include <limits.h>
-#include "rust_type.h"
-
-// Inline fn used regularly elsewhere.
-
-// Rounds |size| to the nearest |alignment|. Invariant: |alignment| is a power
-// of two.
-template<typename T>
-static inline T
-align_to(T size, size_t alignment) {
-    assert(alignment);
-    T x = (T)(((uintptr_t)size + alignment - 1) & ~(alignment - 1));
-    return x;
-}
-
-// Interior vectors (rust-user-code level).
-
-struct
-rust_vec
-{
-    size_t fill;    // in bytes; if zero, heapified
-    size_t alloc;   // in bytes
-    uint8_t data[0];
-};
-
-typedef rust_vec rust_str;
-
-inline size_t get_box_size(size_t body_size, size_t body_align) {
-    size_t header_size = sizeof(rust_opaque_box);
-    size_t total_size = align_to(header_size, body_align) + body_size;
-    return total_size;
-}
-
-//
-// Local Variables:
-// mode: C++
-// fill-column: 78;
-// indent-tabs-mode: nil
-// c-basic-offset: 4
-// buffer-file-coding-system: utf-8-unix
-// End:
-//
-
-#endif