diff --git a/src/bin/ijvm.rs b/src/bin/ijvm.rs index 553a2ac..a56c3b2 100644 --- a/src/bin/ijvm.rs +++ b/src/bin/ijvm.rs @@ -22,7 +22,6 @@ fn main() { machine.get_program_counter(), machine.frame.len() - 1, str); - return; } } } \ No newline at end of file diff --git a/src/machine.rs b/src/machine.rs index e488c56..ef14d26 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -30,8 +30,8 @@ pub struct Machine { #[cfg(feature = "bonus:heap")] pub heap: Heaps, - pub stream_in: Box, - pub stream_out: Arc>, + pub stream_in: Box, + pub stream_out: Arc>, } impl Machine { @@ -170,7 +170,7 @@ impl Machine { } self.block.seek(checkpoint).unwrap(); - Ok((name.to_string(), params)) + Ok(((*name).to_string(), params)) } // pub fn get_stack_pointer(&self) -> usize { @@ -185,11 +185,11 @@ impl Machine { Ok(self.block.read_u8()? as usize) } - pub fn set_input(&mut self, instream: Box) { + pub fn set_input(&mut self, instream: Box) { self.stream_in = instream; } - pub fn set_output(&mut self, outstream: Arc>) { + pub fn set_output(&mut self, outstream: Arc>) { self.stream_out = outstream; } } diff --git a/src/netstack.rs b/src/netstack.rs index 8429ae4..898698a 100644 --- a/src/netstack.rs +++ b/src/netstack.rs @@ -35,7 +35,7 @@ impl NetStack { let h1 = ((host >> 24) & 0xFF) as u8; let h2 = ((host >> 16) & 0xFF) as u8; let h3 = ((host >> 8) & 0xFF) as u8; - let h4 = ((host >> 0) & 0xFF) as u8; + let h4 = (host & 0xFF) as u8; let addr: String = format!("{}.{}.{}.{}:{}", h1, h2, h3, h4, port); if let Ok(stream) = TcpStream::connect(addr) { diff --git a/src/ops.rs b/src/ops.rs index c1b2392..e786148 100644 --- a/src/ops.rs +++ b/src/ops.rs @@ -380,7 +380,7 @@ fn iastore(machine: &mut Machine) -> Result<()> { _ => return Err("Cannot use int as heapref"), }; let index: i32 = machine.cur_stack().pop()?.try_into()?; - let value = machine.cur_stack().pop()?.clone(); + let value = machine.cur_stack().pop()?; RefCell::borrow_mut(&heap)[index as usize] = value;