| 721 | bounds.push_back({lb, ub}); |
| 722 | } |
| 723 | void getVirtualBounds(const Mapping *mapping, size_t granularity, |
| 724 | std::vector<Bounds> &bounds) |
| 725 | { |
| 726 | intptr_t lb = INTPTR_MAX, ub = INTPTR_MIN; |
| 727 | const size_t SIZE = mapping->size; |
| 728 | const intptr_t BASE = mapping->base; |
| 729 | const intptr_t END = BASE + SIZE; |
| 730 | auto iend = Allocator::end(); |
| 731 | for (auto i = mapping->i; i != iend; ++i) |
| 732 | { |
| 733 | const Alloc *a = *i; |
| 734 | if (a->lb >= END) |
| 735 | break; |
| 736 | if (a->bytes == nullptr) |
| 737 | { |
| 738 | // Reserved memory. We must split into two separate mappings. |
| 739 | pushBounds(lb, ub, granularity, bounds); |
| 740 | lb = INTPTR_MAX; |
| 741 | ub = INTPTR_MIN; |
| 742 | continue; |
| 743 | } |
| 744 | intptr_t lb1 = (a->lb < BASE? 0: a->lb - BASE); |
| 745 | intptr_t ub1 = (a->ub > END ? END - BASE: a->ub - BASE); |
| 746 | lb = std::min(lb, lb1); |
| 747 | ub = std::max(ub, ub1); |
| 748 | } |
| 749 | pushBounds(lb, ub, granularity, bounds); |
| 750 | } |
| 751 |
no test coverage detected