changes for hash tables and zone pooling.

This commit is contained in:
davidmc%netscape.com 1999-09-22 05:35:28 +00:00
Родитель 5b25773f0f
Коммит eb00f13df4
69 изменённых файлов: 1201 добавлений и 205 удалений

Просмотреть файл

@ -461,8 +461,8 @@ public:
virtual mdb_err Free(nsIMdbEnv* ev, // free block from Alloc or Resize()
void* ioBlock) = 0; // block to be destroyed/deallocated
virtual mdb_err AddStrongRef(nsIMdbEnv* ev) = 0;
virtual mdb_err CutStrongRef(nsIMdbEnv* ev) = 0;
virtual mdb_err HeapAddStrongRef(nsIMdbEnv* ev) = 0;
virtual mdb_err HeapCutStrongRef(nsIMdbEnv* ev) = 0;
// } ===== end nsIMdbHeap methods =====
};
@ -480,8 +480,8 @@ public:
virtual mdb_err Free(nsIMdbEnv* ev, // free block allocated earlier by Alloc()
void* inBlock);
virtual mdb_err AddStrongRef(nsIMdbEnv* ev);
virtual mdb_err CutStrongRef(nsIMdbEnv* ev);
virtual mdb_err HeapAddStrongRef(nsIMdbEnv* ev);
virtual mdb_err HeapCutStrongRef(nsIMdbEnv* ev);
// } ===== end nsIMdbHeap methods =====
};

Просмотреть файл

@ -81,6 +81,9 @@ CPPSRCS = \
morkThumb.cpp \
morkWriter.cpp \
morkYarn.cpp \
morkBead.cpp \
morkProbeMap.cpp \
morkZone.cpp \
$(NULL)
EXTRA_DSO_LDOPTS = \

Просмотреть файл

@ -88,6 +88,9 @@ CPP_OBJS= .\$(OBJDIR)\orkinCell.obj \
.\$(OBJDIR)\morkThumb.obj \
.\$(OBJDIR)\morkWriter.obj \
.\$(OBJDIR)\morkYarn.obj \
.\$(OBJDIR)\morkZone.cpp.obj \
.\$(OBJDIR)\morkProbeMap.cpp.obj \
.\$(OBJDIR)\morkBead.cpp.obj \
$(NULL)

Просмотреть файл

@ -82,6 +82,9 @@ typedef mork_token mork_aid; // token used to id atomize cell values
typedef mork_token mork_column; // token used to id columns for rows
typedef mork_column mork_delta; // mork_column plus mork_change
typedef mork_token mork_color; // bead ID
#define morkColor_kNone ((mork_color) 0)
typedef mork_u4 mork_magic; // unsigned magic signature
typedef mork_u4 mork_seed; // unsigned collection change counter
@ -106,6 +109,13 @@ typedef mork_u1 mork_able; // on, off, asleep (clone IronDoc's fe_able)
typedef mork_u1 mork_load; // dirty or clean (clone IronDoc's fe_load)
// } %%%%% end specific-size integer scalar typedefs %%%%%
// 'test' is a public domain Mithril for key equality tests in probe maps
typedef mork_i2 mork_test; /* neg=>kVoid, zero=>kHit, pos=>kMiss */
#define morkTest_kVoid ((mork_test) -1) /* -1: nil key slot, no key order */
#define morkTest_kHit ((mork_test) 0) /* 0: keys are equal, a map hit */
#define morkTest_kMiss ((mork_test) 1) /* 1: keys not equal, a map miss */
// { %%%%% begin constants for Mork scalar types %%%%%
#define morkPriority_kHi ((mork_priority) 0) /* best priority */
#define morkPriority_kMin ((mork_priority) 0) /* best priority is smallest */
@ -190,6 +200,7 @@ class morkPool;
class morkPlace;
class morkPort;
class morkPortTableCursor;
class morkProbeMap;
class morkRow;
class morkRowCellCursor;
class morkRowObject;
@ -205,6 +216,7 @@ class morkTableChange;
class morkTableRowCursor;
class morkThumb;
class morkWriter;
class morkZone;
// } %%%%% end class forward defines %%%%%
// include this config file last for platform & environment specific stuff:

Просмотреть файл

@ -219,7 +219,7 @@ morkAtom::GetBookAtomSpaceScope(morkEnv* ev) const // zero or book's space's sco
const morkBookAtom* bookAtom = (const morkBookAtom*) this;
morkAtomSpace* space = bookAtom->mBookAtom_Space;
if ( space->IsAtomSpace() )
outScope = space->mSpace_Scope;
outScope = space->SpaceScope();
else
space->NonAtomSpaceTypeError(ev);
}

Просмотреть файл

