当前位置: 首页>>代码示例>>C#>>正文


C# GCObject类代码示例

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


GCObject类属于命名空间,在下文中一共展示了GCObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: luaS_resize

		public static void luaS_resize (lua_State L, int newsize) {
		  GCObject[] newhash;
		  stringtable tb;
		  int i;
		  if (G(L).gcstate == GCSsweepstring)
			return;  /* cannot resize during GC traverse */		  
		  newhash = new GCObject[newsize];
		  AddTotalBytes(L, newsize * GetUnmanagedSize(typeof(GCObjectRef)));
		  tb = G(L).strt;
		  for (i=0; i<newsize; i++) newhash[i] = null;

		  /* rehash */
		  for (i=0; i<tb.size; i++) {
			GCObject p = tb.hash[i];
			while (p != null) {  /* for each node in the list */
			  GCObject next = p.gch.next;  /* save next */
			  uint h = gco2ts(p).hash;
			  int h1 = (int)lmod(h, newsize);  /* new position */
			  lua_assert((int)(h%newsize) == lmod(h, newsize));
			  p.gch.next = newhash[h1];  /* chain it */
			  newhash[h1] = p;
			  p = next;
			}
		  }
		  //luaM_freearray(L, tb.hash);
		  if (tb.hash != null)
			  SubtractTotalBytes(L, tb.hash.Length * GetUnmanagedSize(typeof(GCObjectRef)));
		  tb.size = newsize;
		  tb.hash = newhash;
		}
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:30,代码来源:lstring.cs

示例2: IsWhite

 public static bool IsWhite(GCObject x)
 {
     return Test2Bits(x.gch.marked, WHITE0BIT, WHITE1BIT);
 }
开发者ID:NLua,项目名称:KopiLua,代码行数:4,代码来源:lgc.cs

示例3: SetUValue

 internal static void SetUValue(LuaState L, TValue obj, GCObject x)
 {
     obj.value.gc = x;
     obj.tt = LUA_TUSERDATA;
     CheckLiveness(G(L), obj);
 }
开发者ID:prabirshrestha,项目名称:KopiLua,代码行数:6,代码来源:lobject.cs

示例4: SetSValue

		internal static void SetSValue(LuaState L, Lua.LuaTypeValue obj, GCObject x) {
			obj.value.gc = x;
			obj.tt = LUA_TSTRING;
			CheckLiveness(G(L), obj);
		}
开发者ID:oathx,项目名称:Six,代码行数:5,代码来源:lobject.cs

