Draft: Interpreter, Tests, Debug Info, Misc.
Bit of a mess, lots of TODOs, in the process of cleaning up. Will have distinct changes in separate branches in the future.
Interpreter:
- Added interpreter under
hercules_test/hercules_interpreter
, covering most basic functionality. - Missing products / sum types, floating point semantics, but framework is there to add them.
Testing:
- Added test of optimization passes via execution w/ interpreter before and after optimization.
Misc / Debug Info:
-
Experimented with different ways of propagating debug info / partitions between passes. All passes should report a list of changes they made, not including gravestone updates. Possibly add default mapping if a pass doesn't want to compute its changes. Current system is quite messy still (comments, code, files).
-
Moved Function type to
function.rs
Merge request reports
Activity
requested review from @rarbore2
assigned to @xrouth2
- hercules_ir/src/function.rs 0 → 100644
42 * 1) Remapping old node IDs to new node IDs (GravestoneUpdateable) 43 * 2) 44 * 45 * */ 46 47 // TODO (@xrouth), consider making this an enum with GravestoneUpdate and OptimizationUpdate as variants, 48 // to handle the common case of 'GravestoneUpdates' more efficiently. 49 50 // If a pass wants to attach new / modify old auxillary information, (such as describing where created nodes came from) 51 // then just give it to them at let them do what they want with the datastructure, dont' stupport 52 // doing it through these maps. 53 #[derive(Debug)] 54 pub enum FunctionChanges { 55 GravestoneUpdates(Vec<NodeID>), // Old NodeID -> New NodeID Map 56 _OptimizationUpdates(HashMap<NodeID, HashSet<NodeID>>), // Old NodeID -> New NodeID map) 57 OptimizationUpdates(HashSet<(NodeID, NodeID)>) // All mappings that aren't the identity. - Resolved by Xavier Routh
- Resolved by Xavier Routh
97 97 // For each control node, ascend dominator tree, looking for fork nodes. For 98 98 // each fork node, make sure each control node isn't strictly dominated by 99 99 // the corresponding join node. 100 (0..function.nodes.len()) 101 .map(NodeID::new) 100 function.node_ids() 101 .into_iter() 837 744 } 838 745 } 839 746 747 // TODO (@xrouth): Make this better. 748 pub fn value(&self, dyn_const_params: &[usize]) -> usize { Is this interpreting a dynamic constant given all of the DC parameters? Maybe move this to hercules_interpreter?Actually, on second thought we may want to hot-cold split functions based on assumed DC params. This function could probably use a renaming though.Edited by rarbore2
9 use std::collections::VecDeque; 10 use std::collections::{HashMap, HashSet}; 11 use std::convert::TryInto; 12 use std::panic; 13 14 use value::*; 15 16 extern crate hercules_ir; 17 extern crate hercules_opt; 18 19 use self::hercules_ir::*; 20 use self::hercules_opt::*; 21 22 /* High level design details / discussion for this: 23 * 24 * This module includes tools for itnerepreteing. Execution model / flow is based on - Resolved by Xavier Routh
- Resolved by Xavier Routh
- Resolved by Xavier Routh
- Resolved by Xavier Routh
- Resolved by Xavier Routh
- Resolved by Xavier Routh
505 if indices.len() == 1 { 506 val 507 } else { 508 self.handle_read(token, val, &indices[1..]) 509 } 510 } 511 512 pub fn run(&mut self) -> InterpreterVal { 513 let start_node: NodeID = NodeID::new( 514 self.get_function() 515 .nodes 516 .iter() 517 .find_position(|node| node.is_start()) 518 .expect("PANIC: no start node") 519 .0, 520 ); - Resolved by Xavier Routh