Skip to content

Commit b489526

Browse files
committed
---
yaml --- r: 3411 b: refs/heads/master c: 1ca0db5 h: refs/heads/master i: 3409: 7b60db0 3407: 976d7ac v: v3
1 parent 58a5627 commit b489526

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
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: 5f5b7e33482d58b2830fdeca4e27039519916e49
2+
refs/heads/master: 1ca0db5421c0737088112d55475d37bd7f3d0bb4

trunk/src/comp/middle/ty.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ type ctxt =
217217
creader_cache rcache,
218218
hashmap[t, str] short_names_cache,
219219
hashmap[t, bool] has_pointer_cache,
220+
hashmap[t, bool] owns_heap_mem_cache,
220221
hashmap[@ast::ty, option::t[t]] ast_ty_to_ty_cache);
221222

222223
type ty_ctxt = ctxt;
@@ -413,6 +414,8 @@ fn mk_ctxt(session::session s, resolve::def_map dm, constr_table cs,
413414
str](ty::hash_ty, ty::eq_ty),
414415
has_pointer_cache=map::mk_hashmap[ty::t,
415416
bool](ty::hash_ty, ty::eq_ty),
417+
owns_heap_mem_cache=map::mk_hashmap[ty::t,
418+
bool](ty::hash_ty, ty::eq_ty),
416419
ast_ty_to_ty_cache=map::mk_hashmap[@ast::ty,
417420
option::t[t]](ast::hash_ty,
418421
ast::eq_ty));
@@ -1172,6 +1175,11 @@ fn type_is_signed(&ctxt cx, &t ty) -> bool {
11721175
}
11731176

11741177
fn type_owns_heap_mem(&ctxt cx, &t ty) -> bool {
1178+
alt (cx.owns_heap_mem_cache.find(ty)) {
1179+
case (some(?result)) { ret result; }
1180+
case (none) { /* fall through */ }
1181+
}
1182+
11751183
auto result = false;
11761184
alt (struct(cx, ty)) {
11771185
case (ty_ivec(_)) { result = true; }
@@ -1228,6 +1236,8 @@ fn type_owns_heap_mem(&ctxt cx, &t ty) -> bool {
12281236
case (ty_var(_)) { fail "ty_var in type_owns_heap_mem"; }
12291237
case (ty_param(_)) { result = false; }
12301238
}
1239+
1240+
cx.owns_heap_mem_cache.insert(ty, result);
12311241
ret result;
12321242
}
12331243

0 commit comments

Comments
 (0)