Commit fb8e402a authored by Eduardo Souza's avatar Eduardo Souza

Remove dependency on stackmaps parser crate; link dynamic library with -lffi and -ledit.

parent a5dfd900
Pipeline #5672 canceled with stages
in 1 minute and 46 seconds
......@@ -45,6 +45,8 @@ build:
- git pull
- cargo clean
- cargo build
- $CC -shared -fPIC -ledit -lffi -L$MU_LLVM_ZEBU/target/debug/deps/ -lmu_aot_llvm -o $MU_LLVM_ZEBU/target/debug/deps/libmu_aot_llvm-linked.so # link with -ledit and -lffi
- mv $MU_LLVM_ZEBU/target/debug/deps/libmu_aot_llvm-linked.so $MU_LLVM_ZEBU/target/debug/deps/libmu_aot_llvm.so
- rm ~/.git-credentials || echo ".git-credentials does not exist."
artifacts:
paths:
......
......@@ -34,7 +34,7 @@ doctest = false
#ykstackmaps = { path = "/home/user/.virtualenv/eduardo/ykstackmaps", version = "*" }
llvm-sys = "60"
mu = { git = "https://gitlab.anu.edu.au/mu/mu-impl-fast", branch = "rust-2018", version = "*" }
ykstackmaps = { git = "https://github.com/udesou/ykstackmaps.git", branch = "udesou-master", version = "*" }
#ykstackmaps = { git = "https://github.com/udesou/ykstackmaps.git", branch = "udesou-master", version = "*" }
#llvm-sys = "80"
......
......@@ -24,7 +24,6 @@ use mu::utils::*;
use mu::vm::handle::*;
use mu::vm::*;
use std::path::Path;
use ykstackmaps::StackMapParser;
pub fn llvm(wl_fns: Vec<MuID>) -> CompilerPolicy {
let mut passes: Vec<Box<dyn CompilerPass>> = vec![];
......@@ -302,118 +301,6 @@ pub fn make_boot_image_internal(
true
);
}
// parse_stackmap(out_file, vm);
}
}
fn parse_stackmap(path: String, vm: &VM) {
use std::path::PathBuf;
use ykstackmaps::StackMapParser;
let mut file_path = PathBuf::from(&vm.vm_options.flag_aot_emit_dir);
let path = format!("{}", path);
file_path.push(path);
println!("{:?}", file_path);
match StackMapParser::new(&Path::new(&file_path)) {
Err(e) => {
println!("error: {}", e);
unimplemented!();
}
Ok(mut p) => {
p.num_consts();
p.num_funcs();
p.num_stackmaps();
println!(
"num consts: {}, num funcs: {}, num_stackmaps: {}",
p.num_consts(),
p.num_funcs(),
p.num_stackmaps()
);
for stmap_fns in p.iter_functions() {
match stmap_fns {
Ok(stmap) => println!("{:?}", stmap),
Err(e) => {
panic!("error: {}", e);
break; // You must not re-use the iterator upon error.
}
}
}
for stmap_res in p.iter_stackmaps() {
match stmap_res {
Ok(stmap) => {
println!("{:?}", stmap);
match stmap.pos_remainder {
Some(pos) => parse_stackmap_from_pos(
&Path::new(&file_path),
pos
),
None => ()
}
}
Err(e) => {
panic!("error: {}", e);
break; // You must not re-use the iterator upon error.
}
}
}
}
}
unimplemented!();
}
fn parse_stackmap_from_pos(path: &&Path, pos: u64) {
match StackMapParser::new_from_position(path, pos) {
Err(e) => {
println!("error: {}", e);
unimplemented!();
}
Ok(mut p) => {
p.num_consts();
p.num_funcs();
p.num_stackmaps();
println!(
"num consts: {}, num funcs: {}, num_stackmaps: {}",
p.num_consts(),
p.num_funcs(),
p.num_stackmaps()
);
for stmap_fns in p.iter_functions_from_pos(pos) {
match stmap_fns {
Ok(stmap) => println!("{:?}", stmap),
Err(e) => {
panic!("error: {}", e);
break; // You must not re-use the iterator upon error.
}
}
}
for stmap_res in p.iter_stackmaps_from_pos(pos) {
match stmap_res {
Ok(stmap) => {
println!("{:?}", stmap);
match stmap.pos_remainder {
Some(pos) => parse_stackmap_from_pos(path, pos),
None => ()
}
}
Err(e) => {
panic!("error: {}", e);
break; // You must not re-use the iterator upon error.
}
}
}
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment