Example #1
0
void
popstacklist(bool codegen)
{
  if (codegen)
    modstk_for_scope(sStackScopes.back());
  sStackScopes.pop();
}
Example #2
0
pstruct_t*
pstructs_add(const char *name)
{
  auto p = ke::MakeUnique<pstruct_t>(name);
  sStructs.append(ke::Move(p));
  return sStructs.back().get();
}
Example #3
0
void
popheaplist(bool codegen)
{
  if (codegen)
    modheap_for_scope(sHeapScopes.back());
  sHeapScopes.pop();
}
Example #4
0
static void
EnterMemoryScope(ke::Vector<MemoryScope>& frame)
{
  if (frame.empty())
    frame.append(MemoryScope{0});
  else
    frame.append(MemoryScope{frame.back().scope_id + 1});
}
Example #5
0
funcenum_t *funcenums_add(const char *name)
{
  auto e = ke::MakeUnique<funcenum_t>();

  strcpy(e->name, name);
  e->tag = gTypes.defineFunction(name, e.get())->tagid();

  sFuncEnums.append(ke::Move(e));
  return sFuncEnums.back().get();
}
Example #6
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;
}
Example #7
0
methodmap_t*
methodmap_add(methodmap_t* parent, LayoutSpec spec, const char* name)
{
  auto map = ke::MakeUnique<methodmap_t>(parent, spec, name);

  if (spec == Layout_MethodMap && parent) {
    if (parent->nullable)
      map->nullable = parent->nullable;
    if (parent->keyword_nullable)
      map->keyword_nullable = parent->keyword_nullable;
  }

  if (spec == Layout_MethodMap)
    map->tag = gTypes.defineMethodmap(name, map.get())->tagid();
  else
    map->tag = gTypes.defineObject(name)->tagid();
  sMethodmaps.append(ke::Move(map));

  return sMethodmaps.back().get();
}
Example #8
0
int
stack_scope_id()
{
  return sStackScopes.back().scope_id;
}
Example #9
0
int
markstack(int type, int size)
{
  AllocInScope(sStackScopes.back(), type, size);
  return size;
}
Example #10
0
int
markheap(int type, int size)
{
  AllocInScope(sHeapScopes.back(), type, size);
  return size;
}