(&mut self, ip: usize, opcode: &OpCode, ta: u8, tb: u8)
| 109 | } |
| 110 | |
| 111 | pub fn record(&mut self, ip: usize, opcode: &OpCode, ta: u8, tb: u8) { |
| 112 | let Some(s) = self.slots.get_mut(ip) else { return }; |
| 113 | let key = (ta << 4) | (tb & 0xF); |
| 114 | if s.type_key == key { |
| 115 | s.hits = s.hits.saturating_add(1); |
| 116 | if s.hits >= QUICK_THRESH && s.fast.is_none() { |
| 117 | s.fast = Self::specialize(opcode, ta, tb); |
| 118 | } |
| 119 | } else { |
| 120 | // Preserve `inst`, its lifecycle is independent of scalar specialisation. |
| 121 | s.type_key = key; |
| 122 | s.hits = 1; |
| 123 | s.fast = None; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | #[inline] |
| 128 | pub fn get_fast(&self, ip: usize) -> Option<FastOp> { |
no test coverage detected