diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index fade25ccafb1caa91db843d4930698c93c605a4c..64db29608cbe90b1fc3e2601f345642dbea7b1be 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -166,7 +166,7 @@ impl ProtocolDescription { // entirety. Find some way to interface with the parameter's types. pub(crate) fn new_component_v2( &self, module_name: &[u8], identifier: &[u8], arguments: ValueGroup - ) -> Result { + ) -> Result { // Find the module in which the definition can be found let module_root = self.lookup_module_root(module_name); if module_root.is_none() { @@ -210,9 +210,7 @@ impl ProtocolDescription { // By now we're sure that all of the arguments are correct. So create // the connector. - return Ok(ComponentState{ - prompt: Prompt::new(&self.types, &self.heap, definition_id, 0, arguments), - }); + return Ok(Prompt::new(&self.types, &self.heap, definition_id, 0, arguments)); } fn lookup_module_root(&self, module_name: &[u8]) -> Option { @@ -323,8 +321,8 @@ impl ComponentState { Ok(continuation) => match continuation { // TODO: Probably want to remove this translation EC::Stepping => continue, - EC::Inconsistent => return RR::BranchInconsistent, - EC::Terminal => return RR::ComponentTerminated, + EC::BranchInconsistent => return RR::BranchInconsistent, + EC::ComponentTerminated => return RR::ComponentTerminated, EC::SyncBlockStart => return RR::ComponentAtSyncStart, EC::SyncBlockEnd => return RR::BranchAtSyncEnd, EC::NewComponent(definition_id, monomorph_idx, args) => @@ -335,8 +333,7 @@ impl ComponentState { return RR::BranchFork, EC::BlockFires(port_id) => return RR::BranchMissingPortState(port_id), EC::BlockGet(port_id) => return RR::BranchGet(port_id), - EC::Put(port_id, value) => { - let value_group = ValueGroup::from_store(&self.prompt.store, &[value]); + EC::Put(port_id, value_group) => { return RR::BranchPut(port_id, value_group); }, } @@ -362,8 +359,8 @@ impl ComponentState { }, Ok(cont) => match cont { EvalContinuation::Stepping => continue, - EvalContinuation::Inconsistent => return NonsyncBlocker::Inconsistent, - EvalContinuation::Terminal => return NonsyncBlocker::ComponentExit, + EvalContinuation::BranchInconsistent => return NonsyncBlocker::Inconsistent, + EvalContinuation::ComponentTerminated => return NonsyncBlocker::ComponentExit, EvalContinuation::SyncBlockStart => return NonsyncBlocker::SyncBlockStart, // Not possible to end sync block if never entered one EvalContinuation::SyncBlockEnd => unreachable!(), @@ -427,9 +424,9 @@ impl ComponentState { }, Ok(cont) => match cont { EvalContinuation::Stepping => continue, - EvalContinuation::Inconsistent => return SyncBlocker::Inconsistent, + EvalContinuation::BranchInconsistent => return SyncBlocker::Inconsistent, // First need to exit synchronous block before definition may end - EvalContinuation::Terminal => unreachable!(), + EvalContinuation::ComponentTerminated => unreachable!(), // No nested synchronous blocks EvalContinuation::SyncBlockStart => unreachable!(), EvalContinuation::SyncBlockEnd => return SyncBlocker::SyncBlockEnd, @@ -445,13 +442,15 @@ impl ComponentState { }, EvalContinuation::Put(port, message) => { let payload; - match message { + + // Extract bytes from `put` + match &message.values[0] { Value::Null => { return SyncBlocker::Inconsistent; }, Value::Message(heap_pos) => { // Create a copy of the payload - let values = &self.prompt.store.heap_regions[heap_pos as usize].values; + let values = &message.regions[*heap_pos as usize]; let mut bytes = Vec::with_capacity(values.len()); for value in values { bytes.push(value.as_uint8());