예제 #1
0
void
popstacklist(bool codegen)
{
  if (codegen)
    modstk_for_scope(sStackScopes.back());
  sStackScopes.pop();
}
예제 #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();
}
예제 #3
0
void
popheaplist(bool codegen)
{
  if (codegen)
    modheap_for_scope(sHeapScopes.back());
  sHeapScopes.pop();
}
예제 #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});
}
예제 #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();
}
예제 #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;
}
예제 #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();
}
예제 #8
0
int
stack_scope_id()
{
  return sStackScopes.back().scope_id;
}
예제 #9
0
int
markstack(int type, int size)
{
  AllocInScope(sStackScopes.back(), type, size);
  return size;
}
예제 #10
0
int
markheap(int type, int size)
{
  AllocInScope(sHeapScopes.back(), type, size);
  return size;
}