Skip to content

Commit 06c06e9

Browse files
committed
Recalculate cached limits
When splitting bundles, we need the ability to recalculate the cached limit.
1 parent ddeb787 commit 06c06e9

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/ion/merge.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,28 @@ impl<'a, F: Function> Env<'a, F> {
391391
total
392392
}
393393

394+
pub fn compute_bundle_limit(&self, bundle: LiveBundleIndex) -> Option<usize> {
395+
let mut limit: Option<usize> = None;
396+
for entry in &self.bundles[bundle].ranges {
397+
for u in &self.ranges[entry.index].uses {
398+
use OperandConstraint::*;
399+
match u.operand.constraint() {
400+
Limit(current) => match limit {
401+
Some(prev) => limit = Some(prev.min(current)),
402+
None => limit = Some(current),
403+
},
404+
FixedReg(_) | Stack => {
405+
break;
406+
}
407+
Any | Reg | Reuse(_) => {
408+
continue;
409+
}
410+
}
411+
}
412+
}
413+
limit
414+
}
415+
394416
pub fn queue_bundles(&mut self) {
395417
for bundle in 0..self.bundles.len() {
396418
trace!("enqueueing bundle{}", bundle);

src/ion/process.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ impl<'a, F: Function> Env<'a, F> {
274274
let first_range_data = &self.ctx.ranges[first_range];
275275

276276
self.ctx.bundles[bundle].prio = self.compute_bundle_prio(bundle);
277+
self.ctx.bundles[bundle].limit = self.compute_bundle_limit(bundle);
277278

278279
if first_range_data.vreg.is_invalid() {
279280
trace!(" -> no vreg; minimal and fixed");

0 commit comments

Comments
 (0)