about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-08-22 23:30:25 -0700
committerBrian Anderson <banderson@mozilla.com>2013-08-23 18:38:59 -0700
commit9cdfe1e6039598961838ba2cc88a6ed6aa5449bf (patch)
tree04997cedc88215f23ba63f96ad31b5accc4775dd
parent0ee24437ce80bf25023ddb45db37fa3eadc689f1 (diff)
downloadrust-9cdfe1e6039598961838ba2cc88a6ed6aa5449bf.tar.gz
rust-9cdfe1e6039598961838ba2cc88a6ed6aa5449bf.zip
rt: Remove rust_abi
-rw-r--r--mk/rt.mk1
-rw-r--r--src/rt/rust_abi.cpp88
-rw-r--r--src/rt/rust_abi.h78
-rw-r--r--src/rt/rust_builtin.cpp1
-rw-r--r--src/rt/rust_test_helpers.cpp1
5 files changed, 0 insertions, 169 deletions
diff --git a/mk/rt.mk b/mk/rt.mk
index f4b0132ded8..6a9620c7364 100644
--- a/mk/rt.mk
+++ b/mk/rt.mk
@@ -74,7 +74,6 @@ RUNTIME_CXXS_$(1)_$(2) := \
               rt/rust_log.cpp \
               rt/isaac/randport.cpp \
               rt/miniz.cpp \
-              rt/rust_abi.cpp \
               rt/memory_region.cpp \
               rt/boxed_region.cpp \
               rt/arch/$$(HOST_$(1))/context.cpp \
diff --git a/src/rt/rust_abi.cpp b/src/rt/rust_abi.cpp
deleted file mode 100644
index fd1b7860b29..00000000000
--- a/src/rt/rust_abi.cpp
+++ /dev/null
@@ -1,88 +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.
-
-// ABI-specific routines.
-
-#include <sstream>
-#include <string>
-#include <vector>
-#include <cstdlib>
-#include <stdint.h>
-#include "rust_abi.h"
-
-#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__)
-#define HAVE_DLFCN_H
-#include <dlfcn.h>
-#elif defined(_WIN32)
-// Otherwise it's windows.h -- included in rust_abi.h
-#endif
-
-#define END_OF_STACK_RA     (void (*)())0xdeadbeef
-
-weak_symbol<uint32_t> abi_version("rust_abi_version");
-
-uint32_t get_abi_version() {
-    return (*abi_version == NULL) ? 0 : **abi_version;
-}
-
-namespace stack_walk {
-
-#ifdef HAVE_DLFCN_H
-std::string
-frame::symbol() const {
-    std::stringstream ss;
-
-    Dl_info info;
-    if (!dladdr((void *)ra, &info))
-        ss << "??";
-    else
-        ss << info.dli_sname;
-
-    ss << " @ " << std::hex << (uintptr_t)ra;
-    return ss.str();
-}
-#else
-std::string
-frame::symbol() const {
-    std::stringstream ss;
-    ss << std::hex << (uintptr_t)ra;
-    return ss.str();
-}
-#endif
-
-std::vector<frame>
-backtrace() {
-    std::vector<frame> frames;
-
-    // Ideally we would use the current value of EIP here, but there's no
-    // portable way to get that and there are never any GC roots in our C++
-    // frames anyhow.
-    frame f(__builtin_frame_address(0), (void (*)())NULL);
-
-    while (f.ra != END_OF_STACK_RA) {
-        frames.push_back(f);
-        f.next();
-    }
-    return frames;
-}
-
-std::string
-symbolicate(const std::vector<frame> &frames) {
-    std::stringstream ss;
-    std::vector<frame>::const_iterator begin(frames.begin()),
-                                       end(frames.end());
-    while (begin != end) {
-        ss << begin->symbol() << std::endl;
-        ++begin;
-    }
-    return ss.str();
-}
-
-}   // end namespace stack_walk
diff --git a/src/rt/rust_abi.h b/src/rt/rust_abi.h
deleted file mode 100644
index 4179bf75157..00000000000
--- a/src/rt/rust_abi.h
+++ /dev/null
@@ -1,78 +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.
-
-// ABI-specific routines.
-
-#ifndef RUST_ABI_H
-#define RUST_ABI_H
-
-#include <cstdlib>
-#include <string>
-#include <vector>
-#include <stdint.h>
-
-#ifdef __WIN32__
-#include <windows.h>
-#else
-#include <dlfcn.h>
-#endif
-
-template<typename T>
-class weak_symbol {
-private:
-    bool init;
-    T *data;
-    const char *name;
-
-    void fill() {
-        if (init)
-            return;
-
-#ifdef __WIN32__
-        data = (T *)GetProcAddress(GetModuleHandle(NULL), name);
-#else
-        data = (T *)dlsym(RTLD_DEFAULT, name);
-#endif
-
-        init = true;
-    }
-
-public:
-    weak_symbol(const char *in_name)
-    : init(false), data(NULL), name(in_name) {}
-
-    T *&operator*() { fill(); return data; }
-};
-
-namespace stack_walk {
-
-struct frame {
-    uint8_t *bp;    // The frame pointer.
-    void (*ra)();   // The return address.
-
-    frame(void *in_bp, void (*in_ra)()) : bp((uint8_t *)in_bp), ra(in_ra) {}
-
-    inline void next() {
-        ra = *(void (**)())(bp + sizeof(void *));
-        bp = *(uint8_t **)bp;
-    }
-
-    std::string symbol() const;
-};
-
-std::vector<frame> backtrace();
-std::string symbolicate(const std::vector<frame> &frames);
-
-}   // end namespace stack_walk
-
-
-uint32_t get_abi_version();
-
-#endif
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index ff4975fdcd8..6f3a3bd3686 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -15,7 +15,6 @@
 #include "sync/lock_and_signal.h"
 #include "memory_region.h"
 #include "boxed_region.h"
-#include "rust_abi.h"
 #include "rust_rng.h"
 #include "vg/valgrind.h"
 #include "sp.h"
diff --git a/src/rt/rust_test_helpers.cpp b/src/rt/rust_test_helpers.cpp
index 33fea72cca7..f10a1f36938 100644
--- a/src/rt/rust_test_helpers.cpp
+++ b/src/rt/rust_test_helpers.cpp
@@ -13,7 +13,6 @@
 #include "rust_util.h"
 #include "sync/rust_thread.h"
 #include "sync/lock_and_signal.h"
-#include "rust_abi.h"
 
 // These functions are used in the unit tests for C ABI calls.