Skip to content

Commit fcb3814

Browse files
committed
Disable lexical block and function debug info caches to improve compilation time while #1694 is unfixed, and fix stack-exhaustion bug in block parent generation.
1 parent 03e9dac commit fcb3814

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

Diff for: src/comp/middle/debuginfo.rs

+18-19
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ type metadata<T> = {node: ValueRef, data: T};
101101

102102
type file_md = {path: str};
103103
type compile_unit_md = {path: str};
104-
type subprogram_md = {path: str};
104+
type subprogram_md = {id: ast::node_id};
105105
type local_var_md = {id: ast::node_id};
106106
type tydesc_md = {hash: uint};
107107
type block_md = {start: codemap::loc, end: codemap::loc};
@@ -225,39 +225,39 @@ fn line_from_span(cm: codemap::codemap, sp: span) -> uint {
225225
}
226226

227227
fn create_block(cx: @block_ctxt, sp: span) -> @metadata<block_md> {
228-
let cache = get_cache(bcx_ccx(cx));
228+
//let cache = get_cache(bcx_ccx(cx));
229229
let start = codemap::lookup_char_pos(bcx_ccx(cx).sess.codemap,
230230
sp.lo);
231231
let fname = start.filename;
232232
let end = codemap::lookup_char_pos(bcx_ccx(cx).sess.codemap,
233233
sp.hi);
234234
let tg = LexicalBlockTag;
235-
alt cached_metadata::<@metadata<block_md>>(
235+
/*alt cached_metadata::<@metadata<block_md>>(
236236
cache, tg,
237237
{|md| start == md.data.start && end == md.data.end}) {
238238
option::some(md) { ret md; }
239239
option::none {}
240-
}
240+
}*/
241241

242242
let parent = alt cx.parent {
243243
parent_none { create_function(cx.fcx, sp).node }
244-
parent_some(bcx) { create_block(cx, sp).node }
244+
parent_some(bcx) { create_block(bcx, sp).node }
245245
};
246246
let file_node = create_file(bcx_ccx(cx), fname);
247-
let unique_id = alt cache.find(LexicalBlockTag) {
247+
/*let unique_id = alt cache.find(LexicalBlockTag) {
248248
option::some(v) { vec::len(v) as int }
249249
option::none { 0 }
250-
};
250+
};*/
251251
let lldata = [lltag(tg),
252252
parent,
253253
lli32(start.line as int),
254254
lli32(start.col as int),
255-
file_node.node,
256-
lli32(unique_id)
255+
file_node.node/*,
256+
lli32(unique_id)*/
257257
];
258258
let val = llmdnode(lldata);
259259
let mdval = @{node: val, data: {start: start, end: end}};
260-
update_cache(cache, tg, block_metadata(mdval));
260+
//update_cache(cache, tg, block_metadata(mdval));
261261
ret mdval;
262262
}
263263

@@ -721,7 +721,7 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> {
721721
#debug("~~");
722722
log(debug, fcx.id);
723723

724-
log(debug, codemap::span_to_str(sp, cx.sess.codemap));
724+
//log(debug, codemap::span_to_str(sp, cx.sess.codemap));
725725

726726
let (ident, ret_ty, id) = alt cx.ast_map.get(fcx.id) {
727727
ast_map::node_item(item) {
@@ -754,15 +754,14 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> {
754754
log(debug, ident);
755755
log(debug, id);
756756

757-
let path = str::connect(fcx.lcx.path + [ident], "::");
758-
759-
let cache = get_cache(cx);
757+
/*let cache = get_cache(cx);
760758
alt cached_metadata::<@metadata<subprogram_md>>(
761-
cache, SubprogramTag, {|md| md.data.path == path &&
762-
/*md.data.path == ??*/ true}) {
759+
cache, SubprogramTag, {|md| md.data.id == id}) {
763760
option::some(md) { ret md; }
764761
option::none {}
765-
}
762+
}*/
763+
764+
let path = str::connect(fcx.lcx.path + [ident], "::");
766765

767766
let loc = codemap::lookup_char_pos(cx.sess.codemap,
768767
sp.lo);
@@ -805,7 +804,7 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> {
805804
];
806805
let val = llmdnode(fn_metadata);
807806
add_named_metadata(cx, "llvm.dbg.sp", val);
808-
let mdval = @{node: val, data: {path: path}};
809-
update_cache(cache, SubprogramTag, subprogram_metadata(mdval));
807+
let mdval = @{node: val, data: {id: id}};
808+
//update_cache(cache, SubprogramTag, subprogram_metadata(mdval));
810809
ret mdval;
811810
}

0 commit comments

Comments
 (0)