提交 fcb38141 编写于 作者: J Josh Matthews

Disable lexical block and function debug info caches to improve compilation...

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.
上级 03e9dac0
...@@ -101,7 +101,7 @@ fn update_cache(cache: metadata_cache, mdtag: int, val: debug_metadata) { ...@@ -101,7 +101,7 @@ fn update_cache(cache: metadata_cache, mdtag: int, val: debug_metadata) {
type file_md = {path: str}; type file_md = {path: str};
type compile_unit_md = {path: str}; type compile_unit_md = {path: str};
type subprogram_md = {path: str}; type subprogram_md = {id: ast::node_id};
type local_var_md = {id: ast::node_id}; type local_var_md = {id: ast::node_id};
type tydesc_md = {hash: uint}; type tydesc_md = {hash: uint};
type block_md = {start: codemap::loc, end: codemap::loc}; type block_md = {start: codemap::loc, end: codemap::loc};
...@@ -225,39 +225,39 @@ fn line_from_span(cm: codemap::codemap, sp: span) -> uint { ...@@ -225,39 +225,39 @@ fn line_from_span(cm: codemap::codemap, sp: span) -> uint {
} }
fn create_block(cx: @block_ctxt, sp: span) -> @metadata<block_md> { fn create_block(cx: @block_ctxt, sp: span) -> @metadata<block_md> {
let cache = get_cache(bcx_ccx(cx)); //let cache = get_cache(bcx_ccx(cx));
let start = codemap::lookup_char_pos(bcx_ccx(cx).sess.codemap, let start = codemap::lookup_char_pos(bcx_ccx(cx).sess.codemap,
sp.lo); sp.lo);
let fname = start.filename; let fname = start.filename;
let end = codemap::lookup_char_pos(bcx_ccx(cx).sess.codemap, let end = codemap::lookup_char_pos(bcx_ccx(cx).sess.codemap,
sp.hi); sp.hi);
let tg = LexicalBlockTag; let tg = LexicalBlockTag;
alt cached_metadata::<@metadata<block_md>>( /*alt cached_metadata::<@metadata<block_md>>(
cache, tg, cache, tg,
{|md| start == md.data.start && end == md.data.end}) { {|md| start == md.data.start && end == md.data.end}) {
option::some(md) { ret md; } option::some(md) { ret md; }
option::none {} option::none {}
} }*/
let parent = alt cx.parent { let parent = alt cx.parent {
parent_none { create_function(cx.fcx, sp).node } parent_none { create_function(cx.fcx, sp).node }
parent_some(bcx) { create_block(cx, sp).node } parent_some(bcx) { create_block(bcx, sp).node }
}; };
let file_node = create_file(bcx_ccx(cx), fname); let file_node = create_file(bcx_ccx(cx), fname);
let unique_id = alt cache.find(LexicalBlockTag) { /*let unique_id = alt cache.find(LexicalBlockTag) {
option::some(v) { vec::len(v) as int } option::some(v) { vec::len(v) as int }
option::none { 0 } option::none { 0 }
}; };*/
let lldata = [lltag(tg), let lldata = [lltag(tg),
parent, parent,
lli32(start.line as int), lli32(start.line as int),
lli32(start.col as int), lli32(start.col as int),
file_node.node, file_node.node/*,
lli32(unique_id) lli32(unique_id)*/
]; ];
let val = llmdnode(lldata); let val = llmdnode(lldata);
let mdval = @{node: val, data: {start: start, end: end}}; let mdval = @{node: val, data: {start: start, end: end}};
update_cache(cache, tg, block_metadata(mdval)); //update_cache(cache, tg, block_metadata(mdval));
ret mdval; ret mdval;
} }
...@@ -721,7 +721,7 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> { ...@@ -721,7 +721,7 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> {
#debug("~~"); #debug("~~");
log(debug, fcx.id); log(debug, fcx.id);
log(debug, codemap::span_to_str(sp, cx.sess.codemap)); //log(debug, codemap::span_to_str(sp, cx.sess.codemap));
let (ident, ret_ty, id) = alt cx.ast_map.get(fcx.id) { let (ident, ret_ty, id) = alt cx.ast_map.get(fcx.id) {
ast_map::node_item(item) { ast_map::node_item(item) {
...@@ -754,15 +754,14 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> { ...@@ -754,15 +754,14 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> {
log(debug, ident); log(debug, ident);
log(debug, id); log(debug, id);
let path = str::connect(fcx.lcx.path + [ident], "::"); /*let cache = get_cache(cx);
let cache = get_cache(cx);
alt cached_metadata::<@metadata<subprogram_md>>( alt cached_metadata::<@metadata<subprogram_md>>(
cache, SubprogramTag, {|md| md.data.path == path && cache, SubprogramTag, {|md| md.data.id == id}) {
/*md.data.path == ??*/ true}) {
option::some(md) { ret md; } option::some(md) { ret md; }
option::none {} option::none {}
} }*/
let path = str::connect(fcx.lcx.path + [ident], "::");
let loc = codemap::lookup_char_pos(cx.sess.codemap, let loc = codemap::lookup_char_pos(cx.sess.codemap,
sp.lo); sp.lo);
...@@ -805,7 +804,7 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> { ...@@ -805,7 +804,7 @@ fn create_function(fcx: @fn_ctxt, sp: span) -> @metadata<subprogram_md> {
]; ];
let val = llmdnode(fn_metadata); let val = llmdnode(fn_metadata);
add_named_metadata(cx, "llvm.dbg.sp", val); add_named_metadata(cx, "llvm.dbg.sp", val);
let mdval = @{node: val, data: {path: path}}; let mdval = @{node: val, data: {id: id}};
update_cache(cache, SubprogramTag, subprogram_metadata(mdval)); //update_cache(cache, SubprogramTag, subprogram_metadata(mdval));
ret mdval; ret mdval;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册