Skip to content

Commit

Permalink
Remove librbml and the RBML-tagged auto-encoder/decoder.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Sep 20, 2016
1 parent 2ce0e6d commit 0863012
Show file tree
Hide file tree
Showing 32 changed files with 411 additions and 1,516 deletions.
9 changes: 4 additions & 5 deletions mk/crates.mk
Expand Up @@ -61,7 +61,7 @@ RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_
rustc_plugin rustc_metadata rustc_passes rustc_save_analysis \
rustc_const_eval rustc_const_math rustc_incremental rustc_macro
HOST_CRATES := syntax syntax_ext proc_macro syntax_pos $(RUSTC_CRATES) rustdoc fmt_macros \
flate arena graphviz rbml log serialize
flate arena graphviz log serialize
TOOLS := compiletest rustdoc rustc rustbook error_index_generator

DEPS_core :=
Expand Down Expand Up @@ -96,7 +96,6 @@ DEPS_getopts := std
DEPS_graphviz := std
DEPS_log := std
DEPS_num := std
DEPS_rbml := std log serialize
DEPS_serialize := std log
DEPS_term := std
DEPS_test := std getopts term native:rust_test_helpers
Expand All @@ -110,7 +109,7 @@ DEPS_rustc_const_math := std syntax log serialize
DEPS_rustc_const_eval := rustc_const_math rustc syntax log serialize \
rustc_back graphviz syntax_pos

DEPS_rustc := syntax fmt_macros flate arena serialize getopts rbml \
DEPS_rustc := syntax fmt_macros flate arena serialize getopts \
log graphviz rustc_llvm rustc_back rustc_data_structures\
rustc_const_math syntax_pos rustc_errors
DEPS_rustc_back := std syntax flate log libc
Expand All @@ -126,7 +125,7 @@ DEPS_rustc_errors := log libc serialize syntax_pos
DEPS_rustc_lint := rustc log syntax syntax_pos rustc_const_eval
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
DEPS_rustc_macro := std syntax
DEPS_rustc_metadata := rustc syntax syntax_pos rustc_errors rbml rustc_const_math \
DEPS_rustc_metadata := rustc syntax syntax_pos rustc_errors rustc_const_math \
rustc_macro syntax_ext
DEPS_rustc_passes := syntax syntax_pos rustc core rustc_const_eval rustc_errors
DEPS_rustc_mir := rustc syntax syntax_pos rustc_const_math rustc_const_eval rustc_bitflags
Expand All @@ -137,7 +136,7 @@ DEPS_rustc_privacy := rustc log syntax syntax_pos
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
log syntax serialize rustc_llvm rustc_platform_intrinsics \
rustc_const_math rustc_const_eval rustc_incremental rustc_errors syntax_pos
DEPS_rustc_incremental := rbml rustc syntax_pos serialize rustc_data_structures
DEPS_rustc_incremental := rustc syntax_pos serialize rustc_data_structures
DEPS_rustc_save_analysis := rustc log syntax syntax_pos serialize
DEPS_rustc_typeck := rustc syntax syntax_pos rustc_platform_intrinsics rustc_const_math \
rustc_const_eval rustc_errors
Expand Down
2 changes: 1 addition & 1 deletion mk/tests.mk
Expand Up @@ -27,7 +27,7 @@ TEST_TARGET_CRATES = $(filter-out core rustc_unicode alloc_system libc \
panic_abort,$(TARGET_CRATES)) \
collectionstest coretest
TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \
log rand rbml serialize syntax term test
log rand serialize syntax term test
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
rustc_trans rustc_lint,\
$(HOST_CRATES))
Expand Down
13 changes: 0 additions & 13 deletions src/librbml/Cargo.toml

This file was deleted.

