static GCHeapObj() { NullObj = new GCHeapObj() { Addr = 0 }; }
public GCHeapObj AllocObj(TypeObject typeObject) { GCHeapObj heapObj = new GCHeapObj() { Addr = _nxtfreeSlt, TypeToken = typeObject.Token, Val = null }; _htable.Add(_nxtfreeSlt, heapObj); Interlocked.Increment(ref _nxtfreeSlt); return(heapObj); }
//public GCHeapObj AllocObjType() //{ // return AllocObj(null); //} public GCHeapObj GetObj(Int32 addr) { GCHeapObj obj = null; lock (htableLocker) { if (_htable.ContainsKey(addr)) { obj = _htable[addr]; } if (obj != null && !obj.IsGCollected) { return(obj); } else { return(GCHeapObj.NullObj); } } }