To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit 7ca01d63 authored by Javad Ebrahimian Amiri's avatar Javad Ebrahimian Amiri
Browse files

2nd draft of merging with develop branch: Weird rustfmt errors solved

parent 04173f14
......@@ -3846,11 +3846,12 @@ fn write_const_value(f: &mut File, constant: P<Value>) {
#[cfg(not(feature = "sel4-rumprun"))]
pub fn emit_sym_table(vm: &VM) {
debug!("Currently nothing to emit for --!");
}
}
fn mangle_all(name_vec: &mut Vec<String>){
for i in 0..name_vec.len(){
name_vec[i] = name_vec[i].replace('.', "Zd")
fn mangle_all(name_vec: &mut Vec<String>) {
for i in 0..name_vec.len() {
name_vec[i] = name_vec[i]
.replace('.', "Zd")
.replace('-', "Zh")
.replace(':', "Zc")
.replace('#', "Za");
......@@ -3859,7 +3860,7 @@ fn mangle_all(name_vec: &mut Vec<String>){
}
#[cfg(feature = "sel4-rumprun")]
pub fn emit_sym_table(vm: &VM){
pub fn emit_sym_table(vm: &VM) {
use std::path;
use std::io::Write;
......@@ -3880,8 +3881,13 @@ pub fn emit_sym_table(vm: &VM){
file_path_st.push(format!("{}", AOT_EMIT_SYM_TABLE_FILE));
let mut file_st = match File::create(file_path_st.as_path()) {
Err(why) => panic!("couldn't create SYM TABLE file {}: {}",
file_path_st.to_str().unwrap(), why),
Err(why) => {
panic!(
"couldn't create SYM TABLE file {}: {}",
file_path_st.to_str().unwrap(),
why
)
}
Ok(file) => file
};
......@@ -3900,71 +3906,82 @@ pub fn emit_sym_table(vm: &VM){
// *************************************************
let mut sym_vec: Vec<String> = Vec::new();
let compiled_funcs : &HashMap<_, _> = &vm.compiled_funcs().read().unwrap();
let compiled_funcs: &HashMap<_, _> = &vm.compiled_funcs().read().unwrap();
for (theID, theCFs) in compiled_funcs.iter() {
let theCF : &CompiledFunction = &theCFs.read().unwrap();
let theCF: &CompiledFunction = &theCFs.read().unwrap();
match theCF.start {
// CF.start can only be relocatable , otherwise panic
ValueLocation::Relocatable(_, ref symbol) => {
// debug!("theCF.start, symbol = {}\n", *symbol);
// debug!("theCF.start, symbol = {}\n", *symbol);
sym_vec.push((*symbol).clone());
},
}
// CF.start can't reach this state
_ => panic!("Sym_Table_start: expecting Relocatable location, found {}", theCF.start)
_ => {
panic!(
"Sym_Table_start: expecting Relocatable location, found {}",
theCF.start
)
}
}
match theCF.end {
// CF.start can only be relocatable , otherwise panic
ValueLocation::Relocatable(_, ref symbol) => {
// debug!("theCF.end, symbol = {}\n", *symbol);
// debug!("theCF.end, symbol = {}\n", *symbol);
sym_vec.push((*symbol).clone());
},
}
// CF.end can't reach this state
_ => panic!("Sym_Table_end: expecting Relocatable location, found {}", theCF.end)
_ => {
panic!(
"Sym_Table_end: expecting Relocatable location, found {}",
theCF.end
)
}
}
// for &(ref callsite, ref dest) in theCF.frame.get_exception_callsites().iter(){
// match *callsite {
// ValueLocation::Relocatable(_, ref symbol) => {
// sym_vec.push((*symbol).clone());
// },
// // can't reach this state
// _ => panic!("Sym_Table_callsite: expecting Relocatable location, found {}",
// for &(ref callsite, ref dest) in theCF.frame.get_exception_callsites().iter(){
// match *callsite {
// ValueLocation::Relocatable(_, ref symbol) => {
// sym_vec.push((*symbol).clone());
// },
// // can't reach this state
// _ => panic!("Sym_Table_callsite: expecting Relocatable location, found {}",
// callsite)
// }
// match *dest {
// ValueLocation::Relocatable(_, ref symbol) => {
// sym_vec.push((*symbol).clone());
// },
// // can't reach this state
// _ => panic!("Sym_Table_callsite: expecting Relocatable location, found {}", dest)
// }
// }
}
// **************************************************
// Generate the following code:
// .data
// .globl mu_sym_table
// mu_sym_table:
// for each symbol {
// .quad "symbol_name".length()
// __symbol_name:
// .ascii "symbol_name"
// .quad 0
// }
// *************************************************
// match *dest {
// ValueLocation::Relocatable(_, ref symbol) => {
// sym_vec.push((*symbol).clone());
// },
// // can't reach this state
// _ => panic!("Sym_Table_callsite: expecting Relocatable location, found {}",
// dest)
// }
// }
}
mangle_all(&mut sym_vec);
file_st.write("\t.data\n".as_bytes()).unwrap();
file_st.write_fmt(format_args!("\t{}\n",
directive_globl("mu_sym_table".to_string()))).unwrap();
file_st
.write_fmt(format_args!(
"\t{}\n",
directive_globl("mu_sym_table".to_string())
))
.unwrap();
file_st.write_fmt(format_args!("mu_sym_table:\n")).unwrap();
file_st.write_fmt(format_args!(".quad {}\n", sym_vec.len())).unwrap();
for i in 0..sym_vec.len(){
file_st.write_fmt(format_args!(".quad {}\n", sym_vec[i].len())).unwrap();
file_st.write_fmt(format_args!(".ascii \"{}\"\n", sym_vec[i])).unwrap();
file_st.write_fmt(format_args!(".quad {}\n", sym_vec[i])).unwrap();
file_st
.write_fmt(format_args!(".quad {}\n", sym_vec.len()))
.unwrap();
for i in 0..sym_vec.len() {
file_st
.write_fmt(format_args!(".quad {}\n", sym_vec[i].len()))
.unwrap();
file_st
.write_fmt(format_args!(".ascii \"{}\"\n", sym_vec[i]))
.unwrap();
file_st
.write_fmt(format_args!(".quad {}\n", sym_vec[i]))
.unwrap();
}
}
......
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