• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ propagateall函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中propagateall函数的典型用法代码示例。如果您正苦于以下问题:C++ propagateall函数的具体用法?C++ propagateall怎么用?C++ propagateall使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了propagateall函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: atomic

static void atomic (lua_State *L) {
  global_State *g = G(L);
  size_t udsize;  /* total size of userdata to be finalized */
  /* remark occasional upvalues of (maybe) dead threads */
  remarkupvals(g);
  /* traverse objects cautch by write barrier and by 'remarkupvals' */
  propagateall(g);
  /* remark weak tables */
  g->gray = g->weak;
  g->weak = NULL;
  lua_assert(!iswhite(obj2gco(g->mainthread)));
  markobject(g, L);  /* mark running thread */
  markmt(g);  /* mark basic metatables (again) */
  propagateall(g);
  /* remark gray again */
  g->gray = g->grayagain;
  g->grayagain = NULL;
  propagateall(g);
  udsize = luaC_separateudata(L, 0);  /* separate userdata to be finalized */
  marktmu(g);  /* mark `preserved' userdata */
  udsize += propagateall(g);  /* remark, to propagate `preserveness' */
  cleartable(g->weak);  /* remove collected objects from weak tables */
  /* flip current white */
  g->currentwhite = cast_byte(otherwhite(g));
  g->sweepstrgc = 0;
  g->sweepgc = &g->rootgc;
  g->gcstate = GCSsweepstring;
  g->estimate = g->totalbytes - udsize;  /* first estimate */
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:29,代码来源:lgc.c


示例2: atomic

static void atomic (lua_State *L) {
  global_State *g = G(L);
  GCObject *origweak, *origall;
  lua_assert(!iswhite(obj2gco(g->mainthread)));
  markobject(g, L);  /* mark running thread */
  /* registry and global metatables may be changed by API */
  markvalue(g, &g->l_registry);
  markmt(g);  /* mark basic metatables */
  /* remark occasional upvalues of (maybe) dead threads */
  remarkupvals(g);
  /* traverse objects caught by write barrier and by 'remarkupvals' */
  retraversegrays(g);
  convergeephemerons(g);
  /* at this point, all strongly accessible objects are marked. */
  /* clear values from weak tables, before checking finalizers */
  clearvalues(g->weak, NULL);
  clearvalues(g->allweak, NULL);
  origweak = g->weak; origall = g->allweak;
  separatetobefnz(L, 0);  /* separate objects to be finalized */
  markbeingfnz(g);  /* mark userdata that will be finalized */
  propagateall(g);  /* remark, to propagate `preserveness' */
  convergeephemerons(g);
  /* at this point, all resurrected objects are marked. */
  /* remove dead objects from weak tables */
  clearkeys(g->ephemeron, NULL);  /* clear keys from all ephemeron tables */
  clearkeys(g->allweak, NULL);  /* clear keys from all allweak tables */
  /* clear values from resurrected weak tables */
  clearvalues(g->weak, origweak);
  clearvalues(g->allweak, origall);
  g->sweepstrgc = 0;  /* prepare to sweep strings */
  g->gcstate = GCSsweepstring;
  g->currentwhite = cast_byte(otherwhite(g));  /* flip current white */
  /*lua_checkmemory(L);*/
}
开发者ID:alucard-dracula,项目名称:yggdrasil,代码行数:34,代码来源:lgc.c


示例3: atomic

static l_mem atomic (lua_State *L) {
    global_State *g = G(L);
    l_mem work;
    GCObject *origweak, *origall;
    GCObject *grayagain = g->grayagain;  /* save original list */
    lua_assert(g->ephemeron == NULL && g->weak == NULL);
    lua_assert(!iswhite(g->mainthread));
    g->gcstate = GCSinsideatomic;
    g->GCmemtrav = 0;  /* start counting work */
    markobject(g, L);  /* mark running thread */
    /* registry and global metatables may be changed by API */
    markvalue(g, &g->l_registry);
    markmt(g);  /* mark global metatables */
    /* remark occasional upvalues of (maybe) dead threads */
    remarkupvals(g);
    propagateall(g);  /* propagate changes */
    work = g->GCmemtrav;  /* stop counting (do not recount 'grayagain') */
    g->gray = grayagain;
    propagateall(g);  /* traverse 'grayagain' list */
    g->GCmemtrav = 0;  /* restart counting */
    convergeephemerons(g);
    /* at this point, all strongly accessible objects are marked. */
    /* Clear values from weak tables, before checking finalizers */
    clearvalues(g, g->weak, NULL);
    clearvalues(g, g->allweak, NULL);
    origweak = g->weak;
    origall = g->allweak;
    work += g->GCmemtrav;  /* stop counting (objects being finalized) */
    separatetobefnz(g, 0);  /* separate objects to be finalized */
    g->gcfinnum = 1;  /* there may be objects to be finalized */
    markbeingfnz(g);  /* mark objects that will be finalized */
    propagateall(g);  /* remark, to propagate 'resurrection' */
    g->GCmemtrav = 0;  /* restart counting */
    convergeephemerons(g);
    /* at this point, all resurrected objects are marked. */
    /* remove dead objects from weak tables */
    clearkeys(g, g->ephemeron, NULL);  /* clear keys from all ephemeron tables */
    clearkeys(g, g->allweak, NULL);  /* clear keys from all 'allweak' tables */
    /* clear values from resurrected weak tables */
    clearvalues(g, g->weak, origweak);
    clearvalues(g, g->allweak, origall);
    luaS_clearcache(g);
    g->currentwhite = cast_byte(otherwhite(g));  /* flip current white */
    work += g->GCmemtrav;  /* complete counting */
    return work;  /* estimate of memory marked by 'atomic' */
}
开发者ID:scw000000,项目名称:Engine,代码行数:46,代码来源:lgc.c


示例4: singlestep

static lu_mem singlestep (lua_State *L) {
    global_State *g = G(L);
    switch (g->gcstate) {
    case GCSpause: {
        g->GCmemtrav = g->strt.size * sizeof(GCObject*);
        restartcollection(g);
        g->gcstate = GCSpropagate;
        return g->GCmemtrav;
    }
    case GCSpropagate: {
        g->GCmemtrav = 0;
        lua_assert(g->gray);
        propagatemark(g);
        if (g->gray == NULL)  /* no more gray objects? */
            g->gcstate = GCSatomic;  /* finish propagate phase */
        return g->GCmemtrav;  /* memory traversed in this step */
    }
    case GCSatomic: {
        lu_mem work;
        int sw;
        propagateall(g);  /* make sure gray list is empty */
        work = atomic(L);  /* work is what was traversed by 'atomic' */
        sw = entersweep(L);
        g->GCestimate = gettotalbytes(g);  /* first estimate */;
        return work + sw * GCSWEEPCOST;
    }
    case GCSswpallgc: {  /* sweep "regular" objects */
        return sweepstep(L, g, GCSswpfinobj, &g->finobj);
    }
    case GCSswpfinobj: {  /* sweep objects with finalizers */
        return sweepstep(L, g, GCSswptobefnz, &g->tobefnz);
    }
    case GCSswptobefnz: {  /* sweep objects to be finalized */
        return sweepstep(L, g, GCSswpend, NULL);
    }
    case GCSswpend: {  /* finish sweeps */
        makewhite(g, g->mainthread);  /* sweep main thread */
        checkSizes(L, g);
        g->gcstate = GCScallfin;
        return 0;
    }
    case GCScallfin: {  /* call remaining finalizers */
        if (g->tobefnz && g->gckind != KGC_EMERGENCY) {
            int n = runafewfinalizers(L);
            return (n * GCFINALIZECOST);
        }
        else {  /* emergency mode or no more finalizers */
            g->gcstate = GCSpause;  /* finish collection */
            return 0;
        }
    }
    default:
        lua_assert(0);
        return 0;
    }
}
开发者ID:scw000000,项目名称:Engine,代码行数:56,代码来源:lgc.c


示例5: retraversegrays

/*
** retraverse all gray lists. Because tables may be reinserted in other
** lists when traversed, traverse the original lists to avoid traversing
** twice the same table (which is not wrong, but inefficient)
*/
static void retraversegrays (global_State *g) {
	GCObject *weak = g->weak;  /* save original lists */
	GCObject *grayagain = g->grayagain;
	GCObject *ephemeron = g->ephemeron;
	g->weak = g->grayagain = g->ephemeron = NULL;
	propagateall(g);  /* traverse main gray list */
	propagatelist(g, grayagain);
	propagatelist(g, weak);
	propagatelist(g, ephemeron);
}
开发者ID:crazii,项目名称:mameplus,代码行数:15,代码来源:lgc.c


示例6: atomic

static l_mem atomic (lua_State *L) {
	global_State *g = G(L);
	l_mem work = -cast(l_mem, g->GCmemtrav);  /* start counting work */
	GCObject *origweak, *origall;
	lua_assert(!iswhite(obj2gco(g->mainthread)));
	markobject(g, L);  /* mark running thread */
	/* registry and global metatables may be changed by API */
	markvalue(g, &g->l_registry);
	markmt(g);  /* mark basic metatables */
	/* remark occasional upvalues of (maybe) dead threads */
	remarkupvals(g);
	propagateall(g);  /* propagate changes */
	work += g->GCmemtrav;  /* stop counting (do not (re)count grays) */
	/* traverse objects caught by write barrier and by 'remarkupvals' */
	retraversegrays(g);
	work -= g->GCmemtrav;  /* restart counting */
	convergeephemerons(g);
	/* at this point, all strongly accessible objects are marked. */
	/* clear values from weak tables, before checking finalizers */
	clearvalues(g, g->weak, NULL);
	clearvalues(g, g->allweak, NULL);
	origweak = g->weak; origall = g->allweak;
	work += g->GCmemtrav;  /* stop counting (objects being finalized) */
	separatetobefnz(L, 0);  /* separate objects to be finalized */
	markbeingfnz(g);  /* mark objects that will be finalized */
	propagateall(g);  /* remark, to propagate `preserveness' */
	work -= g->GCmemtrav;  /* restart counting */
	convergeephemerons(g);
	/* at this point, all resurrected objects are marked. */
	/* remove dead objects from weak tables */
	clearkeys(g, g->ephemeron, NULL);  /* clear keys from all ephemeron tables */
	clearkeys(g, g->allweak, NULL);  /* clear keys from all allweak tables */
	/* clear values from resurrected weak tables */
	clearvalues(g, g->weak, origweak);
	clearvalues(g, g->allweak, origall);
	g->currentwhite = cast_byte(otherwhite(g));  /* flip current white */
	work += g->GCmemtrav;  /* complete counting */
	return work;  /* estimate of memory marked by 'atomic' */
}
开发者ID:crazii,项目名称:mameplus,代码行数:39,代码来源:lgc.c


示例7: convergeephemerons

static void convergeephemerons (global_State *g) {
  int changed;
  do {
    GCObject *w;
    GCObject *next = g->ephemeron;  /* get ephemeron list */
    g->ephemeron = NULL;  /* tables may return to this list when traversed */
    changed = 0;
    while ((w = next) != NULL) {
      next = gco2t(w)->gclist;
      if (traverseephemeron(g, gco2t(w))) {  /* traverse marked some value? */
        propagateall(g);  /* propagate changes */
        changed = 1;  /* will have to revisit all ephemeron tables */
      }
    }
  } while (changed);
}
开发者ID:charleeli,项目名称:srpc,代码行数:16,代码来源:lgc.c


示例8: propagatelist

static void propagatelist (global_State *g, GCObject *l) {
	lua_assert(g->gray == NULL);  /* no grays left */
	g->gray = l;
	propagateall(g);  /* traverse all elements from 'l' */
}
开发者ID:crazii,项目名称:mameplus,代码行数:5,代码来源:lgc.c



注:本文中的propagateall函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ propagatemark函数代码示例发布时间:2022-05-30
下一篇:
C++ prop_unsubscribe函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap