Skip to content

Commit

Permalink
remove debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Arruda committed Jul 13, 2024
1 parent a75d4ad commit 9abe8f6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 26 deletions.
7 changes: 0 additions & 7 deletions cjyafn/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,20 +626,13 @@ pub extern "C" fn function_eval_json(func: *const (), input: *mut c_char) -> Out
unsafe {
try_with(func, |func: &Function| {
let input_cstr = CStr::from_ptr(input);
println!("input_cstr created");
let input_str = input_cstr.to_string_lossy();
println!("input_str created");
let input_value: serde_json::Value =
serde_json::from_str(input_str.trim()).map_err(|e| e.to_string())?;
println!("input_value created");
let output_value: serde_json::Value = func.eval(&input_value)?;
println!("func evaled");
let output_str = serde_json::to_string(&output_value).expect("can serialize");
println!("output_str created");
let output_cstr = new_c_str(output_str);
println!("output_cstr created");

println!("out:{:?}", output_cstr);
Ok(output_cstr)
})
}
Expand Down
13 changes: 0 additions & 13 deletions jyafn/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ impl Function {
assert_eq!(self.data.input_size, input.len());
assert_eq!(self.data.output_size, output.len());

println!("doing the very, very dangerous call");
println!("calling function at {:?}", self.data.fn_ptr);
// Safety: input and output sizes are checked and function pinky-promisses not to
// accesses anything out of bounds.
unsafe { (self.data.fn_ptr)(input.as_ptr(), output.as_mut_ptr()) }
Expand All @@ -182,29 +180,23 @@ impl Function {
E: ?Sized + layout::Encode,
D: layout::Decoder,
{
println!("starting eval wit decoder");
// Access buffers:
let local_input = self
.data
.input
.get_or(|| RefCell::new(layout::Visitor::new(self.data.input_size / 8)));
println!("local input created");
let local_output = self
.data
.output
.get_or(|| RefCell::new(layout::Visitor::new(self.data.output_size / 8)));
println!("local output created");
let mut encode_visitor = local_input.borrow_mut();
encode_visitor.reset();
println!("encode visitor reset");
let mut decode_visitor = local_output.borrow_mut();
decode_visitor.reset();
println!("decode visitor reset");

// Define a symbols view (to store symbols present in the input not present in the
// graph)
let mut symbols_view = layout::SymbolsView::new(&self.data.graph.symbols);
println!("symbols view created");

// Serialization dance:
input
Expand All @@ -214,22 +206,17 @@ impl Function {
&mut encode_visitor,
)
.map_err(|err| Error::EncodeError(Box::new(err)))?;
println!("serialization dance done... time for the big surprise");

// Call:
let status = self.call_raw(&encode_visitor.0, &mut decode_visitor.0);
println!("called raw");
if status != std::ptr::null() {
println!("status is not null");
// Safety: null was checked and the function pinky-promisses to return a valid
// C string in case of error.
let error = unsafe { CStr::from_ptr(status) };
println!("raising status");
return Err(Error::StatusRaised(error.to_string_lossy().to_string()));
}

// Deserialization dance:
println!("doing decoder dance");
Ok(decoder.build(&self.data.output_layout, &symbols_view, &mut decode_visitor))
}

Expand Down
3 changes: 0 additions & 3 deletions jyafn/src/graph/compile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ where
});
}

println!("{rendered}");
println!("{}", String::from_utf8_lossy(&qbe_output.stdout));

Ok(String::from_utf8_lossy(&qbe_output.stdout).to_string())
}

Expand Down
3 changes: 0 additions & 3 deletions jyafn/src/mapping/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,10 @@ impl Mapping {
}

unsafe fn call_mapping(mapping: *const Mapping, hash: u64) -> *const u8 {
println!("calling mapping at {:?}", mapping);
let mapping = &*mapping;
if let Some(line) = mapping.storage.as_ref().and_then(|s| s.get(hash)) {
println!("found line at {:?}", line.as_ptr());
line.as_ptr()
} else {
println!("line not found");
std::ptr::null()
}
}
Expand Down

0 comments on commit 9abe8f6

Please sign in to comment.