63 changes: 0 additions & 63 deletions src/librbml/lib.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/librustc/Cargo.toml
Expand Up @@ -14,7 +14,6 @@ flate = { path = "../libflate" }
fmt_macros = { path = "../libfmt_macros" }
graphviz = { path = "../libgraphviz" }
log = { path = "../liblog" }
rbml = { path = "../librbml" }
rustc_back = { path = "../librustc_back" }
rustc_bitflags = { path = "../librustc_bitflags" }
rustc_const_math = { path = "../librustc_const_math" }
Expand Down
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Expand Up @@ -50,7 +50,6 @@ extern crate fmt_macros;
extern crate getopts;
extern crate graphviz;
extern crate libc;
extern crate rbml;
extern crate rustc_llvm as llvm;
extern crate rustc_back;
extern crate rustc_data_structures;
Expand Down
6 changes: 2 additions & 4 deletions src/librustc/middle/cstore.rs
Expand Up @@ -265,8 +265,7 @@ pub trait CrateStore<'tcx> {
reexports: &def::ExportMap,
link_meta: &LinkMeta,
reachable: &NodeSet,
mir_map: &MirMap<'tcx>,
krate: &hir::Crate) -> Vec<u8>;
mir_map: &MirMap<'tcx>) -> Vec<u8>;
fn metadata_encoding_version(&self) -> &[u8];
}

Expand Down Expand Up @@ -472,8 +471,7 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
reexports: &def::ExportMap,
link_meta: &LinkMeta,
reachable: &NodeSet,
mir_map: &MirMap<'tcx>,
krate: &hir::Crate) -> Vec<u8> { vec![] }
mir_map: &MirMap<'tcx>) -> Vec<u8> { vec![] }
fn metadata_encoding_version(&self) -> &[u8] { bug!("metadata_encoding_version") }
}

Expand Down
3 changes: 1 addition & 2 deletions src/librustc_incremental/Cargo.toml
Expand Up @@ -10,10 +10,9 @@ crate-type = ["dylib"]

