about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-02-27 14:06:44 -0800
committerNiko Matsakis <niko@alum.mit.edu>2012-02-28 06:31:28 -0800
commit55a642c2d472034a66e1af4e81dbdc2fe42e7ddb (patch)
tree0cc7a4df7b0e3733432056a55f32b77758d5aae1 /src/comp
parent8cffc6f84c1553fb7075d465f918d2ac335b15b1 (diff)
downloadrust-55a642c2d472034a66e1af4e81dbdc2fe42e7ddb.tar.gz
rust-55a642c2d472034a66e1af4e81dbdc2fe42e7ddb.zip
correct freevar encoding, add more debugging output
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/metadata/astencode.rs17
-rw-r--r--src/comp/metadata/encoder.rs2
2 files changed, 16 insertions, 3 deletions
diff --git a/src/comp/metadata/astencode.rs b/src/comp/metadata/astencode.rs
index bed7494ebc1..4c859494d32 100644
--- a/src/comp/metadata/astencode.rs
+++ b/src/comp/metadata/astencode.rs
@@ -56,13 +56,21 @@ iface tr {
 
 fn encode_inlined_item(ecx: @e::encode_ctxt,
                        ebml_w: ebml::writer,
+                       path: ast_map::path,
                        item: @ast::item) {
+    #debug["> Encoding inlined item: %s::%s (%u)",
+           ast_map::path_to_str(path),
+           item.ident,
+           ebml_w.writer.tell()];
     let id_range = compute_id_range(item);
     ebml_w.wr_tag(c::tag_ast as uint) {||
         encode_id_range(ebml_w, id_range);
         encode_ast(ebml_w, item);
         encode_side_tables_for_item(ecx, ebml_w, item);
     }
+    #debug["< Encoded inlined item: %s (%u)",
+           ast_map::path_to_str(path),
+           ebml_w.writer.tell()];
 }
 
 fn decode_inlined_item(cdata: cstore::crate_metadata,
@@ -74,6 +82,7 @@ fn decode_inlined_item(cdata: cstore::crate_metadata,
     alt par_doc.opt_child(c::tag_ast) {
       none { none }
       some(ast_doc) {
+        #debug["> Decoding inlined item: %s", ast_map::path_to_str(path)];
         let from_id_range = decode_id_range(ast_doc);
         let to_id_range = reserve_id_range(dcx.tcx.sess, from_id_range);
         let xcx = @{dcx: dcx,
@@ -81,8 +90,10 @@ fn decode_inlined_item(cdata: cstore::crate_metadata,
                     to_id_range: to_id_range};
         let raw_item = decode_ast(ast_doc);
         let item = renumber_ast(xcx, raw_item);
+        #debug[">> Item named: %s", item.ident];
         ast_map::map_decoded_item(dcx.tcx.items, path, item);
         decode_side_tables(xcx, ast_doc);
+        #debug["< Decoded inlined item: %s", ast_map::path_to_str(path)];
         some(item)
       }
     }
@@ -629,7 +640,7 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
             ebml_w.id(id);
             ebml_w.tag(c::tag_table_val) {||
                 ebml_w.emit_from_vec(*fv) {|fv_entry|
-                    encode_def(ebml_w, fv_entry.def);
+                    encode_freevar_entry(ebml_w, *fv_entry)
                 }
             }
         }
@@ -759,7 +770,7 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
         let id0 = entry_doc[c::tag_table_id].as_int();
         let id = xcx.tr_id(id0);
 
-        #debug["side table document with tag 0x%x found for id %d (orig %d)",
+        #debug[">> Side table document with tag 0x%x found for id %d (orig %d)",
                tag, id, id0];
 
         if tag == (c::tag_table_mutbl as uint) {
@@ -803,6 +814,8 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
                     #fmt["Unknown tag found in side tables: %x", tag]);
             }
         }
+
+        #debug[">< Side table doc loaded"];
     }
 }
 
diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs
index 348c28784a2..705848b48ff 100644
--- a/src/comp/metadata/encoder.rs
+++ b/src/comp/metadata/encoder.rs
@@ -352,7 +352,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
         encode_symbol(ecx, ebml_w, item.id);
         encode_path(ebml_w, path, ast_map::path_name(item.ident));
         if should_inline(path, item) {
-            astencode::encode_inlined_item(ecx, ebml_w, item);
+            astencode::encode_inlined_item(ecx, ebml_w, path, item);
         }
         ebml_w.end_tag();
       }