Abi::Rust => (CallConv::Fast, sig.inputs().to_vec(), sig.output()),
Abi::C => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()),
Abi::RustCall => {
- println!(
- "rust-call sig: {:?} inputs: {:?} output: {:?}",
- sig,
- sig.inputs(),
- sig.output()
- );
assert_eq!(sig.inputs().len(), 2);
let extra_args = match sig.inputs().last().unwrap().sty {
ty::TyTuple(ref tupled_arguments) => tupled_arguments,
}
_ => bug!("argument to function with \"rust-call\" ABI is not a tuple"),
}
- println!(
- "{:?} {:?}",
- pack_arg.layout().ty,
- args.iter().map(|a| a.layout().ty).collect::<Vec<_>>()
- );
args
} else {
args.into_iter()
let ret_layout = fx.layout_of(sig.output());
let output_pass_mode = get_pass_mode(fx.tcx, sig.abi, sig.output(), true);
- println!("{:?}", output_pass_mode);
let return_ptr = match output_pass_mode {
PassMode::NoPass => None,
PassMode::ByRef => match destination {
out_place
.place_field(fx, mir::Field::new(0))
.write_cvalue(fx, res);
- println!("abc");
out_place
.place_field(fx, mir::Field::new(1))
.write_cvalue(fx, has_overflow);
tcx: TyCtxt<'a, 'tcx, 'tcx>,
module: &mut Module<B>,
) {
- println!("todo {:?}", self.todo);
+ //println!("todo {:?}", self.todo);
define_all_allocs(tcx, module, &mut self);
- println!("done {:?}", self.done);
+ //println!("done {:?}", self.done);
for data_id in self.done.drain() {
module.finalize_data(data_id);
}
while let Some(todo_item) = pop_set(&mut cx.todo) {
let (data_id, alloc) = match todo_item {
TodoItem::Alloc(alloc_id) => {
- println!("alloc_id {}", alloc_id);
+ //println!("alloc_id {}", alloc_id);
let data_id = data_id_for_alloc_id(module, alloc_id);
let alloc = memory.get(alloc_id).unwrap();
(data_id, alloc)
}
TodoItem::Static(def_id) => {
- println!("static {:?}", def_id);
+ //println!("static {:?}", def_id);
let instance = ty::Instance::mono(tcx, def_id);
let cid = GlobalId {
instance,
}
};
- println!("data_id {}", data_id);
+ //("data_id {}", data_id);
if cx.done.contains(&data_id) {
continue;
}
_target: &::rustc_target::spec::Target,
_path: &Path,
) -> Result<owning_ref::ErasedBoxRef<[u8]>, String> {
- //use goblin::Object;
-
- //let buffer = ::std::fs::read(path).map_err(|e|format!("{:?}", e))?;
- /*match Object::parse(&buffer).map_err(|e|format!("{:?}", e))? {
- Object::Elf(elf) => {
- println!("elf: {:#?}", &elf);
- },
- Object::PE(pe) => {
- println!("pe: {:#?}", &pe);
- },
- Object::Mach(mach) => {
- println!("mach: {:#?}", &mach);
- },
- Object::Archive(archive) => {
- return Err(format!("archive: {:#?}", &archive));
- },
- Object::Unknown(magic) => {
- return Err(format!("unknown magic: {:#x}", magic))
- }
- }*/
Err("dylib metadata loading is not yet supported".to_string())
}
}