1
Fork 0

Dead code.

This commit is contained in:
Rafael Ávila de Espíndola 2011-05-25 12:00:16 -04:00
parent 579b317ae8
commit 23c1335cb3
2 changed files with 2 additions and 57 deletions

View file

@ -1,36 +1,6 @@
#include "rust_internal.h"
rust_crate_cache::lib::lib(rust_dom *dom, char const *name)
: handle(0),
dom(dom)
{
#if defined(__WIN32__)
handle = (uintptr_t)LoadLibrary(_T(name));
#else
handle = (uintptr_t)dlopen(name, RTLD_GLOBAL|RTLD_LAZY);
#endif
DLOG(dom, cache, "loaded library '%s' as 0x%" PRIxPTR,
name, handle);
}
rust_crate_cache::lib::~lib() {
DLOG(dom, cache, "~rust_crate_cache::lib(0x%" PRIxPTR ")",
handle);
if (handle) {
#if defined(__WIN32__)
FreeLibrary((HMODULE)handle);
#else
dlclose((void*)handle);
#endif
}
}
uintptr_t
rust_crate_cache::lib::get_handle() {
return handle;
}
static inline void
adjust_disp(uintptr_t &disp, const void *oldp, const void *newp)
{
@ -79,29 +49,17 @@ rust_crate_cache::get_type_desc(size_t size,
rust_crate_cache::rust_crate_cache(rust_dom *dom,
rust_crate const *crate)
: libs((lib**) dom->calloc(sizeof(lib*) * crate->n_libs)),
type_descs(NULL),
: type_descs(NULL),
crate(crate),
dom(dom),
idx(0)
{
I(dom, libs);
}
void
rust_crate_cache::flush() {
DLOG(dom, cache, "rust_crate_cache::flush()");
for (size_t i = 0; i < crate->n_libs; ++i) {
lib *l = libs[i];
if (l) {
DLOG(dom, cache, "rust_crate_cache::flush() deref lib %"
PRIdPTR " (rc=%" PRIdPTR ")", i, l->ref_count);
l->deref();
}
libs[i] = NULL;
}
while (type_descs) {
type_desc *d = type_descs;
HASH_DEL(type_descs, d);
@ -113,7 +71,6 @@ rust_crate_cache::flush() {
rust_crate_cache::~rust_crate_cache()
{
flush();
dom->free(libs);
}
//

View file

@ -241,7 +241,7 @@ public:
size_t pad6;
size_t pad7;
size_t n_libs;
size_t pad8;
// Crates are immutable, constructed by the compiler.
@ -286,17 +286,6 @@ rust_crate_cache : public dom_owned<rust_crate_cache>,
public rc_base<rust_crate_cache>
{
public:
class lib :
public rc_base<lib>, public dom_owned<lib>
{
uintptr_t handle;
public:
rust_dom *dom;
lib(rust_dom *dom, char const *name);
uintptr_t get_handle();
~lib();
};
type_desc *get_type_desc(size_t size,
size_t align,
size_t n_descs,
@ -304,7 +293,6 @@ public:
private:
lib **libs;
type_desc *type_descs;
public: