Exemplo n.º 1
0
Arquivo: gc.c Projeto: cyisfor/ponyc
static void recv_local_object(pony_ctx_t* ctx, void* p, pony_trace_fn f,
  bool immutable)
{
  // get the object
  gc_t* gc = ponyint_actor_gc(ctx->current);
  object_t* obj = ponyint_objectmap_getobject(&gc->local, p);
  assert(obj != NULL);

  if(obj->mark == gc->mark)
    return;

  // Implicitly receive the owner.
  recv_local_actor(gc);

  // Dec, mark and recurse. Mark as reachable from the actor, since a
  // release message for this object could arrive before a gc pass.
  obj->rc--;
  obj->mark = gc->mark;
  obj->reachable = true;

  if(immutable)
    obj->immutable = true;

  if(!obj->immutable)
    recurse(ctx, p, f);
}
Exemplo n.º 2
0
static void recv_local_object(pony_ctx_t* ctx, void* p, pony_type_t* t,
  int mutability)
{
  // get the object
  size_t index = HASHMAP_UNKNOWN;
  gc_t* gc = ponyint_actor_gc(ctx->current);
  object_t* obj = ponyint_objectmap_getobject(&gc->local, p, &index);
  pony_assert(obj != NULL);

  if(obj->mark == gc->mark)
    return;

  // Implicitly receive the owner.
  recv_local_actor(gc);

  // Dec, mark and recurse.
  obj->rc--;
  obj->mark = gc->mark;

  if(mutability == PONY_TRACE_OPAQUE)
    return;

  if(mutability == PONY_TRACE_IMMUTABLE)
    obj->immutable = true;

  if(!obj->immutable)
    recurse(ctx, p, t->trace);
}
Exemplo n.º 3
0
Arquivo: gc.c Projeto: cyisfor/ponyc
void ponyint_gc_recvactor(pony_ctx_t* ctx, pony_actor_t* actor)
{
  gc_t* gc = ponyint_actor_gc(ctx->current);

  if(actor == ctx->current)
  {
    recv_local_actor(gc);
  } else {
    actorref_t* aref = ponyint_actormap_getorput(&gc->foreign, actor, gc->mark);
    recv_remote_actor(ctx, gc, aref);
  }
}