@ -213,7 +213,7 @@ class morkBookAtom : public morkAtom { //
// mork_u1 mAtom_Size; // only for atoms smaller than 256 bytes
public:
morkAtomSpace* mBookAtom_Space; // mBookAtom_Space->mSpace_Scope is atom scope
morkAtomSpace* mBookAtom_Space; // mBookAtom_Space->SpaceScope() is atom scope
mork_aid mBookAtom_Id; // identity token for this shared atom
public: // empty construction does nothing
@ -249,7 +249,7 @@ class morkWeeBookAtom : public morkBookAtom { //
// mork_change mAtom_Change; // how has this atom been changed?
// mork_u1 mAtom_Size; // only for atoms smaller than 256 bytes
// morkAtomSpace* mBookAtom_Space; // mBookAtom_Space->mSpace_Scope is scope
// morkAtomSpace* mBookAtom_Space; // mBookAtom_Space->SpaceScope() is scope
// mork_aid mBookAtom_Id; // identity token for this shared atom
public:
@ -280,7 +280,7 @@ class morkBigBookAtom : public morkBookAtom { //
// mork_change mAtom_Change; // how has this atom been changed?
// mork_u1 mAtom_Size; // NOT USED IN "BIG" format atoms
// morkAtomSpace* mBookAtom_Space; // mBookAtom_Space->mSpace_Scope is scope
// morkAtomSpace* mBookAtom_Space; // mBookAtom_Space->SpaceScope() is scope
// mork_aid mBookAtom_Id; // identity token for this shared atom
public:
@ -311,7 +311,7 @@ class morkMaxBookAtom : public morkBigBookAtom { //
// mork_change mAtom_Change; // how has this atom been changed?
// mork_u1 mAtom_Size; // NOT USED IN "BIG" format atoms
// morkAtomSpace* mBookAtom_Space; // mBookAtom_Space->mSpace_Scope is scope
// morkAtomSpace* mBookAtom_Space; // mBookAtom_Space->SpaceScope() is scope
// mork_aid mBookAtom_Id; // identity token for this shared atom
// mork_cscode mBigBookAtom_Form; // charset format encoding

Просмотреть файл

@ -74,13 +74,21 @@ morkAtomAidMap::~morkAtomAidMap() // assert CloseAtomAidMap() executed earlier
MORK_ASSERT(this->IsShutNode());
}
/*public non-poly*/
morkAtomAidMap::morkAtomAidMap(morkEnv* ev, const morkUsage& inUsage,
nsIMdbHeap* ioHeap, nsIMdbHeap* ioSlotHeap)
#ifdef MORK_ENABLE_PROBE_MAPS
: morkProbeMap(ev, inUsage, ioHeap,
/*inKeySize*/ sizeof(morkBookAtom*), /*inValSize*/ 0,
ioSlotHeap, morkAtomAidMap_kStartSlotCount,
/*inZeroIsClearKey*/ morkBool_kTrue)
#else /*MORK_ENABLE_PROBE_MAPS*/
: morkMap(ev, inUsage, ioHeap,
/*inKeySize*/ sizeof(morkBookAtom*), /*inValSize*/ 0,
morkAtomAidMap_kStartSlotCount, ioSlotHeap,
/*inHoldChanges*/ morkBool_kFalse)
#endif /*MORK_ENABLE_PROBE_MAPS*/
{
if ( ev->Good() )
mNode_Derived = morkDerived_kAtomAidMap;
@ -93,7 +101,11 @@ morkAtomAidMap::CloseAtomAidMap(morkEnv* ev) // called by CloseMorkNode();
{
if ( this->IsNode() )
{
#ifdef MORK_ENABLE_PROBE_MAPS
this->CloseProbeMap(ev);
#else /*MORK_ENABLE_PROBE_MAPS*/
this->CloseMap(ev);
#endif /*MORK_ENABLE_PROBE_MAPS*/
this->MarkShut();
}
else
@ -106,23 +118,68 @@ morkAtomAidMap::CloseAtomAidMap(morkEnv* ev) // called by CloseMorkNode();
// } ===== end morkNode methods =====
// ````` ````` ````` ````` `````
// { ===== begin morkMap poly interface =====
/*virtual*/ mork_bool //
morkAtomAidMap::Equal(morkEnv* ev, const void* inKeyA,
#ifdef MORK_ENABLE_PROBE_MAPS
/*virtual*/ mork_test // hit(a,b) implies hash(a) == hash(b)
morkAtomAidMap::MapTest(morkEnv* ev, const void* inMapKey,
const void* inAppKey) const
{
MORK_USED_1(ev);
const morkBookAtom* key = *(const morkBookAtom**) inMapKey;
if ( key )
{
mork_bool hit = key->EqualAid(*(const morkBookAtom**) inAppKey);
return ( hit ) ? morkTest_kHit : morkTest_kMiss;
}
else
return morkTest_kVoid;
}
/*virtual*/ mork_u4 // hit(a,b) implies hash(a) == hash(b)
morkAtomAidMap::MapHash(morkEnv* ev, const void* inAppKey) const
{
const morkBookAtom* key = *(const morkBookAtom**) inAppKey;
if ( key )
return key->HashAid();
else
{
ev->NilPointerWarning();
return 0;
}
}
/*virtual*/ mork_u4
morkAtomAidMap::ProbeMapHashMapKey(morkEnv* ev,
const void* inMapKey) const
{
const morkBookAtom* key = *(const morkBookAtom**) inMapKey;
if ( key )
return key->HashAid();
else
{
ev->NilPointerWarning();
return 0;
}
}
#else /*MORK_ENABLE_PROBE_MAPS*/
// { ===== begin morkMap poly interface =====
/*virtual*/ mork_bool //
morkAtomAidMap::Equal(morkEnv* ev, const void* inKeyA,
const void* inKeyB) const
{
{
MORK_USED_1(ev);
return (*(const morkBookAtom**) inKeyA)->EqualAid(
*(const morkBookAtom**) inKeyB);
}
}
/*virtual*/ mork_u4 //
morkAtomAidMap::Hash(morkEnv* ev, const void* inKey) const
{
/*virtual*/ mork_u4 //
morkAtomAidMap::Hash(morkEnv* ev, const void* inKey) const
{
MORK_USED_1(ev);
return (*(const morkBookAtom**) inKey)->HashAid();
}
// } ===== end morkMap poly interface =====
}
// } ===== end morkMap poly interface =====
#endif /*MORK_ENABLE_PROBE_MAPS*/
mork_bool
@ -130,8 +187,13 @@ morkAtomAidMap::AddAtom(morkEnv* ev, morkBookAtom* ioAtom)
{
if ( ev->Good() )
{
#ifdef MORK_ENABLE_PROBE_MAPS
this->MapAtPut(ev, &ioAtom, /*val*/ (void*) 0,
/*key*/ (void*) 0, /*val*/ (void*) 0);
#else /*MORK_ENABLE_PROBE_MAPS*/
this->Put(ev, &ioAtom, /*val*/ (void*) 0,
/*key*/ (void*) 0, /*val*/ (void*) 0, (mork_change**) 0);
#endif /*MORK_ENABLE_PROBE_MAPS*/
}
return ev->Good();
}
@ -140,8 +202,14 @@ morkBookAtom*
morkAtomAidMap::CutAtom(morkEnv* ev, const morkBookAtom* inAtom)
{
morkBookAtom* oldKey = 0;
#ifdef MORK_ENABLE_PROBE_MAPS
MORK_USED_1(inAtom);
morkProbeMap::ProbeMapCutError(ev);
#else /*MORK_ENABLE_PROBE_MAPS*/
this->Cut(ev, &inAtom, &oldKey, /*val*/ (void*) 0,
(mork_change**) 0);
#endif /*MORK_ENABLE_PROBE_MAPS*/
return oldKey;
}
@ -150,7 +218,12 @@ morkBookAtom*
morkAtomAidMap::GetAtom(morkEnv* ev, const morkBookAtom* inAtom)
{
morkBookAtom* key = 0; // old val in the map
#ifdef MORK_ENABLE_PROBE_MAPS
this->MapAt(ev, &inAtom, &key, /*val*/ (void*) 0);
#else /*MORK_ENABLE_PROBE_MAPS*/
this->Get(ev, &inAtom, &key, /*val*/ (void*) 0, (mork_change**) 0);
#endif /*MORK_ENABLE_PROBE_MAPS*/
return key;
}
@ -161,7 +234,12 @@ morkAtomAidMap::GetAid(morkEnv* ev, mork_aid inAid)
morkWeeBookAtom weeAtom(inAid);
morkBookAtom* key = &weeAtom; // we need a pointer
morkBookAtom* oldKey = 0; // old key in the map
#ifdef MORK_ENABLE_PROBE_MAPS
this->MapAt(ev, &key, &oldKey, /*val*/ (void*) 0);
#else /*MORK_ENABLE_PROBE_MAPS*/
this->Get(ev, &key, &oldKey, /*val*/ (void*) 0, (mork_change**) 0);
#endif /*MORK_ENABLE_PROBE_MAPS*/
return oldKey;
}
@ -191,13 +269,21 @@ morkAtomBodyMap::~morkAtomBodyMap() // assert CloseAtomBodyMap() executed earlie
MORK_ASSERT(this->IsShutNode());
}
/*public non-poly*/
morkAtomBodyMap::morkAtomBodyMap(morkEnv* ev, const morkUsage& inUsage,
nsIMdbHeap* ioHeap, nsIMdbHeap* ioSlotHeap)
#ifdef MORK_ENABLE_PROBE_MAPS
: morkProbeMap(ev, inUsage, ioHeap,
/*inKeySize*/ sizeof(morkBookAtom*), /*inValSize*/ 0,
ioSlotHeap, morkAtomBodyMap_kStartSlotCount,
/*inZeroIsClearKey*/ morkBool_kTrue)
#else /*MORK_ENABLE_PROBE_MAPS*/
: morkMap(ev, inUsage, ioHeap,
/*inKeySize*/ sizeof(morkBookAtom*), /*inValSize*/ 0,
morkAtomBodyMap_kStartSlotCount, ioSlotHeap,
/*inHoldChanges*/ morkBool_kFalse)
#endif /*MORK_ENABLE_PROBE_MAPS*/
{
if ( ev->Good() )
mNode_Derived = morkDerived_kAtomBodyMap;
@ -210,7 +296,11 @@ morkAtomBodyMap::CloseAtomBodyMap(morkEnv* ev) // called by CloseMorkNode();
{
if ( this->IsNode() )
{
#ifdef MORK_ENABLE_PROBE_MAPS
this->CloseProbeMap(ev);
#else /*MORK_ENABLE_PROBE_MAPS*/
this->CloseMap(ev);
#endif /*MORK_ENABLE_PROBE_MAPS*/
this->MarkShut();
}
else
@ -222,22 +312,58 @@ morkAtomBodyMap::CloseAtomBodyMap(morkEnv* ev) // called by CloseMorkNode();
// } ===== end morkNode methods =====
// ````` ````` ````` ````` `````
#ifdef MORK_ENABLE_PROBE_MAPS
// { ===== begin morkMap poly interface =====
/*virtual*/ mork_bool //
morkAtomBodyMap::Equal(morkEnv* ev, const void* inKeyA,
/*virtual*/ mork_test // hit(a,b) implies hash(a) == hash(b)
morkAtomBodyMap::MapTest(morkEnv* ev, const void* inMapKey,
const void* inAppKey) const
{
const morkBookAtom* key = *(const morkBookAtom**) inMapKey;
if ( key )
{
return ( key->EqualFormAndBody(ev, *(const morkBookAtom**) inAppKey) ) ?
morkTest_kHit : morkTest_kMiss;
}
else
return morkTest_kVoid;
}
/*virtual*/ mork_u4 // hit(a,b) implies hash(a) == hash(b)
morkAtomBodyMap::MapHash(morkEnv* ev, const void* inAppKey) const
{
const morkBookAtom* key = *(const morkBookAtom**) inAppKey;
if ( key )
return key->HashFormAndBody(ev);
else
return 0;
}
/*virtual*/ mork_u4
morkAtomBodyMap::ProbeMapHashMapKey(morkEnv* ev, const void* inMapKey) const
{
const morkBookAtom* key = *(const morkBookAtom**) inMapKey;
if ( key )
return key->HashFormAndBody(ev);
else
return 0;
}
#else /*MORK_ENABLE_PROBE_MAPS*/
// { ===== begin morkMap poly interface =====
/*virtual*/ mork_bool //
morkAtomBodyMap::Equal(morkEnv* ev, const void* inKeyA,
const void* inKeyB) const
{
{
return (*(const morkBookAtom**) inKeyA)->EqualFormAndBody(ev,
*(const morkBookAtom**) inKeyB);
}
}
/*virtual*/ mork_u4 //
morkAtomBodyMap::Hash(morkEnv* ev, const void* inKey) const
{
/*virtual*/ mork_u4 //
morkAtomBodyMap::Hash(morkEnv* ev, const void* inKey) const
{
return (*(const morkBookAtom**) inKey)->HashFormAndBody(ev);
}
// } ===== end morkMap poly interface =====
}
// } ===== end morkMap poly interface =====
#endif /*MORK_ENABLE_PROBE_MAPS*/
mork_bool
@ -245,8 +371,13 @@ morkAtomBodyMap::AddAtom(morkEnv* ev, morkBookAtom* ioAtom)
{
if ( ev->Good() )
{
#ifdef MORK_ENABLE_PROBE_MAPS
this->MapAtPut(ev, &ioAtom, /*val*/ (void*) 0,
/*key*/ (void*) 0, /*val*/ (void*) 0);
#else /*MORK_ENABLE_PROBE_MAPS*/
this->Put(ev, &ioAtom, /*val*/ (void*) 0,
/*key*/ (void*) 0, /*val*/ (void*) 0, (mork_change**) 0);
#endif /*MORK_ENABLE_PROBE_MAPS*/
}
return ev->Good();
}
@ -255,8 +386,14 @@ morkBookAtom*
morkAtomBodyMap::CutAtom(morkEnv* ev, const morkBookAtom* inAtom)
{
morkBookAtom* oldKey = 0;
#ifdef MORK_ENABLE_PROBE_MAPS
MORK_USED_1(inAtom);
morkProbeMap::ProbeMapCutError(ev);
#else /*MORK_ENABLE_PROBE_MAPS*/
this->Cut(ev, &inAtom, &oldKey, /*val*/ (void*) 0,
(mork_change**) 0);
#endif /*MORK_ENABLE_PROBE_MAPS*/
return oldKey;
}
@ -265,7 +402,11 @@ morkBookAtom*
morkAtomBodyMap::GetAtom(morkEnv* ev, const morkBookAtom* inAtom)
{
morkBookAtom* key = 0; // old val in the map
#ifdef MORK_ENABLE_PROBE_MAPS
this->MapAt(ev, &inAtom, &key, /*val*/ (void*) 0);
#else /*MORK_ENABLE_PROBE_MAPS*/
this->Get(ev, &inAtom, &key, /*val*/ (void*) 0, (mork_change**) 0);
#endif /*MORK_ENABLE_PROBE_MAPS*/
return key;
}

Просмотреть файл

@ -31,6 +31,10 @@
#include "morkMap.h"
#endif
#ifndef _MORKPROBEMAP_
#include "morkProbeMap.h"
#endif
#ifndef _MORKINTMAP_
#include "morkIntMap.h"
#endif
@ -39,11 +43,15 @@
#define morkDerived_kAtomAidMap /*i*/ 0x6141 /* ascii 'aA' */
#define morkAtomAidMap_kStartSlotCount 512
#define morkAtomAidMap_kStartSlotCount 23
/*| morkAtomAidMap: keys of morkBookAtom organized by atom ID
|*/
#ifdef MORK_ENABLE_PROBE_MAPS
class morkAtomAidMap : public morkProbeMap { // for mapping tokens to maps
#else /*MORK_ENABLE_PROBE_MAPS*/
class morkAtomAidMap : public morkMap { // for mapping tokens to maps
#endif /*MORK_ENABLE_PROBE_MAPS*/
// { ===== begin morkNode interface =====
public: // morkNode virtual methods
@ -60,6 +68,31 @@ public: // dynamic type identification
{ return IsNode() && mNode_Derived == morkDerived_kAtomAidMap; }
// } ===== end morkNode methods =====
public:
#ifdef MORK_ENABLE_PROBE_MAPS
// { ===== begin morkProbeMap methods =====
virtual mork_test // hit(a,b) implies hash(a) == hash(b)
MapTest(morkEnv* ev, const void* inMapKey, const void* inAppKey) const;
virtual mork_u4 // hit(a,b) implies hash(a) == hash(b)
MapHash(morkEnv* ev, const void* inAppKey) const;
virtual mork_u4 ProbeMapHashMapKey(morkEnv* ev, const void* inMapKey) const;
// virtual mork_bool ProbeMapIsKeyNil(morkEnv* ev, void* ioMapKey);
// virtual void ProbeMapClearKey(morkEnv* ev, // put 'nil' alls keys inside map
// void* ioMapKey, mork_count inKeyCount); // array of keys inside map
// virtual void ProbeMapPushIn(morkEnv* ev, // move (key,val) into the map
// const void* inAppKey, const void* inAppVal, // (key,val) outside map
// void* outMapKey, void* outMapVal); // (key,val) inside map
// virtual void ProbeMapPullOut(morkEnv* ev, // move (key,val) out from the map
// const void* inMapKey, const void* inMapVal, // (key,val) inside map
// void* outAppKey, void* outAppVal) const; // (key,val) outside map
// } ===== end morkProbeMap methods =====
#else /*MORK_ENABLE_PROBE_MAPS*/
// { ===== begin morkMap poly interface =====
virtual mork_bool // note: equal(a,b) implies hash(a) == hash(b)
Equal(morkEnv* ev, const void* inKeyA, const void* inKeyB) const;
@ -69,6 +102,7 @@ public: // dynamic type identification
Hash(morkEnv* ev, const void* inKey) const;
// implemented using morkBookAtom::EqualAid()
// } ===== end morkMap poly interface =====
#endif /*MORK_ENABLE_PROBE_MAPS*/
public: // other map methods
@ -96,14 +130,25 @@ public: // typesafe refcounting inlines calling inherited morkNode methods
{ morkNode::SlotStrongNode((morkNode*) me, ev, (morkNode**) ioSlot); }
};
class morkAtomAidMapIter: public morkMapIter{ // typesafe wrapper class
#ifdef MORK_ENABLE_PROBE_MAPS
class morkAtomAidMapIter: public morkProbeMapIter { // typesafe wrapper class
#else /*MORK_ENABLE_PROBE_MAPS*/
class morkAtomAidMapIter: public morkMapIter { // typesafe wrapper class
#endif /*MORK_ENABLE_PROBE_MAPS*/
public:
#ifdef MORK_ENABLE_PROBE_MAPS
morkAtomAidMapIter(morkEnv* ev, morkAtomAidMap* ioMap)
: morkProbeMapIter(ev, ioMap) { }
morkAtomAidMapIter( ) : morkProbeMapIter() { }
#else /*MORK_ENABLE_PROBE_MAPS*/
morkAtomAidMapIter(morkEnv* ev, morkAtomAidMap* ioMap)
: morkMapIter(ev, ioMap) { }
morkAtomAidMapIter( ) : morkMapIter() { }
#endif /*MORK_ENABLE_PROBE_MAPS*/
void InitAtomAidMapIter(morkEnv* ev, morkAtomAidMap* ioMap)
{ this->InitMapIter(ev, ioMap); }
@ -127,11 +172,15 @@ public:
#define morkDerived_kAtomBodyMap /*i*/ 0x6142 /* ascii 'aB' */
#define morkAtomBodyMap_kStartSlotCount 512
#define morkAtomBodyMap_kStartSlotCount 23
/*| morkAtomBodyMap: keys of morkBookAtom organized by body bytes
|*/
#ifdef MORK_ENABLE_PROBE_MAPS
class morkAtomBodyMap : public morkProbeMap { // for mapping tokens to maps
#else /*MORK_ENABLE_PROBE_MAPS*/
class morkAtomBodyMap : public morkMap { // for mapping tokens to maps
#endif /*MORK_ENABLE_PROBE_MAPS*/
// { ===== begin morkNode interface =====
public: // morkNode virtual methods
@ -148,6 +197,31 @@ public: // dynamic type identification
{ return IsNode() && mNode_Derived == morkDerived_kAtomBodyMap; }
// } ===== end morkNode methods =====
public:
#ifdef MORK_ENABLE_PROBE_MAPS
// { ===== begin morkProbeMap methods =====
virtual mork_test // hit(a,b) implies hash(a) == hash(b)
MapTest(morkEnv* ev, const void* inMapKey, const void* inAppKey) const;
virtual mork_u4 // hit(a,b) implies hash(a) == hash(b)
MapHash(morkEnv* ev, const void* inAppKey) const;
virtual mork_u4 ProbeMapHashMapKey(morkEnv* ev, const void* inMapKey) const;
// virtual mork_bool ProbeMapIsKeyNil(morkEnv* ev, void* ioMapKey);
// virtual void ProbeMapClearKey(morkEnv* ev, // put 'nil' alls keys inside map
// void* ioMapKey, mork_count inKeyCount); // array of keys inside map
// virtual void ProbeMapPushIn(morkEnv* ev, // move (key,val) into the map
// const void* inAppKey, const void* inAppVal, // (key,val) outside map
// void* outMapKey, void* outMapVal); // (key,val) inside map
// virtual void ProbeMapPullOut(morkEnv* ev, // move (key,val) out from the map
// const void* inMapKey, const void* inMapVal, // (key,val) inside map
// void* outAppKey, void* outAppVal) const; // (key,val) outside map
// } ===== end morkProbeMap methods =====
#else /*MORK_ENABLE_PROBE_MAPS*/
// { ===== begin morkMap poly interface =====
virtual mork_bool // note: equal(a,b) implies hash(a) == hash(b)
Equal(morkEnv* ev, const void* inKeyA, const void* inKeyB) const;
@ -157,6 +231,7 @@ public: // dynamic type identification
Hash(morkEnv* ev, const void* inKey) const;
// implemented using morkBookAtom::HashFormAndBody()
// } ===== end morkMap poly interface =====
#endif /*MORK_ENABLE_PROBE_MAPS*/
public: // other map methods
@ -181,13 +256,25 @@ public: // typesafe refcounting inlines calling inherited morkNode methods
{ morkNode::SlotStrongNode((morkNode*) me, ev, (morkNode**) ioSlot); }
};
#ifdef MORK_ENABLE_PROBE_MAPS
class morkAtomBodyMapIter: public morkProbeMapIter{ // typesafe wrapper class
#else /*MORK_ENABLE_PROBE_MAPS*/
class morkAtomBodyMapIter: public morkMapIter{ // typesafe wrapper class
#endif /*MORK_ENABLE_PROBE_MAPS*/
public:
#ifdef MORK_ENABLE_PROBE_MAPS
morkAtomBodyMapIter(morkEnv* ev, morkAtomBodyMap* ioMap)
: morkProbeMapIter(ev, ioMap) { }
morkAtomBodyMapIter( ) : morkProbeMapIter() { }
#else /*MORK_ENABLE_PROBE_MAPS*/
morkAtomBodyMapIter(morkEnv* ev, morkAtomBodyMap* ioMap)
: morkMapIter(ev, ioMap) { }
morkAtomBodyMapIter( ) : morkMapIter() { }
#endif /*MORK_ENABLE_PROBE_MAPS*/
void InitAtomBodyMapIter(morkEnv* ev, morkAtomBodyMap* ioMap)
{ this->InitMapIter(ev, ioMap); }

Просмотреть файл

@ -138,22 +138,33 @@ morkAtomSpace::NonAtomSpaceTypeError(morkEnv* ev)
mork_num
morkAtomSpace::CutAllAtoms(morkEnv* ev, morkPool* ioPool)
{
#ifdef MORK_ENABLE_ZONE_ARENAS
MORK_USED_2(ev, ioPool);
return 0;
#else /*MORK_ENABLE_ZONE_ARENAS*/
if ( this->IsAtomSpaceClean() )
this->MaybeDirtyStoreAndSpace();
mork_num outSlots = mAtomSpace_AtomAids.mMap_Fill;
mork_num outSlots = mAtomSpace_AtomAids.MapFill();
morkBookAtom* a = 0; // old key atom in the map
morkStore* store = mSpace_Store;
mork_change* c = 0;
morkAtomAidMapIter i(ev, &mAtomSpace_AtomAids);
for ( c = i.FirstAtom(ev, &a); c ; c = i.NextAtom(ev, &a) )
{
if ( a )
ioPool->ZapAtom(ev, a);
ioPool->ZapAtom(ev, a, &store->mStore_Zone);
#ifdef MORK_ENABLE_PROBE_MAPS
// do not cut anything from the map
#else /*MORK_ENABLE_PROBE_MAPS*/
i.CutHereAtom(ev, /*key*/ (morkBookAtom**) 0);
#endif /*MORK_ENABLE_PROBE_MAPS*/
}
return outSlots;
#endif /*MORK_ENABLE_ZONE_ARENAS*/
}
@ -163,13 +174,14 @@ morkAtomSpace::MakeBookAtomCopyWithAid(morkEnv* ev,
// Make copy of inAtom and put it in both maps, using specified ID.
{
morkBookAtom* outAtom = 0;
if ( ev->Good() )
morkStore* store = mSpace_Store;
if ( ev->Good() && store )
{
morkPool* pool = this->GetSpaceStorePool();
outAtom = pool->NewBookAtomCopy(ev, inAtom);
outAtom = pool->NewBookAtomCopy(ev, inAtom, &store->mStore_Zone);
if ( outAtom )
{
if ( mSpace_Store->mStore_CanDirty )
if ( store->mStore_CanDirty )
{
outAtom->SetAtomDirty();
if ( this->IsAtomSpaceClean() )
@ -180,7 +192,7 @@ morkAtomSpace::MakeBookAtomCopyWithAid(morkEnv* ev,
outAtom->mBookAtom_Space = this;
mAtomSpace_AtomAids.AddAtom(ev, outAtom);
mAtomSpace_AtomBodies.AddAtom(ev, outAtom);
if ( mSpace_Scope == morkAtomSpace_kColumnScope )
if ( this->SpaceScope() == morkAtomSpace_kColumnScope )
outAtom->MakeCellUseForever(ev);
if ( mAtomSpace_HighUnderId <= inAid )
@ -201,7 +213,7 @@ morkAtomSpace::MakeBookAtomCopy(morkEnv* ev, const morkBigBookAtom& inAtom)
if ( store->mStore_CanAutoAssignAtomIdentity )
{
morkPool* pool = this->GetSpaceStorePool();
morkBookAtom* atom = pool->NewBookAtomCopy(ev, inAtom);
morkBookAtom* atom = pool->NewBookAtomCopy(ev, inAtom, &mSpace_Store->mStore_Zone);
if ( atom )
{
mork_aid id = this->MakeNewAtomId(ev, atom);
@ -218,11 +230,11 @@ morkAtomSpace::MakeBookAtomCopy(morkEnv* ev, const morkBigBookAtom& inAtom)
atom->mBookAtom_Space = this;
mAtomSpace_AtomAids.AddAtom(ev, atom);
mAtomSpace_AtomBodies.AddAtom(ev, atom);
if ( mSpace_Scope == morkAtomSpace_kColumnScope )
if ( this->SpaceScope() == morkAtomSpace_kColumnScope )
outAtom->MakeCellUseForever(ev);
}
else
pool->ZapAtom(ev, atom);
pool->ZapAtom(ev, atom, &mSpace_Store->mStore_Zone);
}
}
else

Просмотреть файл

@ -85,7 +85,6 @@ class morkAtomSpace : public morkSpace { //
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// morkStore* mSpace_Store; // weak ref to containing store
// mork_scope mSpace_Scope; // the scope for this space
// mork_bool mSpace_DoAutoIDs; // whether db should assign member IDs
// mork_bool mSpace_HaveDoneAutoIDs; // whether actually auto assigned IDs
@ -184,7 +183,7 @@ public:
public: // other map methods
mork_bool AddAtomSpace(morkEnv* ev, morkAtomSpace* ioAtomSpace)
{ return this->AddNode(ev, ioAtomSpace->mSpace_Scope, ioAtomSpace); }
{ return this->AddNode(ev, ioAtomSpace->SpaceScope(), ioAtomSpace); }
// the AddAtomSpace() boolean return equals ev->Good().
mork_bool CutAtomSpace(morkEnv* ev, mork_scope inScope)

Просмотреть файл

@ -375,7 +375,7 @@ morkBuilder::OnNewTable(morkEnv* ev, const morkPlace& inPlace,
if ( table )
{
if ( table->mTable_RowSpace )
mBuilder_TableRowScope = table->mTable_RowSpace->mSpace_Scope;
mBuilder_TableRowScope = table->mTable_RowSpace->SpaceScope();
if ( inCutAllRows )
table->CutAllRows(ev);
@ -993,7 +993,7 @@ morkBuilder::OnRowMid(morkEnv* ev, const morkSpan& inSpan,
if ( ev->Good() )
{
morkPool* pool = store->StorePool();
morkAtom* atom = pool->NewRowOidAtom(ev, rowOid);
morkAtom* atom = pool->NewRowOidAtom(ev, rowOid, &store->mStore_Zone);
if ( atom )
{
cell->SetAtom(ev, atom, pool);
@ -1030,7 +1030,7 @@ morkBuilder::OnTableMid(morkEnv* ev, const morkSpan& inSpan,
if ( ev->Good() )
{
morkPool* pool = store->StorePool();
morkAtom* atom = pool->NewTableOidAtom(ev, tableOid);
morkAtom* atom = pool->NewTableOidAtom(ev, tableOid, &store->mStore_Zone);
if ( atom )
{
cell->SetAtom(ev, atom, pool);

Просмотреть файл

@ -82,7 +82,7 @@ morkCellObject::~morkCellObject() // assert CloseCellObject() executed earlier
morkCellObject::morkCellObject(morkEnv* ev, const morkUsage& inUsage,
nsIMdbHeap* ioHeap, morkRow* ioRow, morkCell* ioCell,
mork_column inCol, mork_pos inPos)
: morkObject(ev, inUsage, ioHeap, (morkHandle*) 0)
: morkObject(ev, inUsage, ioHeap, morkColor_kNone, (morkHandle*) 0)
, mCellObject_RowObject( 0 )
, mCellObject_Row( 0 )
, mCellObject_Cell( 0 )

Просмотреть файл

@ -48,7 +48,8 @@ class morkCellObject : public morkObject { // blob attribute in column scope
// mork_uses mNode_Uses; // refcount for strong refs
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// morkFactory* mObject_Factory; // weak ref to suite factory
// mork_color mBead_Color; // ID for this bead
// morkHandle* mObject_Handle; // weak ref to handle for this object
public: // state is public because the entire Mork system is private
morkRowObject* mCellObject_RowObject; // strong ref to row's object

Просмотреть файл

@ -98,6 +98,22 @@
#define MORK_FILECLOSE(file) XP_FileClose(file)
#endif /*MORK_OBSOLETE*/
/* ===== separating switchable features ===== */
//define MORK_ENABLE_ZONE_ARENAS 1 /* using morkZone for pooling */
//define MORK_ENABLE_PROBE_MAPS 1 /* use smaller hash tables */
//define MORK_BEAD_OVER_NODE_MAPS 1 /* use bead not node maps */
/* ===== pooling ===== */
#define MORK_CONFIG_PTR_SIZE_4 1 /* sizeof(void*) == 4 */
//define MORK_CONFIG_ALIGN_8 1 /* must have 8 byte alignment */
//define MORK_DEBUG_HEAP_STATS 1 /* analyze per-block heap usage */
/* ===== ===== ===== ===== line characters ===== ===== ===== ===== */
#define mork_kCR 0x0D
#define mork_kLF 0x0A

Просмотреть файл

@ -64,7 +64,7 @@ morkCursor::~morkCursor() // assert CloseCursor() executed earlier
/*public non-poly*/
morkCursor::morkCursor(morkEnv* ev,
const morkUsage& inUsage, nsIMdbHeap* ioHeap)
: morkObject(ev, inUsage, ioHeap, (morkHandle*) 0)
: morkObject(ev, inUsage, ioHeap, morkColor_kNone, (morkHandle*) 0)
, mCursor_Seed( 0 )
, mCursor_Pos( -1 )
, mCursor_DoFailOnSeedOutOfSync( morkBool_kFalse )

Просмотреть файл

@ -44,7 +44,8 @@ class morkCursor : public morkObject { // collection iterator
// mork_uses mNode_Uses; // refcount for strong refs
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// morkFactory* mObject_Factory; // weak ref to suite factory
// mork_color mBead_Color; // ID for this bead
// morkHandle* mObject_Handle; // weak ref to handle for this object
public: // state is public because the entire Mork system is private
mork_seed mCursor_Seed;

Просмотреть файл

@ -73,7 +73,7 @@ morkEnv::~morkEnv() /*i*/ // assert CloseEnv() executed earlier
/*public non-poly*/
morkEnv::morkEnv(const morkUsage& inUsage, nsIMdbHeap* ioHeap,
morkFactory* ioFactory, nsIMdbHeap* ioSlotHeap)
: morkObject(inUsage, ioHeap)
: morkObject(inUsage, ioHeap, morkColor_kNone)
, mEnv_Factory( ioFactory )
, mEnv_Heap( ioSlotHeap )
@ -113,7 +113,7 @@ morkEnv::morkEnv(const morkUsage& inUsage, nsIMdbHeap* ioHeap,
morkEnv::morkEnv(morkEnv* ev, /*i*/
const morkUsage& inUsage, nsIMdbHeap* ioHeap, nsIMdbEnv* inSelfAsMdbEnv,
morkFactory* ioFactory, nsIMdbHeap* ioSlotHeap)
: morkObject(ev, inUsage, ioHeap, (morkHandle*) 0)
: morkObject(ev, inUsage, ioHeap, morkColor_kNone, (morkHandle*) 0)
, mEnv_Factory( ioFactory )
, mEnv_Heap( ioSlotHeap )
@ -399,10 +399,18 @@ morkEnv::CantMakeWhenBadError()
this->NewError("can't make an object when ev->Bad()");
}
static const char* morkEnv_kNilPointer = "nil pointer";
void
morkEnv::NilPointerError()
{
this->NewError("nil pointer");
this->NewError(morkEnv_kNilPointer);
}
void
morkEnv::NilPointerWarning()
{
this->NewWarning(morkEnv_kNilPointer);
}
void

Просмотреть файл

@ -73,6 +73,7 @@ class morkEnv : public morkObject {
// mork_uses mNode_Uses; // refcount for strong refs
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// mork_color mBead_Color; // ID for this bead
// morkHandle* mObject_Handle; // weak ref to handle for this object
public: // state is public because the entire Mork system is private
@ -137,7 +138,7 @@ public: // other env methods
// alloc and free individual handles in mEnv_HandlePool:
morkHandleFace* NewHandle(mork_size inSize)
{ return mEnv_HandlePool->NewHandle(this, inSize); }
{ return mEnv_HandlePool->NewHandle(this, inSize, (morkZone*) 0); }
void ZapHandle(morkHandleFace* ioHandle)
{ mEnv_HandlePool->ZapHandle(this, ioHandle); }
@ -158,6 +159,7 @@ public: // other env methods
void StubMethodOnlyError();
void OutOfMemoryError();
void NilPointerError();
void NilPointerWarning();
void CantMakeWhenBadError();
void NewNonEnvError();
void NilEnvSlotError();

Просмотреть файл

@ -73,7 +73,7 @@ morkFactory::~morkFactory() /*i*/ // assert CloseFactory() executed earlier
/*public non-poly*/
morkFactory::morkFactory() // uses orkinHeap
: morkObject(morkUsage::kGlobal, (nsIMdbHeap*) 0)
: morkObject(morkUsage::kGlobal, (nsIMdbHeap*) 0, morkColor_kNone)
, mFactory_Env(morkUsage::kMember, (nsIMdbHeap*) 0, this,
new orkinHeap())
, mFactory_Heap()
@ -87,7 +87,7 @@ morkFactory::morkFactory() // uses orkinHeap
/*public non-poly*/
morkFactory::morkFactory(nsIMdbHeap* ioHeap)
: morkObject(morkUsage::kHeap, ioHeap)
: morkObject(morkUsage::kHeap, ioHeap, morkColor_kNone)
, mFactory_Env(morkUsage::kMember, (nsIMdbHeap*) 0, this, ioHeap)
, mFactory_Heap()
{
@ -101,7 +101,7 @@ morkFactory::morkFactory(nsIMdbHeap* ioHeap)
/*public non-poly*/
morkFactory::morkFactory(morkEnv* ev, /*i*/
const morkUsage& inUsage, nsIMdbHeap* ioHeap)
: morkObject(ev, inUsage, ioHeap, (morkHandle*) 0)
: morkObject(ev, inUsage, ioHeap, morkColor_kNone, (morkHandle*) 0)
, mFactory_Env(morkUsage::kMember, (nsIMdbHeap*) 0, this, ioHeap)
, mFactory_Heap()
{

Просмотреть файл

@ -57,6 +57,7 @@ class morkFactory : public morkObject { // nsIMdbObject
// mork_uses mNode_Uses; // refcount for strong refs
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// mork_color mBead_Color; // ID for this bead
// morkHandle* mObject_Handle; // weak ref to handle for this object
public: // state is public because the entire Mork system is private

Просмотреть файл

@ -73,7 +73,7 @@ morkFile::~morkFile() // assert CloseFile() executed earlier
/*public non-poly*/
morkFile::morkFile(morkEnv* ev, const morkUsage& inUsage,
nsIMdbHeap* ioHeap, nsIMdbHeap* ioSlotHeap)
: morkObject(ev, inUsage, ioHeap, (morkHandle*) 0)
: morkObject(ev, inUsage, ioHeap, morkColor_kNone, (morkHandle*) 0)
, mFile_Frozen( 0 )
, mFile_DoTrace( 0 )
, mFile_IoOpen( 0 )

Просмотреть файл

@ -57,6 +57,7 @@ class morkFile /*d*/ : public morkObject { /* ````` simple file API ````` */
// public: // slots inherited from morkObject (meant to inform only)
// mork_color mBead_Color; // ID for this bead
// morkHandle* mObject_Handle; // weak ref to handle for this object
// ````` ````` ````` ````` ````` ````` ````` `````

Просмотреть файл

@ -96,8 +96,11 @@ public: // dynamic type identification
// } ===== end morkNode methods =====
public: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -203,6 +203,9 @@ public: // state is public because the entire Mork system is private
morkAssoc* mMap_FreeList; // list of unused mMap_Assocs array slots
public: // getters (morkProbeMap compatibility)
mork_fill MapFill() const { return mMap_Fill; }
// { ===== begin morkNode interface =====
public: // morkNode virtual methods
virtual void CloseMorkNode(morkEnv* ev); // CloseMap() only if open

Просмотреть файл

@ -238,6 +238,20 @@ morkNode::~morkNode() // assert that CloseNode() executed earlier
// subclasses should closely track any changes in base classes with care.
/*public non-poly*/
morkNode::morkNode( mork_usage inCode )
: mNode_Heap( 0 )
, mNode_Base( morkBase_kNode )
, mNode_Derived ( 0 ) // until subclass sets appropriately
, mNode_Access( morkAccess_kOpen )
, mNode_Usage( inCode )
, mNode_Mutable( morkAble_kEnabled )
, mNode_Load( morkLoad_kClean )
, mNode_Uses( 1 )
, mNode_Refs( 1 )
{
}
/*public non-poly*/
morkNode::morkNode(const morkUsage& inUsage, nsIMdbHeap* ioHeap)
: mNode_Heap( ioHeap )
@ -403,9 +417,9 @@ nsIMdbHeap_SlotStrongHeap(nsIMdbHeap* self, morkEnv* ev, nsIMdbHeap** ioSlot)
if ( heap )
{
*ioSlot = 0;
heap->CutStrongRef(menv);
heap->HeapCutStrongRef(menv);
}
if ( self && ev->Good() && (self->AddStrongRef(menv)==0) && ev->Good() )
if ( self && ev->Good() && (self->HeapAddStrongRef(menv)==0) && ev->Good() )
*ioSlot = self;
}
}

Просмотреть файл

@ -147,6 +147,8 @@ public: // morkNode memory management operators
protected: // construction without an anv needed for first env constructed:
morkNode(const morkUsage& inUsage, nsIMdbHeap* ioHeap);
morkNode(mork_usage inCode); // usage == inCode, heap == nil
// { ===== begin basic node interface =====
public: // morkNode virtual methods
// virtual FlushMorkNode(morkEnv* ev, morkStream* ioStream);

Просмотреть файл

@ -63,16 +63,18 @@ morkObject::~morkObject() // assert CloseObject() executed earlier
}
/*public non-poly*/
morkObject::morkObject(const morkUsage& inUsage, nsIMdbHeap* ioHeap)
: morkNode(inUsage, ioHeap)
morkObject::morkObject(const morkUsage& inUsage, nsIMdbHeap* ioHeap,
mork_color inBeadColor)
: morkBead(inUsage, ioHeap, inBeadColor)
, mObject_Handle( 0 )
{
}
/*public non-poly*/
morkObject::morkObject(morkEnv* ev,
const morkUsage& inUsage, nsIMdbHeap* ioHeap, morkHandle* ioHandle)
: morkNode(ev, inUsage, ioHeap)
const morkUsage& inUsage, nsIMdbHeap* ioHeap,
mork_color inBeadColor, morkHandle* ioHandle)
: morkBead(ev, inUsage, ioHeap, inBeadColor)
, mObject_Handle( 0 )
{
if ( ev->Good() )
@ -96,6 +98,8 @@ morkObject::CloseObject(morkEnv* ev) // called by CloseMorkNode();
{
if ( mObject_Handle )
morkHandle::SlotWeakHandle((morkHandle*) 0L, ev, &mObject_Handle);
mBead_Color = 0; // this->CloseBead(ev);
this->MarkShut();
}
}

Просмотреть файл

@ -27,6 +27,10 @@
#include "morkNode.h"
#endif
#ifndef _MORKBEAD_
#include "morkBead.h"
#endif
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
#define morkDerived_kObject /*i*/ 0x6F42 /* ascii 'oB' */
@ -35,7 +39,7 @@
**| and containing port to those objects that are exposed as instances of
**| nsIMdbObject in the public interface.
|*/
class morkObject : public morkNode {
class morkObject : public morkBead {
// public: // slots inherited from morkNode (meant to inform only)
// nsIMdbHeap* mNode_Heap;
@ -51,6 +55,8 @@ class morkObject : public morkNode {
// mork_uses mNode_Uses; // refcount for strong refs
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// mork_color mBead_Color; // ID for this bead
public: // state is public because the entire Mork system is private
morkHandle* mObject_Handle; // weak ref to handle for this object
@ -61,11 +67,12 @@ public: // morkNode virtual methods
virtual ~morkObject(); // assert that CloseObject() executed earlier
protected: // special case construction of first env without preceding env
morkObject(const morkUsage& inUsage, nsIMdbHeap* ioHeap);
morkObject(const morkUsage& inUsage, nsIMdbHeap* ioHeap,
mork_color inBeadColor);
public: // morkEnv construction & destruction
morkObject(morkEnv* ev, const morkUsage& inUsage, nsIMdbHeap* ioHeap,
morkHandle* ioHandle); // ioHandle can be nil
mork_color inBeadColor, morkHandle* ioHandle); // ioHandle can be nil
void CloseObject(morkEnv* ev); // called by CloseMorkNode();
private: // copying is not allowed

Просмотреть файл

@ -747,7 +747,6 @@ void morkParser::ReadTable(morkEnv* ev)
mParser_Change = mParser_TableChange = morkChange_kNil;
int c;
while ( (c = this->NextChar(ev)) != EOF && ev->Good() && c != '}' )
{
if ( morkCh_IsHex(c) )

Просмотреть файл

@ -60,6 +60,10 @@
#include "morkDeque.h"
#endif
#ifndef _MORKZONE_
#include "morkZone.h"
#endif
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
// ````` ````` ````` ````` `````
@ -87,6 +91,8 @@ morkPool::morkPool(const morkUsage& inUsage, nsIMdbHeap* ioHeap,
nsIMdbHeap* ioSlotHeap)
: morkNode(inUsage, ioHeap)
, mPool_Heap( ioSlotHeap )
, mPool_UsedFramesCount( 0 )
, mPool_FreeFramesCount( 0 )
{
// mPool_Heap is NOT refcounted
MORK_ASSERT(ioSlotHeap);
@ -99,6 +105,8 @@ morkPool::morkPool(morkEnv* ev,
const morkUsage& inUsage, nsIMdbHeap* ioHeap, nsIMdbHeap* ioSlotHeap)
: morkNode(ev, inUsage, ioHeap)
, mPool_Heap( ioSlotHeap )
, mPool_UsedFramesCount( 0 )
, mPool_FreeFramesCount( 0 )
{
if ( ioSlotHeap )
{
@ -118,8 +126,18 @@ morkPool::ClosePool(morkEnv* ev) // called by CloseMorkNode();
{
if ( this->IsNode() )
{
// mPool_Heap is NOT refcounted:
// nsIMdbHeap_SlotStrongHeap((nsIMdbHeap*) 0, ev, &mPool_Heap);
#ifdef morkZone_CONFIG_ARENA
#else /*morkZone_CONFIG_ARENA*/
//MORK_USED_1(ioZone);
#endif /*morkZone_CONFIG_ARENA*/
nsIMdbHeap* heap = mPool_Heap;
nsIMdbEnv* mev = ev->AsMdbEnv();
morkLink* link;
morkDeque* d = &mPool_FreeHandleFrames;
while ( (link = d->RemoveFirst()) != 0 )
heap->Free(mev, link);
this->MarkShut();
}
else
@ -135,10 +153,34 @@ morkPool::ClosePool(morkEnv* ev) // called by CloseMorkNode();
// alloc and free individual instances of handles (inside hand frames):
morkHandleFace*
morkPool::NewHandle(morkEnv* ev, mork_size inSize)
morkPool::NewHandle(morkEnv* ev, mork_size inSize, morkZone* ioZone)
{
void* newBlock = 0;
if ( inSize <= sizeof(morkHandleFrame) )
{
morkLink* link = mPool_FreeHandleFrames.RemoveFirst();
if ( link )
{
newBlock = link;
if ( mPool_FreeFramesCount )
--mPool_FreeFramesCount;
else
ev->NewWarning("mPool_FreeFramesCount underflow");
}
else
mPool_Heap->Alloc(ev->AsMdbEnv(), sizeof(morkHandleFrame),
(void**) &newBlock);
}
else
{
ev->NewWarning("inSize > sizeof(morkHandleFrame)");
mPool_Heap->Alloc(ev->AsMdbEnv(), inSize, (void**) &newBlock);
}
#ifdef morkZone_CONFIG_ARENA
#else /*morkZone_CONFIG_ARENA*/
MORK_USED_1(ioZone);
#endif /*morkZone_CONFIG_ARENA*/
return (morkHandleFace*) newBlock;
}
@ -146,39 +188,66 @@ void
morkPool::ZapHandle(morkEnv* ev, morkHandleFace* ioHandle)
{
if ( ioHandle )
mPool_Heap->Free(ev->AsMdbEnv(), ioHandle);
{
morkLink* link = (morkLink*) ioHandle;
mPool_FreeHandleFrames.AddLast(link);
++mPool_FreeFramesCount;
}
}
// alloc and free individual instances of rows:
morkRow*
morkPool::NewRow(morkEnv* ev) // allocate a new row instance
morkPool::NewRow(morkEnv* ev, morkZone* ioZone) // allocate a new row instance
{
morkRow* newRow = 0;
#ifdef morkZone_CONFIG_ARENA
// a zone 'chip' remembers no size, and so cannot be deallocated:
newRow = (morkRow*) ioZone->ZoneNewChip(ev, sizeof(morkRow));
#else /*morkZone_CONFIG_ARENA*/
MORK_USED_1(ioZone);
mPool_Heap->Alloc(ev->AsMdbEnv(), sizeof(morkRow), (void**) &newRow);
#endif /*morkZone_CONFIG_ARENA*/
if ( newRow )
MORK_MEMSET(newRow, 0, sizeof(morkRow));
if ( newRow )
{
}
return newRow;
}
void
morkPool::ZapRow(morkEnv* ev, morkRow* ioRow) // free old row instance
morkPool::ZapRow(morkEnv* ev, morkRow* ioRow,
morkZone* ioZone) // free old row instance
{
#ifdef morkZone_CONFIG_ARENA
if ( !ioRow )
ev->NilPointerWarning(); // a zone 'chip' cannot be freed
#else /*morkZone_CONFIG_ARENA*/
MORK_USED_1(ioZone);
if ( ioRow )
mPool_Heap->Free(ev->AsMdbEnv(), ioRow);
#endif /*morkZone_CONFIG_ARENA*/
}
// alloc and free entire vectors of cells (not just one cell at a time)
morkCell*
morkPool::NewCells(morkEnv* ev, mork_size inSize)
morkPool::NewCells(morkEnv* ev, mork_size inSize,
morkZone* ioZone)
{
morkCell* newCells = 0;
mork_size size = inSize * sizeof(morkCell);
if ( size )
{
#ifdef morkZone_CONFIG_ARENA
// a zone 'run' knows its size, and can indeed be deallocated:
newCells = (morkCell*) ioZone->ZoneNewRun(ev, size);
#else /*morkZone_CONFIG_ARENA*/
MORK_USED_1(ioZone);
mPool_Heap->Alloc(ev->AsMdbEnv(), size, (void**) &newCells);
#endif /*morkZone_CONFIG_ARENA*/
}
// note morkAtom depends on having nil stored in all new mCell_Atom slots:
if ( newCells )
@ -187,23 +256,39 @@ morkPool::NewCells(morkEnv* ev, mork_size inSize)
}
void
morkPool::ZapCells(morkEnv* ev, morkCell* ioVector, mork_size inSize)
morkPool::ZapCells(morkEnv* ev, morkCell* ioVector, mork_size inSize,
morkZone* ioZone)
{
MORK_USED_1(inSize);
if ( ioVector )
{
#ifdef morkZone_CONFIG_ARENA
// a zone 'run' knows its size, and can indeed be deallocated:
ioZone->ZoneZapRun(ev, ioVector);
#else /*morkZone_CONFIG_ARENA*/
MORK_USED_1(ioZone);
mPool_Heap->Free(ev->AsMdbEnv(), ioVector);
#endif /*morkZone_CONFIG_ARENA*/
}
}
// resize (grow or trim) cell vectors inside a containing row instance
mork_bool
morkPool::AddRowCells(morkEnv* ev, morkRow* ioRow, mork_size inNewSize)
morkPool::AddRowCells(morkEnv* ev, morkRow* ioRow, mork_size inNewSize,
morkZone* ioZone)
{
// note strong implementation similarity to morkArray::Grow()
MORK_USED_1(ioZone);
#ifdef morkZone_CONFIG_ARENA
#else /*morkZone_CONFIG_ARENA*/
#endif /*morkZone_CONFIG_ARENA*/
mork_fill fill = ioRow->mRow_Length;
if ( ev->Good() && fill < inNewSize ) // need more cells?
{
morkCell* newCells = this->NewCells(ev, inNewSize);
morkCell* newCells = this->NewCells(ev, inNewSize, ioZone);
if ( newCells )
{
morkCell* c = newCells; // for iterating during copy
@ -219,7 +304,7 @@ morkPool::AddRowCells(morkEnv* ev, morkRow* ioRow, mork_size inNewSize)
++ioRow->mRow_Seed;
if ( oldCells )
this->ZapCells(ev, oldCells, fill);
this->ZapCells(ev, oldCells, fill, ioZone);
}
}
return ( ev->Good() && ioRow->mRow_Length >= inNewSize );
@ -227,14 +312,20 @@ morkPool::AddRowCells(morkEnv* ev, morkRow* ioRow, mork_size inNewSize)
mork_bool
morkPool::CutRowCells(morkEnv* ev, morkRow* ioRow,
mork_size inNewSize)
mork_size inNewSize,
morkZone* ioZone)
{
MORK_USED_1(ioZone);
#ifdef morkZone_CONFIG_ARENA
#else /*morkZone_CONFIG_ARENA*/
#endif /*morkZone_CONFIG_ARENA*/
mork_fill fill = ioRow->mRow_Length;
if ( ev->Good() && fill > inNewSize ) // need fewer cells?
{
if ( inNewSize ) // want any row cells at all?
{
morkCell* newCells = this->NewCells(ev, inNewSize);
morkCell* newCells = this->NewCells(ev, inNewSize, ioZone);
if ( newCells )
{
morkCell* oldCells = ioRow->mRow_Cells;
@ -256,7 +347,7 @@ morkPool::CutRowCells(morkEnv* ev, morkRow* ioRow,
++ioRow->mRow_Seed;
if ( oldCells )
this->ZapCells(ev, oldCells, fill);
this->ZapCells(ev, oldCells, fill, ioZone);
}
}
else // get rid of all row cells
@ -267,7 +358,7 @@ morkPool::CutRowCells(morkEnv* ev, morkRow* ioRow,
++ioRow->mRow_Seed;
if ( oldCells )
this->ZapCells(ev, oldCells, fill);
this->ZapCells(ev, oldCells, fill, ioZone);
}
}
return ( ev->Good() && ioRow->mRow_Length <= inNewSize );
@ -275,27 +366,51 @@ morkPool::CutRowCells(morkEnv* ev, morkRow* ioRow,
// alloc & free individual instances of atoms (lots of atom subclasses):
void
morkPool::ZapAtom(morkEnv* ev, morkAtom* ioAtom) // any subclass (by kind)
morkPool::ZapAtom(morkEnv* ev, morkAtom* ioAtom,
morkZone* ioZone) // any subclass (by kind)
{
#ifdef morkZone_CONFIG_ARENA
if ( !ioAtom )
ev->NilPointerWarning(); // a zone 'chip' cannot be freed
#else /*morkZone_CONFIG_ARENA*/
MORK_USED_1(ioZone);
if ( ioAtom )
mPool_Heap->Free(ev->AsMdbEnv(), ioAtom);
#endif /*morkZone_CONFIG_ARENA*/
}
morkOidAtom*
morkPool::NewRowOidAtom(morkEnv* ev, const mdbOid& inOid)
morkPool::NewRowOidAtom(morkEnv* ev, const mdbOid& inOid,
morkZone* ioZone)
{
morkOidAtom* newAtom = 0;
#ifdef morkZone_CONFIG_ARENA
// a zone 'chip' remembers no size, and so cannot be deallocated:
newAtom = (morkOidAtom*) ioZone->ZoneNewChip(ev, sizeof(morkOidAtom));
#else /*morkZone_CONFIG_ARENA*/
MORK_USED_1(ioZone);
mPool_Heap->Alloc(ev->AsMdbEnv(), sizeof(morkOidAtom),(void**) &newAtom);
#endif /*morkZone_CONFIG_ARENA*/
if ( newAtom )
newAtom->InitRowOidAtom(ev, inOid);
return newAtom;
}
morkOidAtom*
morkPool::NewTableOidAtom(morkEnv* ev, const mdbOid& inOid)
morkPool::NewTableOidAtom(morkEnv* ev, const mdbOid& inOid,
morkZone* ioZone)
{
morkOidAtom* newAtom = 0;
#ifdef morkZone_CONFIG_ARENA
// a zone 'chip' remembers no size, and so cannot be deallocated:
newAtom = (morkOidAtom*) ioZone->ZoneNewChip(ev, sizeof(morkOidAtom));
#else /*morkZone_CONFIG_ARENA*/
MORK_USED_1(ioZone);
mPool_Heap->Alloc(ev->AsMdbEnv(), sizeof(morkOidAtom), (void**) &newAtom);
#endif /*morkZone_CONFIG_ARENA*/
if ( newAtom )
newAtom->InitTableOidAtom(ev, inOid);
return newAtom;
@ -303,17 +418,25 @@ morkPool::NewTableOidAtom(morkEnv* ev, const mdbOid& inOid)
morkAtom*
morkPool::NewAnonAtom(morkEnv* ev, const morkBuf& inBuf,
mork_cscode inForm)
mork_cscode inForm,
morkZone* ioZone)
// if inForm is zero, and inBuf.mBuf_Fill is less than 256, then a 'wee'
// anon atom will be created, and otherwise a 'big' anon atom.
{
morkAtom* newAtom = 0;
mork_bool needBig = ( inForm || inBuf.mBuf_Fill > 255 );
mork_size size = ( needBig )?
morkBigAnonAtom::SizeForFill(inBuf.mBuf_Fill) :
morkWeeAnonAtom::SizeForFill(inBuf.mBuf_Fill);
#ifdef morkZone_CONFIG_ARENA
// a zone 'chip' remembers no size, and so cannot be deallocated:
newAtom = (morkAtom*) ioZone->ZoneNewChip(ev, size);
#else /*morkZone_CONFIG_ARENA*/
MORK_USED_1(ioZone);
mPool_Heap->Alloc(ev->AsMdbEnv(), size, (void**) &newAtom);
#endif /*morkZone_CONFIG_ARENA*/
if ( newAtom )
{
if ( needBig )
@ -326,17 +449,25 @@ morkPool::NewAnonAtom(morkEnv* ev, const morkBuf& inBuf,
morkBookAtom*
morkPool::NewBookAtom(morkEnv* ev, const morkBuf& inBuf,
mork_cscode inForm, morkAtomSpace* ioSpace, mork_aid inAid)
mork_cscode inForm, morkAtomSpace* ioSpace, mork_aid inAid,
morkZone* ioZone)
// if inForm is zero, and inBuf.mBuf_Fill is less than 256, then a 'wee'
// book atom will be created, and otherwise a 'big' book atom.
{
morkBookAtom* newAtom = 0;
mork_bool needBig = ( inForm || inBuf.mBuf_Fill > 255 );
mork_size size = ( needBig )?
morkBigBookAtom::SizeForFill(inBuf.mBuf_Fill) :
morkWeeBookAtom::SizeForFill(inBuf.mBuf_Fill);
#ifdef morkZone_CONFIG_ARENA
// a zone 'chip' remembers no size, and so cannot be deallocated:
newAtom = (morkBookAtom*) ioZone->ZoneNewChip(ev, size);
#else /*morkZone_CONFIG_ARENA*/
MORK_USED_1(ioZone);
mPool_Heap->Alloc(ev->AsMdbEnv(), size, (void**) &newAtom);
#endif /*morkZone_CONFIG_ARENA*/
if ( newAtom )
{
if ( needBig )
@ -350,12 +481,14 @@ morkPool::NewBookAtom(morkEnv* ev, const morkBuf& inBuf,
}
morkBookAtom*
morkPool::NewBookAtomCopy(morkEnv* ev, const morkBigBookAtom& inAtom)
morkPool::NewBookAtomCopy(morkEnv* ev, const morkBigBookAtom& inAtom,
morkZone* ioZone)
// make the smallest kind of book atom that can hold content in inAtom.
// The inAtom parameter is often expected to be a staged book atom in
// the store, which was used to search an atom space for existing atoms.
{
morkBookAtom* newAtom = 0;
mork_cscode form = inAtom.mBigBookAtom_Form;
mork_fill fill = inAtom.mBigBookAtom_Size;
mork_bool needBig = ( form || fill > 255 );
@ -363,7 +496,13 @@ morkPool::NewBookAtomCopy(morkEnv* ev, const morkBigBookAtom& inAtom)
morkBigBookAtom::SizeForFill(fill) :
morkWeeBookAtom::SizeForFill(fill);
#ifdef morkZone_CONFIG_ARENA
// a zone 'chip' remembers no size, and so cannot be deallocated:
newAtom = (morkBookAtom*) ioZone->ZoneNewChip(ev, size);
#else /*morkZone_CONFIG_ARENA*/
MORK_USED_1(ioZone);
mPool_Heap->Alloc(ev->AsMdbEnv(), size, (void**) &newAtom);
#endif /*morkZone_CONFIG_ARENA*/
if ( newAtom )
{
morkBuf buf(inAtom.mBigBookAtom_Body, fill);

Просмотреть файл

@ -69,6 +69,9 @@ public: // state is public because the entire Mork system is private
morkDeque mPool_UsedHandleFrames; // handle frames currently being used
morkDeque mPool_FreeHandleFrames; // handle frames currently in free list
mork_count mPool_UsedFramesCount; // length of mPool_UsedHandleFrames
mork_count mPool_FreeFramesCount; // length of mPool_UsedHandleFrames
// { ===== begin morkNode interface =====
public: // morkNode virtual methods
virtual void CloseMorkNode(morkEnv* ev); // ClosePool() only if open
@ -107,38 +110,38 @@ public: // morkNode memory management operators
public: // other pool methods
// alloc and free individual instances of handles (inside hand frames):
morkHandleFace* NewHandle(morkEnv* ev, mork_size inSize);
morkHandleFace* NewHandle(morkEnv* ev, mork_size inSize, morkZone* ioZone);
void ZapHandle(morkEnv* ev, morkHandleFace* ioHandle);
// alloc and free individual instances of rows:
morkRow* NewRow(morkEnv* ev); // allocate a new row instance
void ZapRow(morkEnv* ev, morkRow* ioRow); // free old row instance
morkRow* NewRow(morkEnv* ev, morkZone* ioZone); // alloc new row instance
void ZapRow(morkEnv* ev, morkRow* ioRow, morkZone* ioZone); // free old row instance
// alloc and free entire vectors of cells (not just one cell at a time)
morkCell* NewCells(morkEnv* ev, mork_size inSize);
void ZapCells(morkEnv* ev, morkCell* ioVector, mork_size inSize);
morkCell* NewCells(morkEnv* ev, mork_size inSize, morkZone* ioZone);
void ZapCells(morkEnv* ev, morkCell* ioVector, mork_size inSize, morkZone* ioZone);
// resize (grow or trim) cell vectors inside a containing row instance
mork_bool AddRowCells(morkEnv* ev, morkRow* ioRow, mork_size inNewSize);
mork_bool CutRowCells(morkEnv* ev, morkRow* ioRow, mork_size inNewSize);
mork_bool AddRowCells(morkEnv* ev, morkRow* ioRow, mork_size inNewSize, morkZone* ioZone);
mork_bool CutRowCells(morkEnv* ev, morkRow* ioRow, mork_size inNewSize, morkZone* ioZone);
// alloc & free individual instances of atoms (lots of atom subclasses):
void ZapAtom(morkEnv* ev, morkAtom* ioAtom); // any subclass (by kind)
void ZapAtom(morkEnv* ev, morkAtom* ioAtom, morkZone* ioZone); // any subclass (by kind)
morkOidAtom* NewRowOidAtom(morkEnv* ev, const mdbOid& inOid);
morkOidAtom* NewTableOidAtom(morkEnv* ev, const mdbOid& inOid);
morkOidAtom* NewRowOidAtom(morkEnv* ev, const mdbOid& inOid, morkZone* ioZone);
morkOidAtom* NewTableOidAtom(morkEnv* ev, const mdbOid& inOid, morkZone* ioZone);
morkAtom* NewAnonAtom(morkEnv* ev, const morkBuf& inBuf,
mork_cscode inForm);
mork_cscode inForm, morkZone* ioZone);
// if inForm is zero, and inBuf.mBuf_Fill is less than 256, then a 'wee'
// anon atom will be created, and otherwise a 'big' anon atom.
morkBookAtom* NewBookAtom(morkEnv* ev, const morkBuf& inBuf,
mork_cscode inForm, morkAtomSpace* ioSpace, mork_aid inAid);
mork_cscode inForm, morkAtomSpace* ioSpace, mork_aid inAid, morkZone* ioZone);
// if inForm is zero, and inBuf.mBuf_Fill is less than 256, then a 'wee'
// book atom will be created, and otherwise a 'big' book atom.
morkBookAtom* NewBookAtomCopy(morkEnv* ev, const morkBigBookAtom& inAtom);
morkBookAtom* NewBookAtomCopy(morkEnv* ev, const morkBigBookAtom& inAtom, morkZone* ioZone);
// make the smallest kind of book atom that can hold content in inAtom.
// The inAtom parameter is often expected to be a staged book atom in
// the store, which was used to search an atom space for existing atoms.

Просмотреть файл

@ -286,6 +286,14 @@ morkPortTableCursor::NextTable(morkEnv* ev)
if ( space ) // have a space remaining that might hold tables?
{
#ifdef MORK_BEAD_OVER_NODE_MAPS
morkTableMapIter* ti = &mPortTableCursor_TableIter;
morkTable* table = ( mPortTableCursor_LastTable )?
ti->NextTable(ev) : ti->FirstTable(ev);
for ( ; table && ev->Good(); table = ti->NextTable(ev) )
#else /*MORK_BEAD_OVER_NODE_MAPS*/
mork_tid* key = 0; // ignore keys in table map
morkTable* table = 0; // old value table in the map
morkTableMapIter* ti = &mPortTableCursor_TableIter;
@ -293,6 +301,7 @@ morkPortTableCursor::NextTable(morkEnv* ev)
ti->NextTable(ev, key, &table) : ti->FirstTable(ev, key, &table);
for ( ; c && ev->Good(); c = ti->NextTable(ev, key, &table) )
#endif /*MORK_BEAD_OVER_NODE_MAPS*/
{
if ( table && table->IsTable() )
{

Просмотреть файл

@ -219,8 +219,10 @@ morkRow::InitRow(morkEnv* ev, const mdbOid* inOid, morkRowSpace* ioSpace,
mRow_Flags = 0;
mRow_Tag = morkRow_kTag;
morkZone* zone = &ioSpace->mSpace_Store->mStore_Zone;
if ( inLength )
mRow_Cells = ioPool->NewCells(ev, inLength);
mRow_Cells = ioPool->NewCells(ev, inLength, zone);
if ( this->MaybeDirtySpaceStoreAndRow() ) // new row might dirty store
{
@ -385,8 +387,9 @@ morkRow::TakeCells(morkEnv* ev, morkCell* ioVector, mork_fill inVecLength,
if ( growth && ev->Good() ) // need to add any cells?
{
morkZone* zone = &ioStore->mStore_Zone;
morkPool* pool = ioStore->StorePool();
if ( !pool->AddRowCells(ev, this, length + growth) )
if ( !pool->AddRowCells(ev, this, length + growth, zone) )
ev->NewError("cannot take cells");
}
if ( ev->Good() )
@ -429,10 +432,11 @@ morkRow::NewCell(morkEnv* ev, mdb_column inColumn,
mork_size length = (mork_size) mRow_Length;
*outPos = (mork_pos) length;
morkPool* pool = ioStore->StorePool();
morkZone* zone = &ioStore->mStore_Zone;
mork_bool canDirty = this->MaybeDirtySpaceStoreAndRow();
if ( pool->AddRowCells(ev, this, length + 1) )
if ( pool->AddRowCells(ev, this, length + 1, zone) )
{
morkCell* cell = mRow_Cells + length;
// next line equivalent to inline morkCell::SetCellDirty():
@ -594,7 +598,7 @@ morkRow::CutAllColumns(morkEnv* ev)
this->cut_all_index_entries(ev);
morkPool* pool = store->StorePool();
pool->CutRowCells(ev, this, /*newSize*/ 0);
pool->CutRowCells(ev, this, /*newSize*/ 0, &store->mStore_Zone);
}
}
@ -616,10 +620,10 @@ morkRow::SetRow(morkEnv* ev, const morkRow* inSourceRow)
mork_bool sameStore = ( store == srcStore ); // identical stores?
morkPool* pool = store->StorePool();
if ( pool->CutRowCells(ev, this, /*newSize*/ 0) )
if ( pool->CutRowCells(ev, this, /*newSize*/ 0, &store->mStore_Zone) )
{
mork_fill fill = inSourceRow->mRow_Length;
if ( pool->AddRowCells(ev, this, fill) )
if ( pool->AddRowCells(ev, this, fill, &store->mStore_Zone) )
{
morkCell* dst = mRow_Cells;
morkCell* dstEnd = dst + mRow_Length;
@ -784,7 +788,7 @@ void morkRow::CutColumn(morkEnv* ev, mdb_column inColumn)
}
if ( ev->Good() )
pool->CutRowCells(ev, this, fill - 1);
pool->CutRowCells(ev, this, fill - 1, &store->mStore_Zone);
}
}
}

Просмотреть файл

@ -46,7 +46,7 @@ class nsIMdbCell;
class morkRow { // row of cells
public: // state is public because the entire Mork system is private
morkRowSpace* mRow_Space; // mRow_Space->mSpace_Scope is the row scope
morkRowSpace* mRow_Space; // mRow_Space->SpaceScope() is the row scope
morkRowObject* mRow_Object; // refcount & other state for object sharing
morkCell* mRow_Cells;
mdbOid mRow_Oid;

Просмотреть файл

@ -170,4 +170,151 @@ morkRowMap::GetRow(morkEnv* ev, const morkRow* ioRow)
}
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
// ````` ````` ````` ````` `````
// { ===== begin morkNode interface =====
/*public virtual*/ void
morkRowProbeMap::CloseMorkNode(morkEnv* ev) // CloseRowProbeMap() only if open
{
if ( this->IsOpenNode() )
{
this->MarkClosing();
this->CloseRowProbeMap(ev);
this->MarkShut();
}
}
/*public virtual*/
morkRowProbeMap::~morkRowProbeMap() // assert CloseRowProbeMap() executed earlier
{
MORK_ASSERT(this->IsShutNode());
}
/*public non-poly*/
morkRowProbeMap::morkRowProbeMap(morkEnv* ev, const morkUsage& inUsage,
nsIMdbHeap* ioHeap, nsIMdbHeap* ioSlotHeap, mork_size inSlots)
: morkProbeMap(ev, inUsage, ioHeap,
/*inKeySize*/ sizeof(morkRow*), /*inValSize*/ 0,
ioSlotHeap, inSlots,
/*inHoldChanges*/ morkBool_kTrue)
{
if ( ev->Good() )
mNode_Derived = morkDerived_kRowProbeMap;
}
/*public non-poly*/ void
morkRowProbeMap::CloseRowProbeMap(morkEnv* ev) // called by CloseMorkNode();
{
if ( this )
{
if ( this->IsNode() )
{
this->CloseProbeMap(ev);
this->MarkShut();
}
else
this->NonNodeError(ev);
}
else
ev->NilPointerError();
}
// } ===== end morkNode methods =====
// ````` ````` ````` ````` `````
/*virtual*/ mork_test // hit(a,b) implies hash(a) == hash(b)
morkRowProbeMap::MapTest(morkEnv* ev, const void* inMapKey,
const void* inAppKey) const
{
MORK_USED_1(ev);
const morkRow* key = *(const morkRow**) inMapKey;
if ( key )
{
mork_bool hit = key->EqualRow(*(const morkRow**) inAppKey);
return ( hit ) ? morkTest_kHit : morkTest_kMiss;
}
else
return morkTest_kVoid;
}
/*virtual*/ mork_u4 // hit(a,b) implies hash(a) == hash(b)
morkRowProbeMap::MapHash(morkEnv* ev, const void* inAppKey) const
{
const morkRow* key = *(const morkRow**) inAppKey;
if ( key )
return key->HashRow();
else
{
ev->NilPointerWarning();
return 0;
}
}
/*virtual*/ mork_u4
morkRowProbeMap::ProbeMapHashMapKey(morkEnv* ev,
const void* inMapKey) const
{
const morkRow* key = *(const morkRow**) inMapKey;
if ( key )
return key->HashRow();
else
{
ev->NilPointerWarning();
return 0;
}
}
mork_bool
morkRowProbeMap::AddRow(morkEnv* ev, morkRow* ioRow)
{
if ( ev->Good() )
{
this->MapAtPut(ev, &ioRow, /*val*/ (void*) 0,
/*key*/ (void*) 0, /*val*/ (void*) 0);
}
return ev->Good();
}
morkRow*
morkRowProbeMap::CutOid(morkEnv* ev, const mdbOid* inOid)
{
MORK_USED_1(inOid);
morkProbeMap::ProbeMapCutError(ev);
return 0;
}
morkRow*
morkRowProbeMap::CutRow(morkEnv* ev, const morkRow* ioRow)
{
MORK_USED_1(ioRow);
morkProbeMap::ProbeMapCutError(ev);
return 0;
}
morkRow*
morkRowProbeMap::GetOid(morkEnv* ev, const mdbOid* inOid)
{
morkRow row(inOid);
morkRow* key = &row;
morkRow* oldKey = 0;
this->MapAt(ev, &key, &oldKey, /*val*/ (void*) 0);
return oldKey;
}
morkRow*
morkRowProbeMap::GetRow(morkEnv* ev, const morkRow* ioRow)
{
morkRow* oldKey = 0;
this->MapAt(ev, &ioRow, &oldKey, /*val*/ (void*) 0);
return oldKey;
}
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789

Просмотреть файл

@ -31,6 +31,10 @@
#include "morkMap.h"
#endif
#ifndef _MORKPROBEMAP_
#include "morkProbeMap.h"
#endif
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
#define morkDerived_kRowMap /*i*/ 0x724D /* ascii 'rM' */
@ -84,11 +88,11 @@ public: // other map methods
// note the rows are owned elsewhere, usuall by morkRowSpace
public: // typesafe refcounting inlines calling inherited morkNode methods
static void SlotWeakRowMap(morkMap* me,
static void SlotWeakRowMap(morkRowMap* me,
morkEnv* ev, morkRowMap** ioSlot)
{ morkNode::SlotWeakNode((morkNode*) me, ev, (morkNode**) ioSlot); }
static void SlotStrongRowMap(morkMap* me,
static void SlotStrongRowMap(morkRowMap* me,
morkEnv* ev, morkRowMap** ioSlot)
{ morkNode::SlotStrongNode((morkNode*) me, ev, (morkNode**) ioSlot); }
};
@ -116,6 +120,105 @@ public:
{ return this->CutHere(ev, outRowPtr, /*val*/ (void*) 0); }
};
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
#define morkDerived_kRowProbeMap /*i*/ 0x726D /* ascii 'rm' */
/*| morkRowProbeMap: maps a set of morkRow by contained Oid
|*/
class morkRowProbeMap : public morkProbeMap { // for mapping row IDs to rows
// { ===== begin morkNode interface =====
public: // morkNode virtual methods
virtual void CloseMorkNode(morkEnv* ev); // CloseRowProbeMap() only if open
virtual ~morkRowProbeMap(); // assert CloseRowProbeMap() executed earlier
public: // morkMap construction & destruction
morkRowProbeMap(morkEnv* ev, const morkUsage& inUsage,
nsIMdbHeap* ioHeap, nsIMdbHeap* ioSlotHeap, mork_size inSlots);
void CloseRowProbeMap(morkEnv* ev); // called by CloseMorkNode();
public: // dynamic type identification
mork_bool IsRowMap() const
{ return IsNode() && mNode_Derived == morkDerived_kRowMap; }
// } ===== end morkNode methods =====
// { ===== begin morkProbeMap methods =====
virtual mork_test // hit(a,b) implies hash(a) == hash(b)
MapTest(morkEnv* ev, const void* inMapKey, const void* inAppKey) const;
virtual mork_u4 // hit(a,b) implies hash(a) == hash(b)
MapHash(morkEnv* ev, const void* inAppKey) const;
virtual mork_u4 ProbeMapHashMapKey(morkEnv* ev, const void* inMapKey) const;
// virtual mork_bool ProbeMapIsKeyNil(morkEnv* ev, void* ioMapKey);
// virtual void ProbeMapClearKey(morkEnv* ev, // put 'nil' alls keys inside map
// void* ioMapKey, mork_count inKeyCount); // array of keys inside map
// virtual void ProbeMapPushIn(morkEnv* ev, // move (key,val) into the map
// const void* inAppKey, const void* inAppVal, // (key,val) outside map
// void* outMapKey, void* outMapVal); // (key,val) inside map
// virtual void ProbeMapPullOut(morkEnv* ev, // move (key,val) out from the map
// const void* inMapKey, const void* inMapVal, // (key,val) inside map
// void* outAppKey, void* outAppVal) const; // (key,val) outside map
// } ===== end morkProbeMap methods =====
public: // other map methods
mork_bool AddRow(morkEnv* ev, morkRow* ioRow);
// AddRow() returns ev->Good()
morkRow* CutOid(morkEnv* ev, const mdbOid* inOid);
// CutRid() returns the row removed equal to inRid, if there was one
morkRow* CutRow(morkEnv* ev, const morkRow* ioRow);
// CutRow() returns the row removed equal to ioRow, if there was one
morkRow* GetOid(morkEnv* ev, const mdbOid* inOid);
// GetOid() returns the row equal to inRid, or else nil
morkRow* GetRow(morkEnv* ev, const morkRow* ioRow);
// GetRow() returns the row equal to ioRow, or else nil
// note the rows are owned elsewhere, usuall by morkRowSpace
public: // typesafe refcounting inlines calling inherited morkNode methods
static void SlotWeakRowProbeMap(morkRowProbeMap* me,
morkEnv* ev, morkRowProbeMap** ioSlot)
{ morkNode::SlotWeakNode((morkNode*) me, ev, (morkNode**) ioSlot); }
static void SlotStrongRowProbeMap(morkRowProbeMap* me,
morkEnv* ev, morkRowProbeMap** ioSlot)
{ morkNode::SlotStrongNode((morkNode*) me, ev, (morkNode**) ioSlot); }
};
class morkRowProbeMapIter: public morkProbeMapIter{ // typesafe wrapper class
public:
morkRowProbeMapIter(morkEnv* ev, morkRowProbeMap* ioMap)
: morkProbeMapIter(ev, ioMap) { }
morkRowProbeMapIter( ) : morkProbeMapIter() { }
void InitRowMapIter(morkEnv* ev, morkRowProbeMap* ioMap)
{ this->InitMapIter(ev, ioMap); }
mork_change* FirstRow(morkEnv* ev, morkRow** outRowPtr)
{ return this->First(ev, outRowPtr, /*val*/ (void*) 0); }
mork_change* NextRow(morkEnv* ev, morkRow** outRowPtr)
{ return this->Next(ev, outRowPtr, /*val*/ (void*) 0); }
mork_change* HereRow(morkEnv* ev, morkRow** outRowPtr)
{ return this->Here(ev, outRowPtr, /*val*/ (void*) 0); }
mork_change* CutHereRow(morkEnv* ev, morkRow** outRowPtr)
{ return this->CutHere(ev, outRowPtr, /*val*/ (void*) 0); }
};
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
#endif /* _MORKROWMAP_ */

Просмотреть файл

@ -70,7 +70,7 @@ morkRowObject::~morkRowObject() // assert CloseRowObject() executed earlier
morkRowObject::morkRowObject(morkEnv* ev,
const morkUsage& inUsage, nsIMdbHeap* ioHeap,
morkRow* ioRow, morkStore* ioStore)
: morkObject(ev, inUsage, ioHeap, (morkHandle*) 0)
: morkObject(ev, inUsage, ioHeap, morkColor_kNone, (morkHandle*) 0)
, mRowObject_Row( 0 )
, mRowObject_Store( 0 )
{

Просмотреть файл

@ -212,11 +212,23 @@ morkRowSpace::CutAllRows(morkEnv* ev, morkPool* ioPool)
if ( this->IsRowSpaceClean() )
this->MaybeDirtyStoreAndSpace();
mork_num outSlots = mRowSpace_Rows.mMap_Fill;
morkZone* zone = &mSpace_Store->mStore_Zone;
mork_num outSlots = mRowSpace_Rows.MapFill();
morkRow* r = 0; // old key row in the map
mork_change* c = 0;
#ifdef MORK_ENABLE_ZONE_ARENAS
MORK_USED_2(ev, ioPool);
return 0;
#else /*MORK_ENABLE_ZONE_ARENAS*/
#ifdef MORK_ENABLE_PROBE_MAPS
morkRowProbeMapIter i(ev, &mRowSpace_Rows);
#else /*MORK_ENABLE_PROBE_MAPS*/
morkRowMapIter i(ev, &mRowSpace_Rows);
#endif /*MORK_ENABLE_PROBE_MAPS*/
for ( c = i.FirstRow(ev, &r); c && ev->Good();
c = i.NextRow(ev, &r) )
{
@ -229,7 +241,7 @@ morkRowSpace::CutAllRows(morkEnv* ev, morkPool* ioPool)
morkRowObject::SlotWeakRowObject((morkRowObject*) 0, ev,
&r->mRow_Object);
}
ioPool->ZapRow(ev, r);
ioPool->ZapRow(ev, r, zone);
}
else
r->NonRowTypeWarning(ev);
@ -237,18 +249,30 @@ morkRowSpace::CutAllRows(morkEnv* ev, morkPool* ioPool)
else
ev->NilPointerError();
#ifdef MORK_ENABLE_PROBE_MAPS
// cut nothing from the map
#else /*MORK_ENABLE_PROBE_MAPS*/
i.CutHereRow(ev, /*key*/ (morkRow**) 0);
#endif /*MORK_ENABLE_PROBE_MAPS*/
}
#endif /*MORK_ENABLE_ZONE_ARENAS*/
return outSlots;
}
morkTable*
morkRowSpace::FindTableByKind(morkEnv* ev, mork_kind inTableKind)
{
if ( inTableKind )
{
#ifdef MORK_BEAD_OVER_NODE_MAPS
morkTableMapIter i(ev, &mRowSpace_Tables);
morkTable* table = i.FirstTable(ev);
for ( ; table && ev->Good(); table = i.NextTable(ev) )
#else /*MORK_BEAD_OVER_NODE_MAPS*/
mork_tid* key = 0; // nil pointer to suppress key access
morkTable* table = 0; // old table in the map
@ -256,6 +280,7 @@ morkRowSpace::FindTableByKind(morkEnv* ev, mork_kind inTableKind)
morkTableMapIter i(ev, &mRowSpace_Tables);
for ( c = i.FirstTable(ev, key, &table); c && ev->Good();
c = i.NextTable(ev, key, &table) )
#endif /*MORK_BEAD_OVER_NODE_MAPS*/
{
if ( table->mTable_Kind == inTableKind )
return table;
@ -377,7 +402,7 @@ morkRowSpace::MakeNewRowId(morkEnv* ev)
mork_rid id = mRowSpace_NextRowId;
mork_num count = 9; // try up to eight times
mdbOid oid;
oid.mOid_Scope = mSpace_Scope;
oid.mOid_Scope = this->SpaceScope();
while ( !outRid && --count ) // still trying to find an unused row ID?
{
@ -409,7 +434,11 @@ morkRowSpace::make_index(morkEnv* ev, mork_column inCol)
{
if ( ev->Good() ) // no errors during construction?
{
#ifdef MORK_ENABLE_PROBE_MAPS
morkRowProbeMapIter i(ev, &mRowSpace_Rows);
#else /*MORK_ENABLE_PROBE_MAPS*/
morkRowMapIter i(ev, &mRowSpace_Rows);
#endif /*MORK_ENABLE_PROBE_MAPS*/
mork_change* c = 0;
morkRow* row = 0;
mork_aid aidKey = 0;
@ -537,7 +566,7 @@ morkRowSpace::NewRowWithOid(morkEnv* ev, const mdbOid* inOid)
if ( store )
{
morkPool* pool = this->GetSpaceStorePool();
morkRow* row = pool->NewRow(ev);
morkRow* row = pool->NewRow(ev, &store->mStore_Zone);
if ( row )
{
row->InitRow(ev, inOid, this, /*length*/ 0, pool);
@ -550,7 +579,7 @@ morkRowSpace::NewRowWithOid(morkEnv* ev, const mdbOid* inOid)
mRowSpace_NextRowId = rid + 1;
}
else
pool->ZapRow(ev, row);
pool->ZapRow(ev, row, &store->mStore_Zone);
if ( this->IsRowSpaceClean() && store->mStore_CanDirty )
this->MaybeDirtyStoreAndSpace(); // InitRow() does already
@ -575,10 +604,10 @@ morkRowSpace::NewRow(morkEnv* ev)
if ( store )
{
mdbOid oid;
oid.mOid_Scope = mSpace_Scope;
oid.mOid_Scope = this->SpaceScope();
oid.mOid_Id = id;
morkPool* pool = this->GetSpaceStorePool();
morkRow* row = pool->NewRow(ev);
morkRow* row = pool->NewRow(ev, &store->mStore_Zone);
if ( row )
{
row->InitRow(ev, &oid, this, /*length*/ 0, pool);
@ -586,7 +615,7 @@ morkRowSpace::NewRow(morkEnv* ev)
if ( ev->Good() && mRowSpace_Rows.AddRow(ev, row) )
outRow = row;
else
pool->ZapRow(ev, row);
pool->ZapRow(ev, row, &store->mStore_Zone);
if ( this->IsRowSpaceClean() && store->mStore_CanDirty )
this->MaybeDirtyStoreAndSpace(); // InitRow() does already

Просмотреть файл

@ -55,7 +55,7 @@
#define morkDerived_kRowSpace /*i*/ 0x7253 /* ascii 'rS' */
#define morkRowSpace_kStartRowMapSlotCount 512
#define morkRowSpace_kStartRowMapSlotCount 11
#define morkRowSpace_kMaxIndexCount 8 /* no more indexes than this */
#define morkRowSpace_kPrimeCacheSize 17 /* should be prime number */
@ -81,7 +81,6 @@ class morkRowSpace : public morkSpace { //
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// morkStore* mSpace_Store; // weak ref to containing store
// mork_scope mSpace_Scope; // the scope for this space
// mork_bool mSpace_DoAutoIDs; // whether db should assign member IDs
// mork_bool mSpace_HaveDoneAutoIDs; // whether actually auto assigned IDs
@ -91,7 +90,11 @@ public: // state is public because the entire Mork system is private
nsIMdbHeap* mRowSpace_SlotHeap;
#ifdef MORK_ENABLE_PROBE_MAPS
morkRowProbeMap mRowSpace_Rows; // hash table of morkRow instances
#else /*MORK_ENABLE_PROBE_MAPS*/
morkRowMap mRowSpace_Rows; // hash table of morkRow instances
#endif /*MORK_ENABLE_PROBE_MAPS*/
morkTableMap mRowSpace_Tables; // all the tables in this row scope
mork_tid mRowSpace_NextTableId; // for auto-assigning table IDs
@ -195,7 +198,7 @@ public:
public: // other map methods
mork_bool AddRowSpace(morkEnv* ev, morkRowSpace* ioRowSpace)
{ return this->AddNode(ev, ioRowSpace->mSpace_Scope, ioRowSpace); }
{ return this->AddNode(ev, ioRowSpace->SpaceScope(), ioRowSpace); }
// the AddRowSpace() boolean return equals ev->Good().
mork_bool CutRowSpace(morkEnv* ev, mork_scope inScope)

Просмотреть файл

@ -40,6 +40,9 @@
#include "morkSearchRowCursor.h"
#endif
#ifndef _MORKUNIQROWCURSOR_
#include "morkUniqRowCursor.h"
#endif
#ifndef _ORKINTABLEROWCURSOR_
#include "orkinTableRowCursor.h"
@ -147,11 +150,11 @@ morkSearchRowCursor::AcquireUniqueRowCursorHandle(morkEnv* ev)
{
orkinTableRowCursor* outCursor = 0;
// morkUniqRowCursor* uniqCursor = this->MakeUniqCursor(ev);
// if ( uniqCursor )
morkUniqRowCursor* uniqCursor = this->MakeUniqCursor(ev);
if ( uniqCursor )
{
// outCursor = uniqCursor->AcquireTableRowCursorHandle(ev);
//uniqCursor->CutStrongRef(ev);
outCursor = uniqCursor->AcquireTableRowCursorHandle(ev);
uniqCursor->CutStrongRef(ev);
}
return outCursor;
}

Просмотреть файл

@ -102,7 +102,7 @@ morkSorting::morkSorting(morkEnv* ev, const morkUsage& inUsage,
nsIMdbHeap* ioNodeHeap, morkTable* ioTable,
nsIMdbCompare* ioCompare,
nsIMdbHeap* ioSlotHeap, mork_column inCol)
: morkObject(ev, inUsage, ioNodeHeap, (morkHandle*) 0)
: morkObject(ev, inUsage, ioNodeHeap, morkColor_kNone, (morkHandle*) 0)
, mSorting_Table( 0 )
, mSorting_Compare( 0 )

Просмотреть файл

@ -74,6 +74,7 @@ class morkSorting : public morkObject {
// mork_uses mNode_Uses; // refcount for strong refs
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// mork_color mBead_Color; // ID for this bead
// morkHandle* mObject_Handle; // weak ref to handle for this object
public: // state is public because the entire Mork system is private

Просмотреть файл

@ -67,7 +67,7 @@ morkSpace::CloseMorkNode(morkEnv* ev) // CloseSpace() only if open
/*public virtual*/
morkSpace::~morkSpace() // assert CloseSpace() executed earlier
{
MORK_ASSERT(mSpace_Scope==0);
MORK_ASSERT(SpaceScope()==0);
MORK_ASSERT(mSpace_Store==0);
MORK_ASSERT(this->IsShutNode());
}
@ -86,9 +86,8 @@ morkSpace::~morkSpace() // assert CloseSpace() executed earlier
morkSpace::morkSpace(morkEnv* ev,
const morkUsage& inUsage, mork_scope inScope, morkStore* ioStore,
nsIMdbHeap* ioHeap, nsIMdbHeap* ioSlotHeap)
: morkNode(ev, inUsage, ioHeap)
: morkBead(ev, inUsage, ioHeap, inScope)
, mSpace_Store( 0 )
, mSpace_Scope( inScope )
, mSpace_DoAutoIDs( morkBool_kFalse )
, mSpace_HaveDoneAutoIDs( morkBool_kFalse )
, mSpace_CanDirty( morkBool_kFalse ) // only when store can be dirtied
@ -119,7 +118,7 @@ morkSpace::CloseSpace(morkEnv* ev) // called by CloseMorkNode();
if ( this->IsNode() )
{
morkStore::SlotWeakStore((morkStore*) 0, ev, &mSpace_Store);
mSpace_Scope = 0;
mBead_Color = 0; // this->CloseBead();
this->MarkShut();
}
else
@ -135,7 +134,7 @@ morkSpace::CloseSpace(morkEnv* ev) // called by CloseMorkNode();
/*static*/ void
morkSpace::NonAsciiSpaceScopeName(morkEnv* ev)
{
ev->NewError("mSpace_Scope > 0x7F");
ev->NewError("SpaceScope() > 0x7F");
}
/*static*/ void

Просмотреть файл

@ -27,6 +27,10 @@
#include "morkNode.h"
#endif
#ifndef _MORKBEAD_
#include "morkBead.h"
#endif
#ifndef _MORKMAP_
#include "morkMap.h"
#endif
@ -38,7 +42,7 @@
/*| morkSpace:
|*/
class morkSpace : public morkNode { //
class morkSpace : public morkBead { //
// public: // slots inherited from morkNode (meant to inform only)
// nsIMdbHeap* mNode_Heap;
@ -54,12 +58,17 @@ class morkSpace : public morkNode { //
// mork_uses mNode_Uses; // refcount for strong refs
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// mork_color mBead_Color; // ID for this bead
public: // bead color setter & getter replace obsolete member mTable_Id:
mork_tid SpaceScope() const { return mBead_Color; }
void SetSpaceScope(mork_scope inScope) { mBead_Color = inScope; }
public: // state is public because the entire Mork system is private
morkStore* mSpace_Store; // weak ref to containing store
mork_scope mSpace_Scope; // the scope for this space
mork_bool mSpace_DoAutoIDs; // whether db should assign member IDs
mork_bool mSpace_HaveDoneAutoIDs; // whether actually auto assigned IDs
mork_bool mSpace_CanDirty; // changes imply the store becomes dirty?

Просмотреть файл

@ -126,7 +126,7 @@ morkPort::morkPort(morkEnv* ev, const morkUsage& inUsage,
morkFactory* inFactory, // the factory for this
nsIMdbHeap* ioPortHeap // the heap to hold all content in the port
)
: morkObject(ev, inUsage, ioNodeHeap, (morkHandle*) 0)
: morkObject(ev, inUsage, ioNodeHeap, morkColor_kNone, (morkHandle*) 0)
, mPort_Env( ev )
, mPort_Factory( 0 )
, mPort_Heap( 0 )
@ -220,6 +220,7 @@ morkStore::morkStore(morkEnv* ev, const morkUsage& inUsage,
, mStore_RowSpaces(ev, morkUsage::kMember, (nsIMdbHeap*) 0, ioPortHeap)
, mStore_AtomSpaces(ev, morkUsage::kMember, (nsIMdbHeap*) 0, ioPortHeap)
, mStore_Zone(ev, morkUsage::kMember, (nsIMdbHeap*) 0, ioPortHeap)
, mStore_Pool(ev, morkUsage::kMember, (nsIMdbHeap*) 0, ioPortHeap)
, mStore_CommitGroupIdentity( 0 )
@ -246,9 +247,6 @@ morkStore::CloseStore(morkEnv* ev) // called by CloseMorkNode();
{
if ( this->IsNode() )
{
// morkFile* file = mStore_File;
// if ( file && file->IsOpenNode() )
// file->CloseMorkNode(ev);
nsIMdbFile* file = mStore_File;
if ( file )
@ -264,7 +262,6 @@ morkStore::CloseStore(morkEnv* ev) // called by CloseMorkNode();
mStore_AtomSpaces.CloseMorkNode(ev);
morkBuilder::SlotStrongBuilder((morkBuilder*) 0, ev, &mStore_Builder);
// morkFile::SlotStrongFile((morkFile*) 0, ev, &mStore_File);
nsIMdbFile_SlotStrongFile((nsIMdbFile*) 0, ev,
&mStore_File);
@ -272,6 +269,7 @@ morkStore::CloseStore(morkEnv* ev) // called by CloseMorkNode();
morkStream::SlotStrongStream((morkStream*) 0, ev, &mStore_OutStream);
mStore_Pool.CloseMorkNode(ev);
mStore_Zone.CloseMorkNode(ev);
this->ClosePort(ev);
this->MarkShut();
}
@ -742,8 +740,9 @@ morkStore::YarnToAtom(morkEnv* ev, const mdbYarn* inYarn)
}
else if ( ev->Good() )
{
morkBuf buf(inYarn->mYarn_Buf, inYarn->mYarn_Fill);
outAtom = mStore_Pool.NewAnonAtom(ev, buf, inYarn->mYarn_Form);
morkBuf b(inYarn->mYarn_Buf, inYarn->mYarn_Fill);
morkZone* z = &mStore_Zone;
outAtom = mStore_Pool.NewAnonAtom(ev, b, inYarn->mYarn_Form, z);
}
}
}

Просмотреть файл

@ -35,6 +35,10 @@
#include "morkPool.h"
#endif
#ifndef _MORKZONE_
#include "morkZone.h"
#endif
#ifndef _MORKATOM_
#include "morkAtom.h"
#endif
@ -66,6 +70,7 @@ class morkPort : public morkObject { // private mork port
// mork_uses mNode_Uses; // refcount for strong refs
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// mork_color mBead_Color; // ID for this bead
// morkHandle* mObject_Handle; // weak ref to handle for this object
public: // state is public because the entire Mork system is private
@ -164,6 +169,8 @@ public: // state is public because the entire Mork system is private
morkRowSpaceMap mStore_RowSpaces; // maps mork_scope -> morkSpace
morkAtomSpaceMap mStore_AtomSpaces; // maps mork_scope -> morkSpace
morkZone mStore_Zone;
morkPool mStore_Pool;
// we alloc a max size book atom to reuse space for atom map key searches:

Просмотреть файл

@ -94,7 +94,7 @@ morkTable::morkTable(morkEnv* ev, /*i*/
morkStore* ioStore, nsIMdbHeap* ioSlotHeap, morkRowSpace* ioRowSpace,
const mdbOid* inOptionalMetaRowOid, // can be nil to avoid specifying
mork_tid inTid, mork_kind inKind, mork_bool inMustBeUnique)
: morkObject(ev, inUsage, ioHeap, (morkHandle*) 0)
: morkObject(ev, inUsage, ioHeap, (mork_color) inTid, (morkHandle*) 0)
, mTable_Store( 0 )
, mTable_RowSpace( 0 )
, mTable_MetaRow( 0 )
@ -109,7 +109,6 @@ morkTable::morkTable(morkEnv* ev, /*i*/
, mTable_ChangesCount( 0 )
, mTable_ChangesMax( 3 ) // any very small number greater than zero
, mTable_Id( inTid )
, mTable_Kind( inKind )
, mTable_Flags( 0 )
@ -402,8 +401,8 @@ morkTable::GetTableOid(morkEnv* ev, mdbOid* outOid)
morkRowSpace* space = mTable_RowSpace;
if ( space )
{
outOid->mOid_Scope = space->mSpace_Scope;
outOid->mOid_Id = mTable_Id;
outOid->mOid_Scope = space->SpaceScope();
outOid->mOid_Id = this->TableId();
}
else
this->NilRowSpaceError(ev);
@ -813,7 +812,11 @@ morkTableMap::~morkTableMap()
morkTableMap::morkTableMap(morkEnv* ev, const morkUsage& inUsage,
nsIMdbHeap* ioHeap, nsIMdbHeap* ioSlotHeap)
#ifdef MORK_BEAD_OVER_NODE_MAPS
: morkBeadMap(ev, inUsage, ioHeap, ioSlotHeap)
#else /*MORK_BEAD_OVER_NODE_MAPS*/
: morkNodeMap(ev, inUsage, ioHeap, ioSlotHeap)
#endif /*MORK_BEAD_OVER_NODE_MAPS*/
{
if ( ev->Good() )
mNode_Derived = morkDerived_kTableMap;

Просмотреть файл

@ -47,6 +47,14 @@
#include "morkNodeMap.h"
#endif
#ifndef _MORKPROBEMAP_
#include "morkProbeMap.h"
#endif
#ifndef _MORKBEAD_
#include "morkBead.h"
#endif
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
class nsIMdbTable;
@ -97,13 +105,19 @@ class morkTable : public morkObject, public morkLink {
// mork_uses mNode_Uses; // refcount for strong refs
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// mork_color mBead_Color; // ID for this bead
// morkHandle* mObject_Handle; // weak ref to handle for this object
public: // bead color setter & getter replace obsolete member mTable_Id:
mork_tid TableId() const { return mBead_Color; }
void SetTableId(mork_tid inTid) { mBead_Color = inTid; }
public: // state is public because the entire Mork system is private
morkStore* mTable_Store; // weak ref to port
// mTable_RowSpace->mSpace_Scope is row scope
// mTable_RowSpace->SpaceScope() is row scope
morkRowSpace* mTable_RowSpace; // weak ref to containing space
morkRow* mTable_MetaRow; // table's actual meta row
@ -116,7 +130,7 @@ public: // state is public because the entire Mork system is private
mork_u2 mTable_ChangesCount; // length of changes list
mork_u2 mTable_ChangesMax; // max list length before rewrite
mork_tid mTable_Id;
// mork_tid mTable_Id;
mork_kind mTable_Kind;
mork_u1 mTable_Flags; // bit flags
@ -316,7 +330,11 @@ public:
/*| morkTableMap: maps mork_token -> morkTable
|*/
#ifdef MORK_BEAD_OVER_NODE_MAPS
class morkTableMap : public morkBeadMap {
#else /*MORK_BEAD_OVER_NODE_MAPS*/
class morkTableMap : public morkNodeMap { // for mapping tokens to tables
#endif /*MORK_BEAD_OVER_NODE_MAPS*/
public:
@ -326,8 +344,26 @@ public:
public: // other map methods
#ifdef MORK_BEAD_OVER_NODE_MAPS
mork_bool AddTable(morkEnv* ev, morkTable* ioTable)
{ return this->AddNode(ev, ioTable->mTable_Id, ioTable); }
{ return this->AddBead(ev, ioTable); }
// the AddTable() boolean return equals ev->Good().
mork_bool CutTable(morkEnv* ev, mork_tid inTid)
{ return this->CutBead(ev, inTid); }
// The CutTable() boolean return indicates whether removal happened.
morkTable* GetTable(morkEnv* ev, mork_tid inTid)
{ return (morkTable*) this->GetBead(ev, inTid); }
// Note the returned table does NOT have an increase in refcount for this.
mork_num CutAllTables(morkEnv* ev)
{ return this->CutAllBeads(ev); }
// CutAllTables() releases all the referenced table values.
#else /*MORK_BEAD_OVER_NODE_MAPS*/
mork_bool AddTable(morkEnv* ev, morkTable* ioTable)
{ return this->AddNode(ev, ioTable->TableId(), ioTable); }
// the AddTable() boolean return equals ev->Good().
mork_bool CutTable(morkEnv* ev, mork_tid inTid)
@ -341,11 +377,37 @@ public: // other map methods
mork_num CutAllTables(morkEnv* ev)
{ return this->CutAllNodes(ev); }
// CutAllTables() releases all the referenced table values.
#endif /*MORK_BEAD_OVER_NODE_MAPS*/
};
#ifdef MORK_BEAD_OVER_NODE_MAPS
class morkTableMapIter: public morkBeadMapIter {
#else /*MORK_BEAD_OVER_NODE_MAPS*/
class morkTableMapIter: public morkMapIter{ // typesafe wrapper class
#endif /*MORK_BEAD_OVER_NODE_MAPS*/
public:
#ifdef MORK_BEAD_OVER_NODE_MAPS
morkTableMapIter(morkEnv* ev, morkTableMap* ioMap)
: morkBeadMapIter(ev, ioMap) { }
morkTableMapIter( ) : morkBeadMapIter() { }
void InitTableMapIter(morkEnv* ev, morkTableMap* ioMap)
{ this->InitBeadMapIter(ev, ioMap); }
morkTable* FirstTable(morkEnv* ev)
{ return (morkTable*) this->FirstBead(ev); }
morkTable* NextTable(morkEnv* ev)
{ return (morkTable*) this->NextBead(ev); }
morkTable* HereTable(morkEnv* ev)
{ return (morkTable*) this->HereBead(ev); }
#else /*MORK_BEAD_OVER_NODE_MAPS*/
morkTableMapIter(morkEnv* ev, morkTableMap* ioMap)
: morkMapIter(ev, ioMap) { }
@ -369,6 +431,7 @@ public:
mork_change*
CutHereTable(morkEnv* ev, mork_tid* outTid, morkTable** outTable)
{ return this->CutHere(ev, outTid, outTable); }
#endif /*MORK_BEAD_OVER_NODE_MAPS*/
};
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789

Просмотреть файл

@ -88,7 +88,7 @@ morkThumb::~morkThumb() // assert CloseThumb() executed earlier
morkThumb::morkThumb(morkEnv* ev,
const morkUsage& inUsage, nsIMdbHeap* ioHeap,
nsIMdbHeap* ioSlotHeap, mork_magic inMagic)
: morkObject(ev, inUsage, ioHeap, (morkHandle*) 0)
: morkObject(ev, inUsage, ioHeap, morkColor_kNone, (morkHandle*) 0)
, mThumb_Magic( 0 )
, mThumb_Total( 0 )
, mThumb_Current( 0 )

Просмотреть файл

@ -68,6 +68,7 @@ class morkThumb : public morkObject {
// mork_uses mNode_Uses; // refcount for strong refs
// mork_refs mNode_Refs; // refcount for strong refs + weak refs
// mork_color mBead_Color; // ID for this bead
// morkHandle* mObject_Handle; // weak ref to handle for this object
public: // state is public because the entire Mork system is private

Просмотреть файл

@ -470,7 +470,7 @@ void
morkWriter::WriteAtomSpaceAsDict(morkEnv* ev, morkAtomSpace* ioSpace)
{
morkStream* stream = mWriter_Stream;
mork_scope scope = ioSpace->mSpace_Scope;
mork_scope scope = ioSpace->SpaceScope();
if ( scope < 0x80 )
{
if ( mWriter_LineSize )
@ -622,7 +622,11 @@ morkWriter::DirtyAll(morkEnv* ev)
space->SetRowSpaceDirty();
if ( ev->Good() )
{
#ifdef MORK_ENABLE_PROBE_MAPS
morkRowProbeMapIter* ri = &mWriter_RowSpaceRowsIter;
#else /*MORK_ENABLE_PROBE_MAPS*/
morkRowMapIter* ri = &mWriter_RowSpaceRowsIter;
#endif /*MORK_ENABLE_PROBE_MAPS*/
ri->InitRowMapIter(ev, &space->mRowSpace_Rows);
morkRow* row = 0; // old key row in the map
@ -646,11 +650,17 @@ morkWriter::DirtyAll(morkEnv* ev)
morkTableMapIter* ti = &mWriter_RowSpaceTablesIter;
ti->InitTableMapIter(ev, &space->mRowSpace_Tables);
#ifdef MORK_BEAD_OVER_NODE_MAPS
morkTable* table = ti->FirstTable(ev);
for ( ; table && ev->Good(); table = ti->NextTable(ev) )
#else /*MORK_BEAD_OVER_NODE_MAPS*/
mork_tid* key = 0; // ignore keys in table map
morkTable* table = 0; // old key row in the map
for ( c = ti->FirstTable(ev, key, &table); c && ev->Good();
c = ti->NextTable(ev, key, &table) )
#endif /*MORK_BEAD_OVER_NODE_MAPS*/
{
if ( table && table->IsTable() )
{
@ -979,11 +989,17 @@ morkWriter::WriteAllStoreTables(morkEnv* ev)
morkTableMapIter* ti = &mWriter_RowSpaceTablesIter;
ti->InitTableMapIter(ev, &space->mRowSpace_Tables);
#ifdef MORK_BEAD_OVER_NODE_MAPS
morkTable* table = ti->FirstTable(ev);
for ( ; table && ev->Good(); table = ti->NextTable(ev) )
#else /*MORK_BEAD_OVER_NODE_MAPS*/
mork_tid* key2 = 0; // ignore keys in table map
morkTable* table = 0; // old key row in the map
for ( c = ti->FirstTable(ev, key2, &table); c && ev->Good();
c = ti->NextTable(ev, key2, &table) )
#endif /*MORK_BEAD_OVER_NODE_MAPS*/
{
if ( table && table->IsTable() )
{
@ -1008,7 +1024,11 @@ morkWriter::WriteAllStoreTables(morkEnv* ev)
{
mWriter_TableRowScope = 0; // ensure no table context now
#ifdef MORK_ENABLE_PROBE_MAPS
morkRowProbeMapIter* ri = &mWriter_RowSpaceRowsIter;
#else /*MORK_ENABLE_PROBE_MAPS*/
morkRowMapIter* ri = &mWriter_RowSpaceRowsIter;
#endif /*MORK_ENABLE_PROBE_MAPS*/
ri->InitRowMapIter(ev, &space->mRowSpace_Rows);
morkRow* row = 0; // old row in the map
@ -1299,7 +1319,7 @@ mork_bool
morkWriter::PutTableDict(morkEnv* ev, morkTable* ioTable)
{
morkRowSpace* space = ioTable->mTable_RowSpace;
mWriter_TableRowScope = space->mSpace_Scope;
mWriter_TableRowScope = space->SpaceScope();
mWriter_TableForm = 0; // (f=iso-8859-1)
mWriter_TableAtomScope = 'v'; // (a=v)
mWriter_TableKind = ioTable->mTable_Kind;

Просмотреть файл

@ -191,7 +191,12 @@ public: // state is public because the entire Mork system is private
morkRowSpaceMapIter mWriter_StoreRowSpacesIter; // for mStore_RowSpaces
morkTableMapIter mWriter_RowSpaceTablesIter; // for mRowSpace_Tables
#ifdef MORK_ENABLE_PROBE_MAPS
morkRowProbeMapIter mWriter_RowSpaceRowsIter; // for mRowSpace_Rows
#else /*MORK_ENABLE_PROBE_MAPS*/
morkRowMapIter mWriter_RowSpaceRowsIter; // for mRowSpace_Rows
#endif /*MORK_ENABLE_PROBE_MAPS*/
// { ===== begin morkNode interface =====
public: // morkNode virtual methods

Просмотреть файл

@ -67,8 +67,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -368,7 +368,7 @@ orkinEnv::GetHeap(nsIMdbHeap** acqHeap)
if ( ev )
{
nsIMdbHeap* heap = ev->mEnv_Heap;
if ( heap && heap->AddStrongRef(this) == 0 )
if ( heap && heap->HeapAddStrongRef(this) == 0 )
outHeap = heap;
}
if ( acqHeap )

Просмотреть файл

@ -69,8 +69,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -69,8 +69,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -69,8 +69,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -36,6 +36,16 @@
orkinHeap::orkinHeap() // does nothing
#ifdef MORK_DEBUG_HEAP_STATS
: sHeap_AllocCount( 0 )
, sHeap_FreeCount( 0 )
, sHeap_BlockCount( 0 )
, sHeap_BlockVolume( 0 )
, sHeap_HighWaterVolume( 0 )
, sHeap_HighWaterTenKilo( 0 )
, sHeap_HighWaterHundredKilo( 0 )
#endif /*MORK_DEBUG_HEAP_STATS*/
{
}
@ -46,15 +56,47 @@ orkinHeap::~orkinHeap() // does nothing
// { ===== begin nsIMdbHeap methods =====
/*virtual*/ mdb_err
orkinHeap::Alloc(nsIMdbEnv* ev, // allocate a piece of memory
orkinHeap::Alloc(nsIMdbEnv* mev, // allocate a piece of memory
mdb_size inSize, // requested size of new memory block
void** outBlock) // memory block of inSize bytes, or nil
{
MORK_USED_1(ev);
#ifdef MORK_DEBUG_HEAP_STATS
mdb_size realSize = inSize;
inSize += 8; // sizeof(mork_u4) * 2
++sHeap_AllocCount;
#endif /*MORK_DEBUG_HEAP_STATS*/
MORK_USED_1(mev);
mdb_err outErr = 0;
void* block = new char[ inSize ];
void* block = ::operator new(inSize);
if ( !block )
outErr = morkEnv_kOutOfMemoryError;
#ifdef MORK_DEBUG_HEAP_STATS
else
{
mork_u4* array = (mork_u4*) block;
*array++ = realSize;
*array++ = orkinHeap_kTag;
block = array;
++sHeap_BlockCount;
mork_num blockVol = sHeap_BlockVolume + realSize;
sHeap_BlockVolume = blockVol;
if ( blockVol > sHeap_HighWaterVolume )
{
sHeap_HighWaterVolume = blockVol;
mork_num tenKiloVol = blockVol / (10 * 1024);
if ( tenKiloVol > sHeap_HighWaterTenKilo )
{
sHeap_HighWaterTenKilo = tenKiloVol;
mork_num hundredKiloVol = blockVol / (100 * 1024);
if ( hundredKiloVol > sHeap_HighWaterHundredKilo )
sHeap_HighWaterHundredKilo = hundredKiloVol;
}
}
}
#endif /*MORK_DEBUG_HEAP_STATS*/
MORK_ASSERT(outBlock);
if ( outBlock )
@ -63,26 +105,56 @@ orkinHeap::Alloc(nsIMdbEnv* ev, // allocate a piece of memory
}
/*virtual*/ mdb_err
orkinHeap::Free(nsIMdbEnv* ev, // free block allocated earlier by Alloc()
orkinHeap::Free(nsIMdbEnv* mev, // free block allocated earlier by Alloc()
void* inBlock)
{
MORK_USED_1(ev);
#ifdef MORK_DEBUG_HEAP_STATS
++sHeap_FreeCount;
#endif /*MORK_DEBUG_HEAP_STATS*/
MORK_USED_1(mev);
MORK_ASSERT(inBlock);
if ( inBlock )
delete [] (char *)inBlock;
{
#ifdef MORK_DEBUG_HEAP_STATS
morkEnv* ev = morkEnv::FromMdbEnv(mev);
mork_u4* array = (mork_u4*) inBlock;
if ( *--array != orkinHeap_kTag )
{
if ( ev )
ev->NewWarning("heap block tag not hEaP");
}
mork_u4 realSize = *--array;
inBlock = array;
if ( sHeap_BlockCount )
--sHeap_BlockCount;
else if ( ev )
ev->NewWarning("sHeap_BlockCount underflow");
if ( sHeap_BlockVolume >= realSize )
sHeap_BlockVolume -= realSize;
else if ( ev )
{
sHeap_BlockVolume = 0;
ev->NewWarning("sHeap_BlockVolume underflow");
}
#endif /*MORK_DEBUG_HEAP_STATS*/
::operator delete(inBlock);
}
return 0;
}
/*virtual*/ mdb_err
orkinHeap::AddStrongRef(nsIMdbEnv* ev) // does nothing
orkinHeap::HeapAddStrongRef(nsIMdbEnv* ev) // does nothing
{
MORK_USED_1(ev);
return 0;
}
/*virtual*/ mdb_err
orkinHeap::CutStrongRef(nsIMdbEnv* ev) // does nothing
orkinHeap::HeapCutStrongRef(nsIMdbEnv* ev) // does nothing
{
MORK_USED_1(ev);
return 0;

Просмотреть файл

@ -29,10 +29,32 @@
//3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
#define orkinHeap_kTag 0x68456150 /* ascii 'hEaP' */
/*| orkinHeap:
|*/
class orkinHeap : public nsIMdbHeap { //
#ifdef MORK_DEBUG_HEAP_STATS
protected:
mork_num sHeap_AllocCount; // number of times Alloc() is called
mork_num sHeap_FreeCount; // number of times Free() is called
mork_num sHeap_BlockCount; // number of outstanding blocks
mork_num sHeap_BlockVolume; // sum of sizes for all outstanding blocks
mork_num sHeap_HighWaterVolume; // largest value of sHeap_BlockVolume seen
mork_num sHeap_HighWaterTenKilo; // HighWaterVolume in 10K granularity
mork_num sHeap_HighWaterHundredKilo; // HighWaterVolume in 100K granularity
public: // getters
mork_num HeapAllocCount() const { return sHeap_AllocCount; }
mork_num HeapFreeCount() const { return sHeap_FreeCount; }
mork_num HeapBlockCount() const { return sHeap_AllocCount - sHeap_FreeCount; }
mork_num HeapBlockVolume() const { return sHeap_BlockVolume; }
mork_num HeapHighWaterVolume() const { return sHeap_HighWaterVolume; }
#endif /*MORK_DEBUG_HEAP_STATS*/
public:
orkinHeap(); // does nothing
virtual ~orkinHeap(); // does nothing
@ -51,8 +73,8 @@ public:
virtual mdb_err Free(nsIMdbEnv* ev, // free block allocated earlier by Alloc()
void* inBlock);
virtual mdb_err AddStrongRef(nsIMdbEnv* ev); // does nothing
virtual mdb_err CutStrongRef(nsIMdbEnv* ev); // does nothing
virtual mdb_err HeapAddStrongRef(nsIMdbEnv* ev); // does nothing
virtual mdb_err HeapCutStrongRef(nsIMdbEnv* ev); // does nothing
// } ===== end nsIMdbHeap methods =====
};

Просмотреть файл

@ -76,8 +76,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -70,8 +70,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -77,8 +77,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -69,8 +69,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -69,8 +69,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -472,7 +472,7 @@ orkinTable::GetRowScope(nsIMdbEnv* mev, mdb_scope* outRowScope)
morkTable* table = (morkTable*) mHandle_Object;
morkRowSpace* space = table->mTable_RowSpace;
if ( space )
rowScope = space->mSpace_Scope;
rowScope = space->SpaceScope();
else
table->NilRowSpaceError(ev);

Просмотреть файл

@ -69,8 +69,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -71,8 +71,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }

Просмотреть файл

@ -69,8 +69,11 @@ private: // copying is not allowed
// } ===== end morkNode methods =====
protected: // morkHandle memory management operators
void* operator new(size_t inSize, morkPool& ioPool, morkZone& ioZone, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize, &ioZone); }
void* operator new(size_t inSize, morkPool& ioPool, morkEnv* ev)
{ return ioPool.NewHandle(ev, inSize); }
{ return ioPool.NewHandle(ev, inSize, (morkZone*) 0); }
void* operator new(size_t inSize, morkHandleFace* ioFace)
{ MORK_USED_1(inSize); return ioFace; }