| 4359 | |
| 4360 | template<class VIC> |
| 4361 | forceinline void |
| 4362 | VarImp<VIC>::resize(Space& home) { |
| 4363 | if (b.base == nullptr) { |
| 4364 | assert((free_and_bits >> free_bits) == 0); |
| 4365 | // Create fresh dependency array with four entries |
| 4366 | free_and_bits += 4 << free_bits; |
| 4367 | b.base = home.alloc<ActorLink*>(4); |
| 4368 | for (int i=0; i<pc_max+1; i++) |
| 4369 | u.idx[i] = 0; |
| 4370 | } else { |
| 4371 | // Resize dependency array |
| 4372 | unsigned int n = degree(); |
| 4373 | // Find out whether the area is most likely in the special area |
| 4374 | // reserved for subscriptions. If yes, just resize mildly otherwise |
| 4375 | // more aggressively |
| 4376 | ActorLink** s = static_cast<ActorLink**>(home.mm.subscriptions()); |
| 4377 | unsigned int m = |
| 4378 | ((s <= b.base) && (b.base < s+home.pc.p.n_sub)) ? |
| 4379 | (n+4) : ((n+1)*3>>1); |
| 4380 | ActorLink** prop = home.alloc<ActorLink*>(m); |
| 4381 | free_and_bits += (m-n) << free_bits; |
| 4382 | // Copy entries |
| 4383 | Heap::copy<ActorLink*>(prop, b.base, n); |
| 4384 | home.free<ActorLink*>(b.base,n); |
| 4385 | b.base = prop; |
| 4386 | } |
| 4387 | } |
| 4388 | |
| 4389 | template<class VIC> |
| 4390 | forceinline void |
no test coverage detected