[dependencies]
graphviz = { path = "../libgraphviz" }
rbml = { path = "../librbml" }
rustc = { path = "../librustc" }
rustc_data_structures = { path = "../librustc_data_structures" }
serialize = { path = "../libserialize" }
log = { path = "../liblog" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
syntax_pos = { path = "../libsyntax_pos" }
1 change: 0 additions & 1 deletion src/librustc_incremental/lib.rs
Expand Up @@ -27,7 +27,6 @@
#![feature(core_intrinsics)]

extern crate graphviz;
extern crate rbml;
#[macro_use] extern crate rustc;
extern crate rustc_data_structures;
extern crate serialize as rustc_serialize;
Expand Down
5 changes: 2 additions & 3 deletions src/librustc_incremental/persist/hash.rs
Expand Up @@ -8,15 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use rbml::Error;
use rbml::opaque::Decoder;
use rustc::dep_graph::DepNode;
use rustc::hir::def_id::{CrateNum, DefId};
use rustc::hir::svh::Svh;
use rustc::ty::TyCtxt;
use rustc_data_structures::fnv::FnvHashMap;
use rustc_data_structures::flock;
use rustc_serialize::Decodable;
use rustc_serialize::opaque::Decoder;
use std::io::{ErrorKind, Read};
use std::fs::File;

Expand Down Expand Up @@ -188,7 +187,7 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> {
fn load_from_data(&mut self,
cnum: CrateNum,
data: &[u8],
expected_svh: Svh) -> Result<(), Error> {
expected_svh: Svh) -> Result<(), String> {
debug!("load_from_data(cnum={})", cnum);

// Load up the hashes for the def-ids from this crate.
Expand Down
5 changes: 2 additions & 3 deletions src/librustc_incremental/persist/load.rs
Expand Up @@ -10,14 +10,13 @@

//! Code to save/load the dep-graph from files.

use rbml::Error;
use rbml::opaque::Decoder;
use rustc::dep_graph::DepNode;
use rustc::hir::def_id::DefId;
use rustc::session::Session;
use rustc::ty::TyCtxt;
use rustc_data_structures::fnv::FnvHashSet;
use rustc_serialize::Decodable as RustcDecodable;
use rustc_serialize::opaque::Decoder;
use std::io::Read;
use std::fs::{self, File};
use std::path::{Path};
Expand Down Expand Up @@ -121,7 +120,7 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
incremental_hashes_map: &IncrementalHashesMap,
dep_graph_data: &[u8],
work_products_data: &[u8])
-> Result<(), Error>
-> Result<(), String>
{
// Decode the list of work_products
let mut work_product_decoder = Decoder::new(work_products_data, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_incremental/persist/save.rs
Expand Up @@ -8,14 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use rbml::opaque::Encoder;
use rustc::dep_graph::DepNode;
use rustc::hir::def_id::DefId;
use rustc::hir::svh::Svh;
use rustc::session::Session;
use rustc::ty::TyCtxt;
use rustc_data_structures::fnv::FnvHashMap;
use rustc_serialize::Encodable as RustcEncodable;
use rustc_serialize::opaque::Encoder;
use std::hash::{Hash, Hasher, SipHasher};
use std::io::{self, Cursor, Write};
use std::fs::{self, File};
Expand Down
1 change: 0 additions & 1 deletion src/librustc_metadata/Cargo.toml
Expand Up @@ -11,7 +11,6 @@ crate-type = ["dylib"]
[dependencies]
flate = { path = "../libflate" }
log = { path = "../liblog" }
rbml = { path = "../librbml" }
rustc = { path = "../librustc" }
rustc_back = { path = "../librustc_back" }
rustc_bitflags = { path = "../librustc_bitflags" }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/astencode.rs
Expand Up @@ -217,7 +217,7 @@ fn encode_side_tables_for_id(ecx: &mut EncodeContext, id: ast::NodeId) {
}

fn decode_side_tables(dcx: &mut DecodeContext, ast_doc: rbml::Doc) {
while dcx.position() < ast_doc.end {
while dcx.opaque.position() < ast_doc.end {
let table = Decodable::decode(dcx).unwrap();
let id = Decodable::decode(dcx).unwrap();
debug!("decode_side_tables: entry for id={}, table={:?}", id, table);
Expand Down
9 changes: 3 additions & 6 deletions src/librustc_metadata/common.rs
Expand Up @@ -10,12 +10,9 @@

#![allow(non_camel_case_types, non_upper_case_globals)]

// RBML enum definitions and utils shared by the encoder and decoder
//
// 0x00..0x1f: reserved for RBML generic type tags
// 0x20..0xef: free for use, preferred for frequent tags
// 0xf0..0xff: internally used by RBML to encode 0x100..0xfff in two bytes
// 0x100..0xfff: free for use, preferred for infrequent tags
pub const tag_opaque: usize = 0x00;

// GAP 0x01...0x19

pub const tag_items: usize = 0x100; // top-level only

Expand Down
21 changes: 3 additions & 18 deletions src/librustc_metadata/csearch.rs
Expand Up @@ -13,7 +13,6 @@ use common;
use decoder;
use encoder;
use loader;
use rbml;

use middle::cstore::{InlinedItem, CrateStore, CrateSource, ChildItem, ExternCrate, DefLike};
use middle::cstore::{NativeLibraryKind, LinkMeta, LinkagePreference};
Expand All @@ -30,7 +29,6 @@ use rustc::mir::mir_map::MirMap;
use rustc::util::nodemap::{FnvHashMap, NodeSet, DefIdMap};
use rustc::session::config::PanicStrategy;

use std::cell::RefCell;
use std::rc::Rc;
use std::path::PathBuf;
use syntax::ast;
Expand Down Expand Up @@ -697,22 +695,9 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
reexports: &def::ExportMap,
link_meta: &LinkMeta,
reachable: &NodeSet,
mir_map: &MirMap<'tcx>,
krate: &hir::Crate) -> Vec<u8>
{
let type_abbrevs = RefCell::new(FnvHashMap());
let ecx = encoder::EncodeContext {
rbml_w: rbml::writer::Encoder::new(),
tcx: tcx,
reexports: reexports,
link_meta: link_meta,
cstore: self,
reachable: reachable,
mir_map: mir_map,
type_abbrevs: &type_abbrevs,
};
encoder::encode_metadata(ecx, krate)

mir_map: &MirMap<'tcx>) -> Vec<u8>
{
encoder::encode_metadata(tcx, self, reexports, link_meta, reachable, mir_map)
}

fn metadata_encoding_version(&self) -> &[u8]
Expand Down

0 comments on commit 0863012

Please sign in to comment.