Skip to content

Commit b88a5fe

Browse files
committed
---
yaml --- r: 2778 b: refs/heads/master c: 23c1335 h: refs/heads/master v: v3
1 parent 3d9101b commit b88a5fe

File tree

3 files changed

+3
-58
lines changed

3 files changed

+3
-58
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 579b317ae8e4155c480b0d9426e54f4b98410997
2+
refs/heads/master: 23c1335cb3cd022b95ebe1f7acfc8192c6f310cd

trunk/src/rt/rust_crate_cache.cpp

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,6 @@
11

22
#include "rust_internal.h"
33

4-
rust_crate_cache::lib::lib(rust_dom *dom, char const *name)
5-
: handle(0),
6-
dom(dom)
7-
{
8-
#if defined(__WIN32__)
9-
handle = (uintptr_t)LoadLibrary(_T(name));
10-
#else
11-
handle = (uintptr_t)dlopen(name, RTLD_GLOBAL|RTLD_LAZY);
12-
#endif
13-
DLOG(dom, cache, "loaded library '%s' as 0x%" PRIxPTR,
14-
name, handle);
15-
}
16-
17-
rust_crate_cache::lib::~lib() {
18-
DLOG(dom, cache, "~rust_crate_cache::lib(0x%" PRIxPTR ")",
19-
handle);
20-
if (handle) {
21-
#if defined(__WIN32__)
22-
FreeLibrary((HMODULE)handle);
23-
#else
24-
dlclose((void*)handle);
25-
#endif
26-
}
27-
}
28-
29-
uintptr_t
30-
rust_crate_cache::lib::get_handle() {
31-
return handle;
32-
}
33-
344
static inline void
355
adjust_disp(uintptr_t &disp, const void *oldp, const void *newp)
366
{
@@ -79,29 +49,17 @@ rust_crate_cache::get_type_desc(size_t size,
7949

8050
rust_crate_cache::rust_crate_cache(rust_dom *dom,
8151
rust_crate const *crate)
82-
: libs((lib**) dom->calloc(sizeof(lib*) * crate->n_libs)),
83-
type_descs(NULL),
52+
: type_descs(NULL),
8453
crate(crate),
8554
dom(dom),
8655
idx(0)
8756
{
88-
I(dom, libs);
8957
}
9058

9159
void
9260
rust_crate_cache::flush() {
9361
DLOG(dom, cache, "rust_crate_cache::flush()");
9462

95-
for (size_t i = 0; i < crate->n_libs; ++i) {
96-
lib *l = libs[i];
97-
if (l) {
98-
DLOG(dom, cache, "rust_crate_cache::flush() deref lib %"
99-
PRIdPTR " (rc=%" PRIdPTR ")", i, l->ref_count);
100-
l->deref();
101-
}
102-
libs[i] = NULL;
103-
}
104-
10563
while (type_descs) {
10664
type_desc *d = type_descs;
10765
HASH_DEL(type_descs, d);
@@ -113,7 +71,6 @@ rust_crate_cache::flush() {
11371
rust_crate_cache::~rust_crate_cache()
11472
{
11573
flush();
116-
dom->free(libs);
11774
}
11875

11976
//

trunk/src/rt/rust_internal.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class rust_crate {
241241

242242
size_t pad6;
243243
size_t pad7;
244-
size_t n_libs;
244+
size_t pad8;
245245

246246
// Crates are immutable, constructed by the compiler.
247247

@@ -286,25 +286,13 @@ rust_crate_cache : public dom_owned<rust_crate_cache>,
286286
public rc_base<rust_crate_cache>
287287
{
288288
public:
289-
class lib :
290-
public rc_base<lib>, public dom_owned<lib>
291-
{
292-
uintptr_t handle;
293-
public:
294-
rust_dom *dom;
295-
lib(rust_dom *dom, char const *name);
296-
uintptr_t get_handle();
297-
~lib();
298-
};
299-
300289
type_desc *get_type_desc(size_t size,
301290
size_t align,
302291
size_t n_descs,
303292
type_desc const **descs);
304293

305294
private:
306295

307-
lib **libs;
308296
type_desc *type_descs;
309297

310298
public:

0 commit comments

Comments
 (0)