(&mut self, specialize: impl FnOnce(&mut Self, usize, usize))
| 8070 | /// Adaptive counter: trigger specialization at zero, otherwise advance countdown. |
| 8071 | #[inline] |
| 8072 | fn adaptive(&mut self, specialize: impl FnOnce(&mut Self, usize, usize)) { |
| 8073 | let instr_idx = self.lasti() as usize - 1; |
| 8074 | let cache_base = instr_idx + 1; |
| 8075 | let counter = self.code.instructions.read_adaptive_counter(cache_base); |
| 8076 | if bytecode::adaptive_counter_triggers(counter) { |
| 8077 | specialize(self, instr_idx, cache_base); |
| 8078 | } else { |
| 8079 | unsafe { |
| 8080 | self.code.instructions.write_adaptive_counter( |
| 8081 | cache_base, |
| 8082 | bytecode::advance_adaptive_counter(counter), |
| 8083 | ); |
| 8084 | } |
| 8085 | } |
| 8086 | } |
| 8087 | |
| 8088 | /// Install a specialized opcode and set adaptive cooldown bits. |
| 8089 | #[inline] |
no test coverage detected