Ejemplo n.º 1
0
void
popheaplist(bool codegen)
{
  if (codegen)
    modheap_for_scope(sHeapScopes.back());
  sHeapScopes.pop();
}
Ejemplo n.º 2
0
void
popstacklist(bool codegen)
{
  if (codegen)
    modstk_for_scope(sStackScopes.back());
  sStackScopes.pop();
}
Ejemplo n.º 3
0
// Sums up array usage in the current heap tracer and convert it into a dynamic array.
// This is used for the ternary operator, which needs to convert its array usage into
// something dynamically managed.
// !Note:
// This might break if expressions can ever return dynamic arrays.
// Thus, we assert() if something is non-static here.
// Right now, this poses no problem because this type of expression is impossible:
//   (a() ? return_array() : return_array()) ? return_array() : return_array()
cell_t
pop_static_heaplist()
{
  cell_t total = 0;
  for (const auto& use : sHeapScopes.back().usage) {
    assert(use.type == MEMUSE_STATIC);
    total += use.size;
  }
  sHeapScopes.pop();
  return total;
}