void gc_sendactor(pony_actor_t* current, heap_t* heap, gc_t* gc, pony_actor_t* actor) { (void)heap; if(actor == current) { current_actor_inc(gc); } else { actorref_t* aref = actormap_getorput(&gc->foreign, actor, gc->mark); if(!actorref_marked(aref, gc->mark)) { // dec. if we can't, we need to build an acquire message if(!actorref_dec(aref)) { actorref_inc_more(aref); acquire_actor(actor); } actorref_mark(aref, gc->mark); gc->delta = deltamap_update(gc->delta, actorref_actor(aref), actorref_rc(aref)); } } }
static void mark_remote_actor(pony_ctx_t* ctx, gc_t* gc, actorref_t* aref) { if(aref->mark == gc->mark) return; aref->mark = gc->mark; if(aref->rc == 0) { // Invent some references to this actor and acquire it. aref->rc += GC_INC_MORE; acquire_actor(ctx, aref->actor); gc->delta = ponyint_deltamap_update(gc->delta, aref->actor, aref->rc); } }
static void send_remote_actor(pony_ctx_t* ctx, gc_t* gc, actorref_t* aref) { if(aref->mark == gc->mark) return; aref->mark = gc->mark; // Dec. If we can't, add to the acquire message. if(aref->rc <= 1) { aref->rc += (GC_INC_MORE - 1); acquire_actor(ctx, aref->actor); } else { aref->rc--; } gc->delta = ponyint_deltamap_update(gc->delta, aref->actor, aref->rc); }
static void mark_remote_actor(pony_ctx_t* ctx, gc_t* gc, actorref_t* aref) { if(aref->mark == gc->mark) return; aref->mark = gc->mark; if(aref->rc == 0) { // If we haven't seen this actor, it's the owner of an immutable object // that is reached from another immutable object we received. Invent // some references to this actor and acquire it. aref->rc += GC_INC_MORE; acquire_actor(ctx, aref->actor); gc->delta = ponyint_deltamap_update(gc->delta, aref->actor, aref->rc); } ponyint_heap_used(ponyint_actor_heap(ctx->current), GC_ACTOR_HEAP_EQUIV); }
void gc_sendobject(pony_actor_t* current, heap_t* heap, gc_t* gc, void* p, pony_trace_fn f) { (void)heap; chunk_t* chunk = (chunk_t*)pagemap_get(p); // don't gc memory that wasn't pony_allocated if(chunk == NULL) return; pony_actor_t* actor = heap_owner(chunk); heap_base(chunk, &p); if(actor == current) { current_actor_inc(gc); // get the object object_t* obj = objectmap_getorput(&gc->local, p, gc->mark); if(!object_marked(obj, gc->mark)) { // inc, mark and recurse object_inc(obj); object_mark(obj, gc->mark); if(f != NULL) { stack = gcstack_push(stack, p); stack = gcstack_push(stack, f); } } } else { // get the actor actorref_t* aref = actormap_getactor(&gc->foreign, actor); // we've reached this by tracing a tag through a union if(aref == NULL) return; // get the object object_t* obj = actorref_getobject(aref, p); // we've reached this by tracing a tag through a union if(obj == NULL) return; if(!actorref_marked(aref, gc->mark)) { // dec. if we can't, we need to build an acquire message if(!actorref_dec(aref)) { actorref_inc_more(aref); acquire_actor(actor); } actorref_mark(aref, gc->mark); gc->delta = deltamap_update(gc->delta, actorref_actor(aref), actorref_rc(aref)); } if(!object_marked(obj, gc->mark)) { // dec. if we can't, we need to build an acquire message if(!object_dec(obj)) { object_inc_more(obj); acquire_object(actor, p); } object_mark(obj, gc->mark); if(f != NULL) { stack = gcstack_push(stack, p); stack = gcstack_push(stack, f); } } } }