Check the limits on the number of entities.
(&self)
| 137 | |
| 138 | /// Check the limits on the number of entities. |
| 139 | fn check_limits(&self) -> Result<()> { |
| 140 | ensure!( |
| 141 | self.func.num_values() <= MAX_VALUES, |
| 142 | "Too many values: {} (max: {MAX_VALUES})", |
| 143 | self.func.num_values(), |
| 144 | ); |
| 145 | ensure!( |
| 146 | self.func.num_blocks() <= MAX_BLOCKS, |
| 147 | "Too many blocks: {} (max: {MAX_BLOCKS})", |
| 148 | self.func.num_blocks(), |
| 149 | ); |
| 150 | ensure!( |
| 151 | self.func.num_insts() <= MAX_INSTS, |
| 152 | "Too many instructions: {} (max: {MAX_INSTS})", |
| 153 | self.func.num_insts(), |
| 154 | ); |
| 155 | Ok(()) |
| 156 | } |
| 157 | |
| 158 | /// Record the definition of a value and check for duplicate definitions. |
| 159 | fn check_value_def(&mut self, value: Value, def: ValueDef) -> Result<()> { |