示例5: setthvalue

 internal static void setthvalue(lua_State L, TValue obj, GCObject x)
 {
     obj.value.gc = x;
     obj.tt = LUA_TTHREAD;
     checkliveness(G(L), obj);
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:6,代码来源:lobject.cs

示例6: black2gray

 public static void black2gray(GCObject x)
 {
     resetbit(ref x.gch.marked, BLACKBIT);
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:4,代码来源:lgc.cs

示例7: freeobj

 private static void freeobj(lua_State L, GCObject o)
 {
     switch (o.gch.tt) {
     case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break;
     case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break;
     case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break;
     case LUA_TTABLE: luaH_free(L, gco2h(o)); break;
     case LUA_TTHREAD: {
       lua_assert(gco2th(o) != L && gco2th(o) != G(L).mainthread);
       luaE_freethread(L, gco2th(o));
       break;
     }
     case LUA_TSTRING: {
       G(L).strt.nuse--;
       SubtractTotalBytes(L, sizestring(gco2ts(o)));
       luaM_freemem(L, gco2ts(o));
       break;
     }
     case LUA_TUSERDATA: {
       SubtractTotalBytes(L, sizeudata(gco2u(o)));
       luaM_freemem(L, gco2u(o));
       break;
     }
     default: lua_assert(0); break;
       }
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:26,代码来源:lgc.cs

示例8: white2gray

 public static void white2gray(GCObject x)
 {
     reset2bits(ref x.gch.marked, WHITE0BIT, WHITE1BIT);
 }
开发者ID:raymanyu,项目名称:kopilua,代码行数:4,代码来源:lgc.cs

示例9: ReallyMarkObject

 private static void ReallyMarkObject(GlobalState g, GCObject o)
 {
     LuaAssert(IsWhite(o) && !IsDead(g, o));
       White2Gray(o);
       switch (o.gch.tt) {
     case LUA_TSTRING: {
       return;
     }
     case LUA_TUSERDATA: {
       Table mt = gco2u(o).metatable;
       Gray2Black(o);  /* udata are never gray */
       if (mt != null) MarkObject(g, mt);
       MarkObject(g, gco2u(o).env);
       return;
     }
     case LUATUPVAL: {
       UpVal uv = gco2uv(o);
       MarkValue(g, uv.v);
       if (uv.v == uv.u.value)  /* closed? */
         Gray2Black(o);  /* open upvalues are never black */
       return;
     }
     case LUA_TFUNCTION: {
       gco2cl(o).c.gclist = g.gray;
       g.gray = o;
       break;
     }
     case LUA_TTABLE: {
       gco2h(o).gclist = g.gray;
       g.gray = o;
       break;
     }
     case LUA_TTHREAD: {
       gco2th(o).gclist = g.gray;
       g.gray = o;
       break;
     }
     case LUATPROTO: {
       gco2p(o).gclist = g.gray;
       g.gray = o;
       break;
     }
     default: LuaAssert(0); break;
       }
 }
开发者ID:NLua,项目名称:KopiLua,代码行数:45,代码来源:lgc.cs

示例10: FreeObj

 private static void FreeObj(LuaState L, GCObject o)
 {
     switch (o.gch.tt) {
     case LUATPROTO: LuaFFreeProto(L, gco2p(o)); break;
     case LUA_TFUNCTION: LuaFFreeClosure(L, gco2cl(o)); break;
     case LUATUPVAL: LuaFreeUpVal(L, gco2uv(o)); break;
     case LUA_TTABLE: luaH_free(L, gco2h(o)); break;
     case LUA_TTHREAD: {
       LuaAssert(gco2th(o) != L && gco2th(o) != G(L).mainthread);
       luaE_freethread(L, gco2th(o));
       break;
     }
     case LUA_TSTRING: {
       G(L).strt.nuse--;
       SubtractTotalBytes(L, sizestring(gco2ts(o)));
       LuaMFreeMem(L, gco2ts(o));
       break;
     }
     case LUA_TUSERDATA: {
       SubtractTotalBytes(L, sizeudata(gco2u(o)));
       LuaMFreeMem(L, gco2u(o));
       break;
     }
     default: LuaAssert(0); break;
       }
 }
开发者ID:NLua,项目名称:KopiLua,代码行数:26,代码来源:lgc.cs

示例11: ClearTable

 /*
 ** clear collected entries from weaktables
 */
 private static void ClearTable(GCObject l)
 {
     while (l != null) {
     Table h = gco2h(l);
     int i = h.sizearray;
     LuaAssert(TestBit(h.marked, VALUEWEAKBIT) ||
                TestBit(h.marked, KEYWEAKBIT));
     if (TestBit(h.marked, VALUEWEAKBIT)) {
       while (i--!= 0) {
         TValue o = h.array[i];
         if (IsCleared(o, false))  /* value was collected? */
           SetNilValue(o);  /* remove value */
       }
     }
     i = SizeNode(h);
     while (i-- != 0) {
       Node n = gnode(h, i);
       if (!TTIsNil(gval(n)) &&  /* non-empty entry? */
           (IsCleared(key2tval(n), true) || IsCleared(gval(n), false))) {
         SetNilValue(gval(n));  /* remove value ... */
         RemoveEntry(n);  /* remove entry from Table */
       }
     }
     l = h.gclist;
       }
 }
开发者ID:NLua,项目名称:KopiLua,代码行数:29,代码来源:lgc.cs

示例12: White2Gray

 public static void White2Gray(GCObject x)
 {
     Reset2Bits(ref x.gch.marked, WHITE0BIT, WHITE1BIT);
 }
开发者ID:NLua,项目名称:KopiLua,代码行数:4,代码来源:lgc.cs

示例13: MakeWhite

 public static void MakeWhite(GlobalState g, GCObject x)
 {
     x.gch.marked = (byte)(x.gch.marked & maskmarks | LuaCWhite(g));
 }
开发者ID:NLua,项目名称:KopiLua,代码行数:4,代码来源:lgc.cs

示例14: LuaCLink

 public static void LuaCLink(LuaState L, GCObject o, LuaByteType tt)
 {
     GlobalState g = G(L);
       o.gch.next = g.rootgc;
       g.rootgc = o;
       o.gch.marked = LuaCWhite(g);
       o.gch.tt = tt;
 }
开发者ID:NLua,项目名称:KopiLua,代码行数:8,代码来源:lgc.cs

示例15: LuaCBarrierF

 public static void LuaCBarrierF(LuaState L, GCObject o, GCObject v)
 {
     GlobalState g = G(L);
       LuaAssert(IsBlack(o) && IsWhite(v) && !IsDead(g, v) && !IsDead(g, o));
       LuaAssert(g.gcstate != GCSfinalize && g.gcstate != GCSpause);
       LuaAssert(TType(o.gch) != LUA_TTABLE);
       /* must keep invariant? */
       if (g.gcstate == GCSpropagate)
     ReallyMarkObject(g, v);  /* restore invariant */
       else  /* don't mind */
     MakeWhite(g, o);  /* mark as white just to avoid other barriers */
 }
开发者ID:NLua,项目名称:KopiLua,代码行数:12,代码来源:lgc.cs


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